Bug#903540: skill/snice: does not match anything

2018-08-09 Thread Helmut Grohne
Hi Craig,

On Tue, Jul 17, 2018 at 09:49:15PM +1000, Craig Small wrote:
>   Thankyou for your bug report.  git bisect analysis shows that upstream
> commit 52673d2fc7e012f5134cdfafb6d319450b3a40a3 [1] is the cause of your
> problem as reported; or is for at least the -p option.

Thank you for performing the bisect!

> I must admit having an initial look at this commit, nothing stands out that
> says "this is a problem", but here we are. It will need some further
> checking to see why it is breaking skill.

If you ask me, something does stand out.

> https://gitlab.com/procps-ng/procps/commit/52673d2fc7e012f5134cdfafb6d319450b3a40a3

That thing is:

-if (read(fd, buf, 128) <= 0)
+if (len <= 0 || (size_t)len >= sizeof(buf))

The second condition (len >= sizeof(buf)) is new. So what actually is
sizeof(buf)? Well, 128. What are we reading from? Well, /proc/$pid/stat.
How big are such stat files in general? Well, let's ask wc -c
/proc/*/stat. The smallest file has 147 bytes here. But they can go well
beyond 300 bytes.

The buffer is simply too small.

Given that the thing you read is always big. I'm in favour of simply
reverting qualys' patch and replacing it with buf[min(127, len)] = '\0';

Helmut



Bug#903540: skill/snice: does not match anything

2018-07-17 Thread Craig Small
Hello Helmut,
  Thankyou for your bug report.  git bisect analysis shows that upstream
commit 52673d2fc7e012f5134cdfafb6d319450b3a40a3 [1] is the cause of your
problem as reported; or is for at least the -p option.
I must admit having an initial look at this commit, nothing stands out that
says "this is a problem", but here we are. It will need some further
checking to see why it is breaking skill.

 - Craig

1:
https://gitlab.com/procps-ng/procps/commit/52673d2fc7e012f5134cdfafb6d319450b3a40a3


On Wed, 11 Jul 2018 at 16:12 Helmut Grohne  wrote:

> Package: procps
> Version: 2:3.3.15-2
> Severity: important
>
> snice/skill don't seem to work at all here anymore. Dowgrading to
> 2:3.3.12-4 fixes the problems. Let me give some examples:
>
>  * Command: sh -c 'skill -p $$; echo still alive'
>Expected outcome: "Terminated"
>Actual outcome: "still alive"
>
>  * Command: sh -c 'snice +1 -v -c perl'
>Expected outcome: nicing the one perl process started on the other
>  terminal
>Actual outcome: no output, no effect
>
>  * Command: skill -v -u someuser (as root)
>Expected outcome: killing all processes of that user
>Actual outcome: no output, processes continue to live
>
> Helmut
>
-- 
Craig Small https://dropbear.xyz/ csmall at : dropbear.xyz
Debian GNU/Linuxhttps://www.debian.org/   csmall at : debian.org
Mastodon: @smalls...@social.dropbear.xyz Twitter: @smallsees
GPG fingerprint:  5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5


Bug#903540: skill/snice: does not match anything

2018-07-11 Thread Helmut Grohne
Package: procps
Version: 2:3.3.15-2
Severity: important

snice/skill don't seem to work at all here anymore. Dowgrading to
2:3.3.12-4 fixes the problems. Let me give some examples:

 * Command: sh -c 'skill -p $$; echo still alive'
   Expected outcome: "Terminated"
   Actual outcome: "still alive"

 * Command: sh -c 'snice +1 -v -c perl'
   Expected outcome: nicing the one perl process started on the other
 terminal
   Actual outcome: no output, no effect

 * Command: skill -v -u someuser (as root)
   Expected outcome: killing all processes of that user
   Actual outcome: no output, processes continue to live

Helmut