chsh.ldap in nslcd-utils crashes with segfault

Bug #1849052 reported by Tatsunori Uchino
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nss-pam-ldapd (Ubuntu)
New
Undecided
Unassigned

Bug Description

```
$ chsh.ldap -s $(which fish)
Segmentation fault (core dumped)
$ uname -r
4.15.0-50-generic
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionicUBUNTU_CODENAME=bionic
$ apt list --upgradable
Listing... Done
$ chsh.ldap --version
nss-pam-ldapd 0.9.9
Written by Arthur de Jong.

Copyright (C) 2013-2017 Arthur de Jong
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Debian bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908319

```
$ LANG=C gdb -args $(which python) $(which chsh.ldap) -s $(which fish)
GNU gdb (Ubuntu 8.2-0ubuntu1~18.04) 8.2
Copyright (C) 2018 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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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 /usr/bin/python...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/python /usr/bin/chsh.ldap -s /usr/bin/fish
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after fork from child process 48187]

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:93
93 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:93
#1 0x0000555555621cf4 in PyString_FromString ()
#2 0x000055555565e399 in ?? ()
#3 0x00005555555a70d2 in _PyObject_GenericGetAttrWithDict ()
#4 0x00005555556497e0 in PyEval_EvalFrameEx ()
#5 0x0000555555661f68 in ?? ()
#6 0x00005555556eca2d in _PySequence_IterSearch ()
#7 0x0000555555650b9c in PyEval_EvalFrameEx ()
#8 0x0000555555646d3a in PyEval_EvalCodeEx ()
#9 0x000055555564e83e in PyEval_EvalFrameEx ()
#10 0x0000555555646d3a in PyEval_EvalCodeEx ()
#11 0x00005555556467b9 in PyEval_EvalCode ()
#12 0x00005555556774df in ?? ()
#13 0x00005555556722d2 in PyRun_FileExFlags ()
#14 0x000055555567174d in PyRun_SimpleFileExFlags ()
#15 0x0000555555620de4 in Py_Main ()
#16 0x00007ffff7a05b97 in __libc_start_main (main=0x555555620780 <main>, argc=4,
    argv=0x7fffffffe488, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fffffffe478) at ../csu/libc-start.c:310
#17 0x000055555562069a in _start ()
$
```

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: nslcd-utils 0.9.9-1
ProcVersionSignature: Ubuntu 4.15.0-50.54-generic 4.15.18
Uname: Linux 4.15.0-50-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
Date: Mon Oct 21 13:50:06 2019
InstallationDate: Installed on 2016-08-11 (1165 days ago)
InstallationMedia: Ubuntu-Server 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.3)
PackageArchitecture: all
ProcEnviron:
 TERM=screen-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=C
 SHELL=/bin/bash
SourcePackage: nss-pam-ldapd
UpgradeStatus: Upgraded to bionic on 2018-11-17 (337 days ago)

Revision history for this message
Tatsunori Uchino (tats-u) wrote :
description: updated
description: updated
Revision history for this message
Tatsunori Uchino (tats-u) wrote :

Line #33 in `/usr/share/nslcd-utils/shells.py` causes the problem.

ctypes.c_char_p(libc.getusershell()) -> OK
ctypes.c_char_p(libc.getusershell()).value -> SEGFAULT!

Revision history for this message
Tatsunori Uchino (tats-u) wrote :
Revision history for this message
Tatsunori Uchino (tats-u) wrote :

git clone https://github.com/arthurdejong/nss-pam-ldapd.git
cd nss-pam-ldapd
git diff bfe06969aeef0c9ef419ea6e5bf930962ed08b96 bfcf0025b6ba264e6c0c1899d9de2bad8f39ee1a -- utils/shells.py

Revision history for this message
Tatsunori Uchino (tats-u) wrote :

This bug is going to affect in Eoan because it was fixed at just 1.9.11 but 1.9.10 is included to Eoan now.
https://packages.ubuntu.com/eoan/nslcd-utils

Why no one replies?

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "shells.py.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.