Bug 1090636 - pgrep -P 1 seg.faults in containers
pgrep -P 1 seg.faults in containers
Status: RESOLVED UPSTREAM
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Basesystem
Current
Other Other
: P1 - Urgent : Critical (vote)
: ---
Assigned To: Dr. Werner Fink
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-04-24 06:03 UTC by Thorsten Kukuk
Modified: 2018-04-24 06:19 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten Kukuk 2018-04-24 06:03:27 UTC
Start a opensuse/tumbleweed:latest container

Call "pgrep -P 1"

With procps 3.3.13, you get a seg.fault.
procps 3.3.12 did worked fine.

The problem is: opt_pattern is NULL, but in pgrep.c line 655, we use a strlen without checking if opt_pattern is NULL, this leads to a crash.

This blocks openSUSE Kubic, where we use pgrep in Containers.

I think this change is broken:
"grep: warn about 15+ char name only if -f not used"
Comment 1 Dr. Werner Fink 2018-04-24 06:19:45 UTC
(In reply to Thorsten Kukuk from comment #0)
> Start a opensuse/tumbleweed:latest container
> 
> Call "pgrep -P 1"
> 
> With procps 3.3.13, you get a seg.fault.
> procps 3.3.12 did worked fine.
> 
> The problem is: opt_pattern is NULL, but in pgrep.c line 655, we use a
> strlen without checking if opt_pattern is NULL, this leads to a crash.
> 
> This blocks openSUSE Kubic, where we use pgrep in Containers.
> 
> I think this change is broken:
> "grep: warn about 15+ char name only if -f not used"

This seems to be fixed with  procps-ng-3.3.14 ...

diff -up procps-ng-3.3.13 procps-ng-3.3.14/pgrep.c
--- procps-ng-3.3.13/pgrep.c    2018-03-03 08:11:55.682869561 +0100
+++ procps-ng-3.3.14/pgrep.c    2018-04-10 13:14:00.917682291 +0200
[...]
@@ -652,7 +652,7 @@ static struct el * select_procs (int *nu
        closeproc (ptp);
        *num = matches;
 
-       if ((!matches) && (!opt_full) && (strlen(opt_pattern) > 15))
+       if ((!matches) && (!opt_full) && opt_pattern && (strlen(opt_pattern) > 15))
                xwarnx(_("pattern that searches for process name longer than 15 characters will result in zero matches\n"
                                 "Try `%s -f' option to match against the complete command line."),
                                 program_invocation_short_name);



now there is a SR#600279