diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2012-05-19 04:13:47 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2012-05-19 04:13:47 -0700 |
commit | 250c40799dd5e3bf1d7ebead8ddd894b8cb8c528 (patch) | |
tree | 56918b16149b44407b1804d2073291ac95245da9 /src/sim | |
parent | 8fe8efeb34ae33e36bff77c4eb42d1ebfa95a7e8 (diff) | |
download | gem5-250c40799dd5e3bf1d7ebead8ddd894b8cb8c528.tar.xz |
Syscalls: warn when the length argument to mmap is excessive.
If the length argument to mmap is larger than the arbitrary but reasonable
limit of 4GB, there's a good chance that the value is nonsense and not
intentional. Rather than attempting to satisfy the mmap anyway, this change
makes gem5 warn to make it more apparent what's going wrong.
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/syscall_emul.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 504add35f..87899abca 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -1004,6 +1004,9 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) int tgt_fd = p->getSyscallArg(tc, index); // int offset = p->getSyscallArg(tc, index); + if (length > 0x100000000ULL) + warn("mmap length argument %#x is unreasonably large.\n", length); + if (!(flags & OS::TGT_MAP_ANONYMOUS)) { Process::FdMap *fd_map = p->sim_fd_obj(tgt_fd); if (!fd_map || fd_map->fd < 0) { |