diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2024-02-26 15:58:52 -1000 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2024-02-29 08:47:55 -1000 |
| commit | f93b9953703be41408d5f0e09a871775d4be3c36 (patch) | |
| tree | ce42b10ae4743553eb12ac834d9bc4f1f7a76ba6 /linux-user/elfload.c | |
| parent | c0c6a0e3528b88aaad0b9d333e295707a195587b (diff) | |
| download | focaccia-qemu-f93b9953703be41408d5f0e09a871775d4be3c36.tar.gz focaccia-qemu-f93b9953703be41408d5f0e09a871775d4be3c36.zip | |
linux-user/elfload: Disable core dump if getrlimit fails
Do not dump core at all if getrlimit fails; this ensures that dumpsize is valid throughout the function, not just for the initial test vs rlim_cur. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/elfload.c')
| -rw-r--r-- | linux-user/elfload.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index b8eef893d0..fb47fe39c9 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4673,7 +4673,7 @@ static int elf_core_dump(int signr, const CPUArchState *env) return 0; } - if (getrlimit(RLIMIT_CORE, &dumpsize) == 0 && dumpsize.rlim_cur == 0) { + if (getrlimit(RLIMIT_CORE, &dumpsize) < 0 || dumpsize.rlim_cur == 0) { return 0; } |