[Bug 1874824] Re: pgrep reports error "cannot allocate" when run without stack limit
William Wilson
1874824 at bugs.launchpad.net
Fri Apr 9 16:16:22 UTC 2021
The verification passed for focal:
jawn-smith at focal-vm:~$ apt-cache policy procps
procps:
Installed: 2:3.3.16-1ubuntu2
Candidate: 2:3.3.16-1ubuntu2.1
Version table:
2:3.3.16-1ubuntu2.1 500
500 http://us.archive.ubuntu.com/ubuntu focal-proposed/main amd64 Packages
*** 2:3.3.16-1ubuntu2 500
500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
100 /var/lib/dpkg/status
jawn-smith at focal-vm:~$ ulimit -S -s unlimited
jawn-smith at focal-vm:~$ pgrep bash
pgrep: cannot allocate 4611686018427387903 bytes
jawn-smith at focal-vm:~$ sudo apt install procps
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
procps
1 upgraded, 0 newly installed, 0 to remove and 64 not upgraded.
Need to get 233 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu focal-proposed/main amd64 procps amd64 2:3.3.16-1ubuntu2.1 [233 kB]
Fetched 233 kB in 0s (613 kB/s)
(Reading database ... 184500 files and directories currently installed.)
Preparing to unpack .../procps_2%3a3.3.16-1ubuntu2.1_amd64.deb ...
Unpacking procps (2:3.3.16-1ubuntu2.1) over (2:3.3.16-1ubuntu2) ...
Setting up procps (2:3.3.16-1ubuntu2.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.6) ...
jawn-smith at focal-vm:~$ ulimit -S -s unlimited
jawn-smith at focal-vm:~$ pgrep bash
1744
jawn-smith at focal-vm:~$
** Tags removed: verification-needed verification-needed-focal
** Tags added: verification-done verification-done-focal
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to procps in Ubuntu.
https://bugs.launchpad.net/bugs/1874824
Title:
pgrep reports error "cannot allocate" when run without stack limit
Status in procps package in Ubuntu:
Fix Released
Status in procps source package in Focal:
Fix Committed
Status in procps source package in Groovy:
Fix Committed
Status in procps source package in Hirsute:
Fix Released
Status in procps package in Debian:
New
Bug description:
[Impact]
- Users who have ulimit set high would see either slow
or failed pgrep and pkill commands
- Users who have ulimit set to unlimited would see
failed pgrep and pkill commands
- This bug occurs because the behavior of sysconf(_SC_ARG_MAX)
changed with a newer version of the kernel.
[Test Case]
- set the ulimit to unlimited by running `ulimit -S -s unlimited`
- run `pgrep bash` to see that the "cannot allocate" error is
printed and the command has failed.
[Where Problems Could Occur]
- We have set upper and lower limits on the size of the malloc, but
if further kernel versions break the call to sysconf in
unexpected ways we could still see problems.
[Original Description]
If you have no stack limit (ulimit -S -s unlimited), any pgrep call
will fail with an error:
> pgrep vim
pgrep: cannot allocate 4611686018427387903 bytes
If you have a high stack limit (e.g. ulimit -S -s 500000), pgrep is
very slow:
> time pgrep vim
2196
real 8.48s user 8.40s syst 0.07s busy 99% rmem 253444
The relevant upstream bug report could be: https://gitlab.com/procps-ng/procps/-/issues/152
Archlinux bug report: https://bugs.archlinux.org/task/66093
procps:
Installed: 2:3.3.16-1ubuntu2
500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1874824/+subscriptions
More information about the foundations-bugs
mailing list