[LTP] [PATCH v2] mseal02: Handle multiple errnos for 32-bit compat mode

Wei Gao via ltp
2026-02-26T02:26:03Z

In 32-bit compat mode, the overflow_size (calculated using a 32-bit ULONG_MAX)
does not cause a 64-bit integer wrap-around when added to the start address.
Consequently, the kernel see valid range that points to unmapped space, returning
ENOMEM instead of the expected EINVAL.

Signed-off-by: Wei Gao <wegao@suse.com>
---
testcases/kernel/syscalls/mseal/mseal02.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/syscalls/mseal/mseal02.c b/testcases/kernel/syscalls/mseal/mseal02.c
index e11d7dbf4..7e0172bc3 100644
--- a/testcases/kernel/syscalls/mseal/mseal02.c
+++ b/testcases/kernel/syscalls/mseal/mseal02.c
@@ -58,6 +58,9 @@ static void setup(void)
SAFE_MUNMAP(start_addr + twopages_size, page_size);
unallocated_start_addr = start_addr + twopages_size;
unallocated_end_addr = start_addr + page_size;
+
+ if (tst_is_compat_mode())
+ tcases[2].exp_err = ENOMEM;
}

static void cleanup(void)
--
2.52.0