"mdev: remove undocumented subsystem/devname matching hack" disaster.

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 29 13:58:47 UTC 2013


On Thu, Mar 28, 2013 at 11:14 AM, Piotr Karbowski
<piotr.karbowski at gmail.com> wrote:
> On 03/04/2013 03:47 AM, Denys Vlasenko wrote:
>>
>> On Friday 01 March 2013 21:19, Piotr Karbowski wrote:
>>>
>>> log attached from running mdev with both patches applied onto 1.21.0.

mdev[674]: 21.569605 waiting for ''
mdev[675]: 21.570325 waiting for ''
mdev[676]: 21.571087 waiting for ''
mdev[677]: 21.571604 waiting for ''
mdev[678]: 21.572118 waiting for ''
mdev[679]: 21.572529 waiting for ''

This message can only be shown if /dev/mdev.seq exists but contains
nothing (zero-length file). Not even a newline.
Please change your init script to create  /dev/mdev.seq which contains
a single newline. Say, by using "echo >/dev/mdev.seq", because
current code will only consider _this exact file contents_
as the seed seqfile.

> I've tested latest busybox git code, the patch seems to be already commited
> there. I did the test without the old debuging patches you sent me.
>
> Mdev.log attached, /dev/snd/* still have wrong permissions.
>
>         crw-rw---- 1 root root  116,  5 Mar 28 11:05 controlC0
>         crw-rw---- 1 root audio 226, 64 Mar 28 11:05 controlD64
>         crw-rw---- 1 root root  116,  4 Mar 28 11:05 hwC0D0
>         crw-rw---- 1 root root  116,  3 Mar 28 11:05 pcmC0D0c
>         crw-rw---- 1 root root  116,  2 Mar 28 11:05 pcmC0D0p
>         crw-rw---- 1 root root  116, 33 Mar 28 11:05 timer

Here is the part of the log where /dev/controlC0 is created:

mdev[729]: 25.398178 exiting
^^^^^^^^^^^^^^^^ prev mdev exits
mdev[730]: 25.399677 ACTION:add SUBSYSTEM:sound DEVNAME:snd/controlC0
DEVPATH:/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0
mdev[730]: dev 116,5
mdev[730]: rule matched, line 111
mdev[730]: mknod snd/controlC0 (116,5) 20660 0:0
^^^^^^^^^^^^^^^^^^^^^ mdev uses uid:gid 0:0
mdev[730]: running: /opt/mdev/helpers/catch-all
mdev[730]: 25.412042 exiting

So, it looks like uid:gid 0:0 is set by mdev, not by something else.
You  said that you are using this rule:

        pcm.*           root:audio 660 =snd/
        control.*       root:audio 660 =snd/
        midi.*          root:audio 660 =snd/
        seq             root:audio 660 =snd/
        timer           root:audio 660 =snd/

Unfortunately current code has no logging in parsing code where
it parses "user:group". The code is:

                /* 2nd field: uid:gid - device ownership */
                if (get_uidgid(&G.cur_rule.ugid, tokens[1],
/*allow_numeric:*/ 1) == 0) {
                        bb_error_msg("unknown user/group '%s' on line
%d", tokens[1], G.parser->lineno);
                        goto next_rule;
                }

Please add this line after this block of code (after the line which
has just "}"):

bb_error_msg("line:%d str:'%s' gid:%d", G.parser->lineno, tokens[1],
G.cur_rule.ugid.gid);

Then recompile, rerun the test, send me the new log,
and your mdev.conf too.


> the ENV=regex; thingy is nice, can I combine multiple env vars there? Like
>
>         SUBSYSTEM=net;DEVPATH=/devices/virtual/net/.*;.* root:root 600 !

Yes, multiple eenvvars can be checked like the above.
-- 
vda


More information about the busybox mailing list