Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo does not honor user's default core file size limit #173

Closed
scottm1llj opened this issue Aug 22, 2022 · 3 comments
Closed

sudo does not honor user's default core file size limit #173

scottm1llj opened this issue Aug 22, 2022 · 3 comments

Comments

@scottm1llj
Copy link

Sudo used to honor all resource limits (as do su, login, ssh, etc). Starting with version 1.9.9, sudo began ignoring the user's core file size limit and just clobbering it with 0,0.

For example, consider a system where root's default hard limit for core file size is unlimited (e.g. having the following in /etc/security/limits.conf: root hard core unlimited).

Formerly, the following would give you the system default limit for that user:
$ sudo bash -c "ulimit -Hc"
unlimited

As of version 1.9.9 (e.g. the default in Ubuntu 22.04), we now get:
$ sudo bash -c "ulimit -Hc"
0

This behavior change has been traced to the following commit:

commit f279df5
Author: Todd C. Miller Todd.Miller@sudo.ws
Date: Mon Nov 8 17:46:19 2021 -0700

Add basic support for setting resource limits in sudoers.
The default for rlimit_core is "0,0"
Resource limits are passed back to the front-end in command_info[]
when set.

It is hard to believe that it should be considered correct behavior to ignore the system limits and clobber it with 0,0.

Currenly, I can no longer rely on sudo to run in an environment which picks up the default limits for the user. My only workaround is to use sudo in conjunction with su since su still establishes the correct default limits environment:

$ sudo su root bash -c "ulimit -Hc"
unlimited

@millert
Copy link
Collaborator

millert commented Aug 22, 2022

Core dumps are disabled by default to avoid exposing sensitive information. To restore the historic core dump file size behavior, a line like the following in sudoers may be used:

       Defaults rlimit_core=default

@scottm1llj
Copy link
Author

Thank you for your quick response. I can confirm that that works.

@scottm1llj
Copy link
Author

(I finally found the description of this behavior and remedy in the sudoers man page. I had read the man pages for sudo and sudo.conf, but not sudoers:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants