possible race condition in kdbus:domain

Kay Sievers kay at vrfy.org
Wed May 7 16:33:22 PDT 2014


On Thu, May 8, 2014 at 1:22 AM, John de la Garza <john at jjdev.com> wrote:
> On Thu, May 08, 2014 at 12:20:16AM +0200, Kay Sievers wrote:
>> > Adding msleep(5) fixes this in some cases do does msleep(0).
>> >
>> > I'm thinking this may not always work and kdbus_domain_new should
>> > explicitly wait till the file shows up in /dev before returning.
>> >
>> > Is it safe to assume udev will finish in a fixed time or should
>> > it be checked?
>>
>> Just mount devtmpfs at /dev, and forget about all the hacks. :)

> It looks like /dev is devtmpfs
>
> root at sol:/home/john/kdbus# mount | grep devtmpfs
> udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=981247,mode=755)
>
> Is this what you would expect (files not cleaned up)?
> -----------------------------------------------------
>
> root at sol:/home/john/kdbus# insmod kdbus.ko
> root at sol:/home/john/kdbus# ./test/test-kdbus
> RUNNING TEST 'domain make' ................... OK
>
> SUMMARY: 1 tests passed, 0 skipped, 0 failed
> root at sol:/home/john/kdbus# tree /dev/kdbus/
> /dev/kdbus/
> ├── control
> └── domain
>     └── blah
>         └── control
>
> 2 directories, 2 files
> root at sol:/home/john/kdbus# ./test/test-kdbus
> Assertion 'access("/dev/" KBUILD_MODNAME "/domain/blah/control", F_OK) < 0' failed in check_domain_make(), line 304
> RUNNING TEST 'domain make' ................... ERROR
>
> SUMMARY: 0 tests passed, 0 skipped, 1 failed

That works just fine here. I have no idea what goes wrong on your box.

This shows the added and removed kernel devices, with them, the nodes
in /dev are added and removed too:
  KERNEL[26080.498938] add
/devices/virtual/kdbus/kdbus!domain!blah!control (kdbus)
KERNEL[26080.499019] remove
/devices/virtual/kdbus/kdbus!domain!blah!control (kdbus)

Kay


More information about the dbus mailing list