"mdev: remove undocumented subsystem/devname matching hack" disaster.
Piotr Karbowski
piotr.karbowski at gmail.com
Tue Apr 2 11:58:59 UTC 2013
On 03/29/2013 02:58 PM, Denys Vlasenko wrote:
> 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.
Okey, let's continue here.
FYI, the alsa is compiled as modules, so first mdev -s does not pick
them up, later in init script there is coldplug part, after setting mdev
as hotplug agent
find /sys -name 'modalias' -type f -exec cat '{}' + | sort -u | xargs
modprobe -b -a 2>/dev/null
Running mdev -s after it does set correct permissions in /dev/snd/.
Also I am aware of the -net/ in config, its leftover from older version
and not yet ported.
The mdev.log is regular gzip file but because of gmail I added .bin sufix.
-- Piotr.
-------------- next part --------------
# mdev-like-a-boss
# Syntax:
# [-]devicename_regex user:group mode [>|=path] [@|$|*cmd args...]
#
# =: move, >: move and create a symlink
# @|$|*: run $cmd on delete, @cmd on create, *cmd on both
# support module loading on hotplug
$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
# null may already exist; therefore ownership has to be changed with command
null root:root 666 @chmod 666 $MDEV
zero root:root 666
full root:root 666
random root:root 444
urandom root:root 444
hwrandom root:root 444
grsec root:root 660
# Kernel-based Virtual Machine.
kvm root:kvm 660
kmem root:root 640
mem root:root 640
port root:root 640
# console may already exist; therefore ownership has to be changed with command
console root:tty 600 @chmod 600 $MDEV
ptmx root:tty 666
pty.* root:tty 660
# Typical devices
tty root:tty 666
tty[0-9]* root:tty 660
vcsa*[0-9]* root:tty 660
ttyS[0-9]* root:uucp 660
# block devices
ram([0-9]*) root:disk 660 >rd/%1
loop([0-9]+) root:disk 660 >loop/%1
sd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
vd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
hd[a-z].* root:disk 660 */opt/mdev/helpers/storage-device
md[0-9]* root:disk 660 */opt/mdev/helpers/storage-device
dm-[0-9]* root:disk 660 */opt/mdev/helpers/storage-device
mmcblk[0-9].* root:disk 660 */opt/mdev/helpers/storage-device
sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
fd[0-9]* root:floppy 660
# Run settle-nics every time new NIC appear.
# If you don't want to auto-populate /etc/mactab with NICs, run 'settle-nis' without '--write-mactab' param.
-net/.* root:root 600 @/opt/mdev/helpers/settle-nics --write-mactab
tun[0-9]* root:kvm 660 =net/
tap[0-9]* root:root 600 =net/
# alsa sound devices and audio stuff
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/
adsp root:audio 660 >sound/
audio root:audio 660 >sound/
dsp root:audio 660 >sound/
mixer root:audio 660 >sound/
sequencer.* root:audio 660 >sound/
# raid controllers
cciss!(.*) root:disk 660 =cciss/%1
ida!(.*) root:disk 660 =ida/%1
rd!(.*) root:disk 660 =rd/%1
fuse root:root 666
card[0-9] root:video 660 =dri/
agpgart root:root 660 >misc/
psaux root:root 660 >misc/
rtc root:root 664 >misc/
# input stuff
event[0-9]+ root:root 640 =input/
mice root:root 640 =input/
mouse[0-9] root:root 640 =input/
ts[0-9] root:root 600 =input/
# v4l stuff
vbi[0-9] root:video 660 >v4l/
video[0-9] root:video 660 >v4l/
# dvb stuff
dvb.* root:video 660
# Don't create old usbdev* devices.
usbdev[0-9].[0-9]* root:root 660 !
# Stop creating x:x:x:x which looks like /dev/dm-*
[0-9]+\:[0-9]+\:[0-9]+\:[0-9]+ root:root 660 !
# /dev/cpu support.
microcode root:root 600 =cpu/
cpu([0-9]+) root:root 600 =cpu/%1/cpuid
msr([0-9]+) root:root 600 =cpu/%1/msr
# Catch-all other devices, the script will
# populate /dev/bus/usb etc...
.* root:root 660 */opt/mdev/helpers/catch-all
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdev.log.gz.bin
Type: application/octet-stream
Size: 28237 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20130402/e4b1be42/attachment-0001.bin>
More information about the busybox
mailing list