From 2cf1cb3363c9bdc03afbb3984279d324fe433e3c Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 10 Feb 2026 10:26:02 +0100 Subject: [PATCH] linux-user: properly check flags in openat2 target_to_host_bitmask truncates the bitmask to int. Check that the upper half of the flags do not have any bits set. Signed-off-by: Andreas Schwab Reviewed-by: Helge Deller Signed-off-by: Helge Deller --- linux-user/syscall.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 99e1ed97d9..064bc604c9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8831,6 +8831,10 @@ static int do_openat2(CPUArchState *cpu_env, abi_long dirfd, } return ret; } + if (tswap64(how.flags) >> 32) { + return -TARGET_EINVAL; + } + pathname = lock_user_string(guest_pathname); if (!pathname) { return -TARGET_EFAULT;