aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-02-26 15:58:52 -1000
committerRichard Henderson <richard.henderson@linaro.org>2024-02-29 08:47:55 -1000
commitf93b9953703be41408d5f0e09a871775d4be3c36 (patch)
treece42b10ae4743553eb12ac834d9bc4f1f7a76ba6
parentc0c6a0e3528b88aaad0b9d333e295707a195587b (diff)
downloadqemu-f93b9953703be41408d5f0e09a871775d4be3c36.zip
qemu-f93b9953703be41408d5f0e09a871775d4be3c36.tar.gz
qemu-f93b9953703be41408d5f0e09a871775d4be3c36.tar.bz2
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>
-rw-r--r--linux-user/elfload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index b8eef89..fb47fe3 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;
}