[systemd-devel] [udev] Wrong PID used in netlink socket
Kay Sievers
kay at vrfy.org
Thu Oct 10 06:36:25 PDT 2013
On Thu, Oct 10, 2013 at 3:08 PM, Sven Schnelle <svens at stackframe.org> wrote:
> i was debugging a problem in my own program which sometimes received
> 'Address already in use' during creation of the netlink socket. It turned
> out
> that udevd has the same bug. What actually happens is that udevd opens
> the netlink socket, and forks afterwards. that doesn't sound bad at all, but
> the pid of udevd is stored inside the nl_sockaddr structure. So after udevd
> has forked, the PID stored in the kernel is no longer existent. If another
> process
> is now started that wants to do netlink communication with the kernel and
> has (by coincidence) the same PID, it will fail.
What's the actual problem you see?
Note, that the netlink *address* just happens to be the PID in the
usual case, but it's not necessarily the PID. For netlink t's just a
number, an address not a PID. The second netlink socket a process
opens gets a negative address instead of anything related to the PID
of the caller.
Kay
More information about the systemd-devel
mailing list