Package: psmisc
Version: 23.2-1
Severity: serious

killall fails to kill processes with names longer than 15
characters.

According to the manpage:

  -e, --exact
         Require an exact match for very long names.  If a command
         name is longer than 15 characters, the full name may be
         unavailable (i.e.  it is swapped  out). In  this case,
         killall will kill everything that matches within the first
         15 characters.  With -e, such entries are skipped.  [...]

So without "-e" it should kill everything that matches within the
first 15 characters.

That was apparently the behaviour in previous versions, but that's
broken now. To reproduce:

(echo "#!/bin/sh"; echo "while true; do sleep 1; echo 'Still running!'; done") 
> killall-bug-with-long-names-demo
chmod 755 killall-bug-with-long-names-demo
./killall-bug-with-long-names-demo &
killall killall-bug-with-long-names-demo

I think that's at least "serious", because it makes killall by name
basically unusable, at least in automated contexts, unless you want
to replace:

  killall "$x"

everywhere with some beast such as (untested):

  killall "$(echo "$x" | cut -c-15)"

It could even have more adverse consequences if you rely on a script
killing some process with killall, which has worked before and
breaks now, especially if this process continues to waste resources
or give access to privileges you meant to stop etc. (That's almost
what happened to me when I found the problem, though in my case the
worst thing it caused, fortunately, was blocking a network port.)

In the worst case, this could be security-critical. (Not sure if
this justifies "grave"!?)

Sure, you may say one should check the status of each command,
including killall, but that's hard to do when the status is the
same (1) as in the case when the program isn't running at all, so
one would have to check with something like pidof before (which does
still find long program names), worry about race-conditions etc.

-- System Information:
Debian Release: 10.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 
'proposed-updates-debug'), (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.14.0-0.bpo.3-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1), LANGUAGE=de_DE 
(charmap=ISO-8859-1)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages psmisc depends on:
ii  libc6        2.28-10
ii  libselinux1  2.8-1+b1
ii  libtinfo6    6.1+20181013-2+deb10u2

psmisc recommends no packages.

psmisc suggests no packages.

-- debconf-show failed

Reply via email to