mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-07 12:44:45 +00:00
Detect and reject misaligned args for mmap. This makes
none/tests/map_unaligned work. The PRE handlers for sys_mmap and sys_old_mmap are more convoluted than I would like, and might benefit from a rewrite. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3284
This commit is contained in:
parent
46bc07d683
commit
6ddcb7dc7d
@ -4054,6 +4054,12 @@ PRE(old_mmap, Special)
|
||||
return;
|
||||
}
|
||||
|
||||
if (/*(a4 & VKI_MAP_FIXED) &&*/ (0 != (a1 & (VKI_PAGE_SIZE-1)))) {
|
||||
/* zap any misaligned addresses. */
|
||||
SET_RESULT( -VKI_EINVAL );
|
||||
return;
|
||||
}
|
||||
|
||||
if (a4 & VKI_MAP_FIXED) {
|
||||
if (!VG_(valid_client_addr)(a1, a2, tid, "old_mmap")) {
|
||||
PRINT("old_mmap failing: %p-%p\n", a1, a1+a2);
|
||||
@ -4098,6 +4104,12 @@ PRE(sys_mmap2, 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (/*(ARG4 & VKI_MAP_FIXED) && */ (0 != (ARG1 & (VKI_PAGE_SIZE-1)))) {
|
||||
/* zap any misaligned addresses. */
|
||||
SET_RESULT( -VKI_EINVAL );
|
||||
return;
|
||||
}
|
||||
|
||||
if (ARG4 & VKI_MAP_FIXED) {
|
||||
if (!VG_(valid_client_addr)(ARG1, ARG2, tid, "mmap2"))
|
||||
SET_RESULT( -VKI_ENOMEM );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user