Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Useradd segmentation fault [solved]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
12 posts • Page 1 of 1
Author
Message
kaizushi
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 77
Joined: Sat Sep 22, 2018 1:44 pm

Useradd segmentation fault [solved]

  • Quote

Post by kaizushi » Wed Jan 18, 2023 5:55 am

I am having an issue with the useradd command doing a segfault, I first asked about this problem on Libera IRC #gentoo and the person helped me talked me through gdb, and opening a bug ticket for shadow. I am copying the same information here because I am interested in a workaround. The system is a production shared webserver, and it's pretty hard to do what I need to do without having useradd working.

Kernel version: Linux 6.1.2
GCC version: Gentoo Hardened 12.2.1_p20221231 p8
Shadow version: 4.13-r1

I have tried the following...
* Rebuild util-linux, shadow, attr, pam.
* Try an older kernel version (because of the gdb output)
* Rebuilt the same packages above for the older Linux 6.0.19 kernel.

The gdb output...

Code: Select all

# gdb --args useradd -m -G users test1298
GNU gdb (Gentoo 12.1 vanilla) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from useradd...
Reading symbols from /usr/lib/debug//usr/sbin/useradd.debug...
(gdb) run
Starting program: /usr/sbin/useradd -m -G users test1298
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00006441cfa84319 in __sgr_dup (sgent=0x1000) at sgroupio.c:36
36      sgroupio.c: No such file or directory.
(gdb) bt
#0  0x00006441cfa84319 in __sgr_dup (sgent=0x1000) at sgroupio.c:36
#1  0x00006441cfa85c29 in commonio_open (db=db@entry=0x6441cfa92ca0 <gshadow_db>, mode=2, mode@entry=66)
    at commonio.c:694
#2  0x00006441cfa846ce in sgr_open (mode=mode@entry=66) at sgroupio.c:246
#3  0x00006441cfa7856e in open_group_files () at useradd.c:1856
#4  0x00006441cfa790fd in get_groups (list=0x7ffff616ef6d "users") at useradd.c:766
#5  process_flags (argc=argc@entry=5, argv=argv@entry=0x7ffff616ddb8) at useradd.c:1354
#6  0x00006441cfa73e46 in main (argc=5, argv=0x7ffff616ddb8) at useradd.c:2499
(gdb) p *sgent
Cannot access memory at address 0x1000
Help regarding some kind of workaround to get shadow working again would be highly appreciated. I am stuck in the water right now, until this is fixed.
Last edited by kaizushi on Wed Jan 18, 2023 7:54 am, edited 1 time in total.
I cook a delicious onion stew without any chili peppers.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Wed Jan 18, 2023 7:19 am

if you can simply just "useradd -m test1298" -- you can add the user into the groups you want manually after the fact?
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
kaizushi
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 77
Joined: Sat Sep 22, 2018 1:44 pm

  • Quote

Post by kaizushi » Wed Jan 18, 2023 7:46 am

eccerr0r wrote:if you can simply just "useradd -m test1298" -- you can add the user into the groups you want manually after the fact?
This also segfaults, here it is under gdb, it is the same issue as above...

Code: Select all

Starting program: /usr/sbin/useradd -m test1298
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00006544e8eb9319 in __sgr_dup (sgent=0x1000) at sgroupio.c:36
36      sgroupio.c: No such file or directory.
(gdb) bt
#0  0x00006544e8eb9319 in __sgr_dup (sgent=0x1000) at sgroupio.c:36
#1  0x00006544e8ebac29 in commonio_open (db=db@entry=0x6544e8ec7ca0 <gshadow_db>, mode=2, mode@entry=66)
    at commonio.c:694
#2  0x00006544e8eb96ce in sgr_open (mode=mode@entry=66) at sgroupio.c:246
#3  0x00006544e8ead56e in open_group_files () at useradd.c:1856
#4  0x00006544e8ea90df in open_files () at useradd.c:1797
#5  main (argc=<optimized out>, argv=<optimized out>) at useradd.c:2613
(gdb) p *sgent
Cannot access memory at address 0x1000
I cook a delicious onion stew without any chili peppers.
Top
kaizushi
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 77
Joined: Sat Sep 22, 2018 1:44 pm

  • Quote

Post by kaizushi » Wed Jan 18, 2023 7:54 am

The good news is I just found a workaround, and I can use 'useradd' again after downgrading the shadow package to version sys-apps/shadow-4.12.3. I would have tried it sooner but I wanted a backup of my system, as downgrading things for me has gone wrong many times.

I would call this solved, as far as finding a workaround is concerned.
I cook a delicious onion stew without any chili peppers.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Wed Jan 18, 2023 9:35 pm

Interesting. Yeah still needs to be fixed, I'm still at shadow 4.12.3 hence don't see this issue.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
Duncan Mac Leod
Guru
Guru
User avatar
Posts: 321
Joined: Sun May 02, 2004 10:35 pm
Location: Germany

  • Quote

Post by Duncan Mac Leod » Sun Jan 22, 2023 11:13 pm

eccerr0r wrote:Interesting. Yeah still needs to be fixed, I'm still at shadow 4.12.3 hence don't see this issue.
Hope the devs are keeping 4.12.3 in portage tree until this is fixed?
Top
pjp
Administrator
Administrator
User avatar
Posts: 20668
Joined: Tue Apr 16, 2002 10:35 pm

  • Quote

Post by pjp » Tue Jan 31, 2023 10:48 pm

As i had already upgraded to sys-apps/shadow-4.13-r1 I've been keeping an eye on this. I don't see any responses in the bug report.

I tried the referenced usreadd command and it worked without errors.
Quis separabit? Quo animo?
Top
kaizushi
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 77
Joined: Sat Sep 22, 2018 1:44 pm

  • Quote

Post by kaizushi » Tue Feb 21, 2023 6:05 pm

It has been released in the bug ticket I opened on the Github that this bug occurs when there are really long lines in /etc/group, /etc/shadow, etc. This is why it happens for some and not others. The system where I was having this issue is a shared webserver and the line for group users is very long.
I cook a delicious onion stew without any chili peppers.
Top
eccerr0r
Watchman
Watchman
Posts: 10239
Joined: Thu Jul 01, 2004 6:51 pm
Location: almost Mile High in the USA
Contact:
Contact eccerr0r
Website

  • Quote

Post by eccerr0r » Tue Feb 21, 2023 8:20 pm

Thanks for following up on this. Yeah it would be hard for me to reproduce, my group file lines are quite short.
Intel Core i7 2700K/Radeon Firepro W2100/24GB DDR3/800GB SSD
What am I supposed watching?
Top
sam_
Developer
Developer
User avatar
Posts: 2817
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Wed Feb 22, 2023 7:03 am

I've been watching the libc-alpha thread and the github bug, but Hanno's filed a bug on the Gentoo side at bug 895784. We'll backport the fix once it's committed.
Top
kaizushi
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 77
Joined: Sat Sep 22, 2018 1:44 pm

  • Quote

Post by kaizushi » Tue Feb 28, 2023 1:31 pm

Can someone tell me how I can track this bug and the availability of the fix into Gentoo? This is very new territory for me.
I cook a delicious onion stew without any chili peppers.
Top
sam_
Developer
Developer
User avatar
Posts: 2817
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Tue Feb 28, 2023 8:41 pm

kaizushi wrote:Can someone tell me how I can track this bug and the availability of the fix into Gentoo? This is very new territory for me.
Add yourself to the CC list on the Gentoo bug I mentioned in the post above yours.
Top
Post Reply

12 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic