The "useradd" command segfaults while adding many users simultaneously
Issue
- A script, when run, creates users which works as expected. The script bases itself on a copy of /etc/passwd on another system to create local accounts. There are 138 accounts to be created, the script works for 135 and for the last 3 ones the command useradd generates a coredump.
If you remove all the accounts created and run the script only for the last 3 users which caused a coredump earlier, it works perfectly.
Core was generated by `useradd -u xxxx -g xxx -G zzzzz -d /aaa/bbb/ccc/ddd/zzzz -m -s /bin/bash -'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007f8f7503a2d6 in __strcmp_sse42 () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64
(gdb) bt
#0 0x00007f8f7503a2d6 in __strcmp_sse42 () from /lib64/libc.so.6
#1 0x00007f8f75b187d7 in merge_group_entries () at groupio.c:352
#2 group_open_hook () at groupio.c:262
#3 0x00007f8f75b1a944 in commonio_open (db=0x7f8f75d22840, mode=<value optimized out>) at commonio.c:646
#4 0x00007f8f75b11057 in open_files () at useradd.c:1456
#5 0x00007f8f75b138eb in main (argc=<value optimized out>, argv=<value optimized out>) at useradd.c:1938
(gdb) f 1
#1 0x00007f8f75b187d7 in merge_group_entries () at groupio.c:352
352 if (0 == strcmp(*pmember, gptr2->gr_mem[i])) {
Environment
- shadow-utils-4.1.4.2-13.el6.x86_64
- Red Hat Enterprise Linux 6
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.