[pve-devel] [PATCH container v2 09/11] manage DHCP for containers with custom entrypoint

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jul 9 15:00:13 CEST 2025


On Wed, Jul 09, 2025 at 02:43:06PM +0200, Filip Schauer wrote:
> On 25/06/2025 10:50, Wolfgang Bumiller wrote:
> > > +    my $pid = PVE::LXC::find_lxc_pid($vmid);
> > > +    my $rootdir = "/proc/$pid/root";
> > ^ When using this path over a potentially longer period of time it's
> > better to use
> > 
> >      my ($pid, $pidfd) = PVE::LXC::open_lxc_pid($vmid);
> > 
> > The open pidfd should guard against pid reuse during these operations.
> 
> Unfortunatelly /usr/share/lxc/hooks/dhclient-script expects a path in
> $ROOTFS.

Yeah.
So replace the `my $pid = ...` line with what I wrote to keep the
`$pidfd` around for as long as `$rootdir` is being used.




More information about the pve-devel mailing list