:: [DNG] vdev status update in daedalu…
Página Principal
Delete this message
Reply to this message
Autor: aitor
Data:  
Para: dng
Tópicos Antigos: Re: [DNG] vdev status update in chimaera
Assunto: [DNG] vdev status update in daedalus (Was: vdev status update in chimaera)
Hi,

On 10/4/23 21:07, aitor wrote:
> On 27/3/23 1:02, aitor wrote:
>> I've upgraded the versions of vdev and libudev-compat after the the eventfs integration.
> I've fixed several bugs and updated the eventfs and libudev-compat packaging


I've found two important bugs in Jude Nelson's libudev-compat, both related to the udev monitor:

https://github.com/jcnelson/vdev/blob/master/libudev-compat/libudev-monitor.c

#1) The first one is in the line nº 211, where the function

udev_monitor_new_from_filesystem( udev );

is invoked without defining the `udev_monitor_netlink_group` as UDEV_MONITOR_UDEV, the group that
receives the "udev" events sent out after vdev has finished its event processing, all actions have
been processed, and needed device nodes have been created, as defined in the line nº 243:

udev_monitor->snl_destination.nl.nl_groups = UDEV_MONITOR_UDEV;

Bear in mind that applications should not access directly the "kernel" events before vdev has configured
them. Only device managers like udevd, vdevd... should connect directly to them.

The code in these lines should be as follows:


else if (streq(name, "udev")) {

       group = UDEV_MONITOR_UDEV;


       // libudev-compat: read from an event buffer on the fs
       return udev_monitor_new_from_filesystem( udev );


}


#2) The second bug is in the line nº 169, because this line is not considering the group UDEV_MONITOR_NONE,
in which case name == NULL (*), resulting in a segmentation fault. So, the code should be as follows
(the condition name != NULL is evaluated first):

if( name && strcmp( name, "udev" ) == 0 ) {

    return udev_monitor_new_from_filesystem(udev);
}
else {


    return udev_monitor_new_from_netlink_fd(udev, name, -1);
}


Cheers,

Aitor.

[*] Look at the lines nº 204 - 206:

 if (name == NULL) {

     group = UDEV_MONITOR_NONE;
}