udev-131 strange segfault
Hi there!
I managed to let udev-131 segfault at startup.
I configured it like this:
CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix Running it in gdb shows it segfaults at udev-rules.c:831
(gdb) run
Starting program: /tmp/udev-131/udev/udevd
Program received signal SIGSEGV, Segmentation fault. 0x0804ea06 in get_key (udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8, op=0xafcdc5d0, value=0xafcdc5d4)
at udev-rules.c:831
831 dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value);
Longer backtrace:
bt full
#0 0x0804ea06 in get_key (udev=0x807d008, line=0xafa7e690, key=0xafa7e378, op=0xafa7e370, value=0xafa7e374)
at udev-rules.c:831
linepos = 0xafa7e6f0 "block"
temp = 0xafa7e6f6 ", ENV{MAJOR}=\"254\", ENV{MINOR}=\"0\",
SYMLINK+=\"root\"\n"
#1 0x0804f02c in add_rule (rules=0x807d188, line=0xafa7e6e4 "SUBSYSTEM",
filename=0x808c7f8 "/dev/.udev/rules.d/10-root-link.rules",
filename_off=1, lineno=3) at udev-rules.c:1039
key = 0xafa7e6e4 "SUBSYSTEM"
value = 0xafa7e6f0 "block"
op = OP_MATCH
valid = 0
linepos = 0xafa7e6e4 "SUBSYSTEM"
attr = 0xa7dea6c0 "�8��"
physdev = 0
rule_tmp = {rules = 0x807d188, rule = {{type = 1 '\001', rule = {type
= 1 '\001', flags = 0 '\0',
token_count = 0, label_off = 0, filename_off = 1, filename_line = 3},
key = {type = 1 '\001',
flags = 0 '\0', op = 0 '\0', glob = 0 '\0', value_off = 0, {attr_off =
196609, ignore_error = 196609,
i = 196609, rule_goto = 196609, mode = 196609, uid = 196609, gid =
196609, num_fake_part = 196609,
devlink_prio = 196609, event_timeout = 196609}}}}, token = {{{type =
0 '\0', rule = {type = 0 '\0',
flags = 0 '\0', token_count = 0, label_off = 0, filename_off = 0,
filename_line = 0}, key = {
type = 0 '\0', flags = 0 '\0', op = 0 '\0', glob = 0 '\0', value_off
= 0, {attr_off = 0,
ignore_error = 0, i = 0, rule_goto = 0, mode = 0, uid = 0, gid =
0, num_fake_part = 0,
devlink_prio = 0, event_timeout = 0}}}} <repeats 64 times>},
token_cur = 0}
__FUNCTION__ = "add_rule"
#2 0x08050dd1 in parse_file (rules=0x807d188,
filename=0x808c7f8 "/dev/.udev/rules.d/10-root-link.rules",
filename_off=1) at udev-rules.c:1503
key = 0xafa7e6e4 "SUBSYSTEM"
len = 72
f = (FILE *) 0x808b228
first_token = 0
line = "SUBSYSTEM\000=\"block\000, ENV{MAJOR}=\"254\", ENV{MINOR}=\"0\", SYMLINK+=\"root\"\n", '\0' <repeats 452
times>, "u���A�ߧp\216\004\b\000\000\000\000\000\000\000\000Т��\002\000\000\000 (:��\030\213\004\b4\031���\017��l駯�����駯����", '\0' <repeats 17
times>, "���", '\0' <repeats 12
times>, "@�����\000^�\003\000\000�\a�\002\003\000\000\000\f�t>��\000\000\000\000\000\000\000"...
This is the rules file it seems to parse at that moment:
# Created by /lib/udev/write_root_link_rule
# This rule should create /dev/root as link to real root device. SUBSYSTEM="block", ENV{MAJOR}="254", ENV{MINOR}="0", SYMLINK+="root"
Regards
Matthias
Quoted 6 lines · Matthias Schwarzott
I managed to let udev-131 segfault at startup.
I configured it like this:
CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix> Running it in gdb shows it segfaults at udev-rules.c:831
Quoted 8 lines
(gdb) run
Starting program:/tmp/udev-131/udev/udevdProgram received signal SIGSEGV, Segmentation fault.
0x0804ea06inget_key(udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8, op=0xafcdc5d0, value=0xafcdc5d4)
at udev-rules.c:831
831dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value);
Adding "-O2" to the CFLAGS makes it work, right?
I guess the debug macro does not get "compiled-out" without optimization and it tries to index operation_str[], which is just nothing.
Thanks,
Kay
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Matthias Schwarzott
I managed to let udev-131 segfault at startup.
I configured it like this:
CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix> >
Running it in gdb shows it segfaults at udev-rules.c:831(gdb) run
Starting program:/tmp/udev-131/udev/udevd
Quoted 9 lines
Quoted 6 lines
Program received signal SIGSEGV, Segmentation fault.
0x0804ea06inget_key(udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8, op=0xafcdc5d0, value=0xafcdc5d4)
at udev-rules.c:831
831 dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key,
*value);Adding "-O2" to the CFLAGS makes it work, right?
Yes, this works.
Regards
Matthias