Bug 1952749

Summary: different behavior when use ulimit to limit the coredump size.
Product: Red Hat Enterprise Linux 7 Reporter: Anthony <yuli>
Component: abrtAssignee: Michal Srb <msrb>
Status: CLOSED NOTABUG QA Contact: CS System Management SST QE <rhel-cs-system-management-subsystem-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.9CC: msrb, ovasik
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-06-30 07:54:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anthony 2021-04-23 03:33:52 UTC
Description of problem:
When I use ‘ulimit -c 0’ under user session, in RHEL8, this will prevent the generation of coredump, but in RHEL7, coredump can still be generated normally, this setting does not seem to take effect.


Test conducted in RHEL7:

1. View the configuration file
# grep core /etc/security/limits.conf | grep -v "#"
* soft core 0
* hard core 0

2. Confirm the current status
# ulimit -c
0

3. Process crashes
# sleep 56789 &
[1] 2849
# kill -s SIGSEGV 2849

4. The result is that a coredump can be generated
# grep core ccpp-2021-04-13-15\:30\:01-2849/limits 
Max core file size        0                    0                    bytes  

# ll ccpp-2021-04-13-15\:30\:01-2849/coredump 
-rw-r-----. 1 root abrt 385024 Apr 13 15:30 ccpp-2021-04-13-15:30:01-2849/coredump

5.From messages
~~~
Apr 13 15:30:01 localhost abrt-hook-ccpp: Process 2849 (sleep) of user 0 killed by SIGSEGV - dumping core
Apr 13 15:31:12 localhost abrt-server: Generating core_backtrace
~~~


Test conducted in RHEL8:

1. View the configuration file
# grep core /etc/security/limits.conf | grep -v "#"
*      soft    core    0
*      hard    core    0

2. Confirm the current status
# ulimit -c
0

3. Process crashes
# sleep 999999 &
[1] 2931
# kill -s SIGSEGV 2931

4. The result is that no coredump can be generated

5.From messages
~~~
Apr 13 14:51:44 localhost systemd[1]: Started Process Core Dump (PID 2932/UID 0).
Apr 13 14:51:44 localhost systemd-coredump[2933]: Resource limits disable core dumping for process 2931 (sleep).
Apr 13 14:51:44 localhost systemd-coredump[2933]: Process 2931 (sleep) of user 0 dumped core.
Apr 13 14:51:44 localhost systemd[1]: systemd-coredump: Succeeded.
Apr 13 14:51:44 localhost abrt-dump-journal-core[967]: Failed to obtain all required information from journald
Apr 13 14:51:44 localhost abrt-dump-journal-core[967]: Failed to save detect problem data in abrt database
~~~


Actual results:
In RHEL8, under user session, ulimit can affect coredump generation.
but in RHEL7, it doesn't work.


Expected results:
Want to know why ulimit behaves differently on RHEL7 and RHEL8

Comment 2 Anthony 2021-05-06 00:30:57 UTC
Hi team, 

Is there any update? 

If we still need any information or testing, please let me know.



Best Regards
Yuliang Li