From 259a5d62724fd59519b73ca4f9f86199685db666 Mon Sep 17 00:00:00 2001 From: Nicholas Mosier Date: Thu, 7 Sep 2023 10:52:47 -0700 Subject: [PATCH] sim-se: Use tgt_stat64 instead of tgt_stat in newfstatatFunc The syscall emulation of newfstatat incorrectly treated the output stat buffer to be of type `OS::tgt_stat`, not `OS::tgt_stat64`, causing the invalid output stat buffer in the application to hold invalid data. This patch fixes the bug by simply substituting the type `OS::tgt_stat` with `OS::tgt_stat64` in `newstatatFunc()`. GitHub issue: https://github.com/gem5/gem5/issues/281 Change-Id: Ice97c1fc4cccbfb6824e313ebecde00f134ebf9c --- src/sim/syscall_emul.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index b4550dd86b..1ae1603d77 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1375,7 +1375,7 @@ statFunc(SyscallDesc *desc, ThreadContext *tc, template SyscallReturn newfstatatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, - VPtr<> pathname, VPtr tgt_stat, + VPtr<> pathname, VPtr tgt_stat, int flags) { std::string path; @@ -1405,7 +1405,7 @@ newfstatatFunc(SyscallDesc *desc, ThreadContext *tc, int dirfd, if (result < 0) return -errno; - copyOutStatBuf(tgt_stat, &host_buf); + copyOutStat64Buf(tgt_stat, &host_buf); return 0; }