From nobody Mon Sep 28 02:05:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1785358771; cv=none; d=zohomail.com; s=zohoarc; b=hBrwX1jxDeD9o0pgfm5PWVROK49zEDFNWbrN5DzMrsws14BOX+y94qSfE3GQ5wNAXsxa1ceMXWtMW8yAGKImVWZxwT8j3p/11c+00liqXxv7+nM9Ujc3M0Y2QbjmeoI/np7PIgZMJaHQf2DC7KOXAG9h0nMvJtVvyhMhSR9YXT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785358771; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BEFr1h/VsNDeqpel0U40OJaN6BsW/FCmAU4aUz8uGAI=; b=IJR4+jIeX4Wrw0Wcz8Y/t0zuU7YrEjDdskb93PfkD+RyyiPUhWfgADByXXJcWsSpz0p1tTZNNO6g0HDC0R90atF1GV64hfX9GnVIiP+e45C2wXUtZbt/d+scU70/2cJSTO+wWy2zeUJRB8eguSZW7UfIjN5/PXXh7fXvJQ3On2Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785358771690351.29812135817053; Wed, 29 Jul 2026 13:59:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpBMt-0002cx-0h; Wed, 29 Jul 2026 16:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMs-0002cb-1T for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:10 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMq-0003jf-8C for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:09 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id DA38E41337; Wed, 29 Jul 2026 20:59:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A50AC1F000E9; Wed, 29 Jul 2026 20:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785358746; bh=BEFr1h/VsNDeqpel0U40OJaN6BsW/FCmAU4aUz8uGAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Kcvou41bIbQDHBrMc4J5TjpNv9aTQ8CwZHqAqfFZ+Mwx4HiTuwX8tvP2I1GplU7WT KaT+rYUAh7TE9fBSIVfsEFAln0SEECHFP4CMZe6rlQwavcRrqNpLk03D8MuNDZI5pm PVywPjdpv/7D+eRAeqZ/ImluRo15t85GTS53wozhamEm5Nhl1k/1ugm7/uzHucUkMn GeE5cDLWSHUtdWDWAIcjXMPTqHYSR+L1NwCR7Yyzb0I3XxnkkR9G2yYQaHvMuhruac BOQgKv03ohMPf8jhNLXw4QydvOBjWToy+PvhWJg4tBv4uGMhDDuHrrRHBIoTmwBl3i 7gIZWUVYQc5YQ== From: Helge Deller To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Helge Deller , Pierrick Bouvier , Laurent Vivier Subject: [PULL 1/3] linux-user: Fix msqid_ds struct wrt 32-bit big endian architectures Date: Wed, 29 Jul 2026 22:59:00 +0200 Message-ID: <20260729205902.3767-2-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260729205902.3767-1-deller@kernel.org> References: <20260729205902.3767-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.58, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1785358773712158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller Make sure that the time entries (msg_stime, msg_rtime and msg_ctime) are defined as 64-bit time_t values, since the userspace may access the whole 64-bit value. By this change we fix the word ordering for 32-bit big endian architectures as well. This fixes the msgctl01 LTP testcase on hppa32. Cc: qemu-stable@nongnu.org Signed-off-by: Helge Deller --- linux-user/syscall.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 740142825d..c93b770ced 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4216,21 +4216,15 @@ static inline abi_long do_semtimedop(int semid, } #endif =20 +#define target_time64_t abi_ullong +#define target_swap_time64(x) tswap64(x) + struct target_msqid_ds { struct target_ipc_perm msg_perm; - abi_ulong msg_stime; -#if TARGET_ABI_BITS =3D=3D 32 - abi_ulong __unused1; -#endif - abi_ulong msg_rtime; -#if TARGET_ABI_BITS =3D=3D 32 - abi_ulong __unused2; -#endif - abi_ulong msg_ctime; -#if TARGET_ABI_BITS =3D=3D 32 - abi_ulong __unused3; -#endif + target_time64_t msg_stime; + target_time64_t msg_rtime; + target_time64_t msg_ctime; abi_ulong __msg_cbytes; abi_ulong msg_qnum; abi_ulong msg_qbytes; @@ -4249,9 +4243,9 @@ static inline abi_long target_to_host_msqid_ds(struct= msqid_ds *host_md, return -TARGET_EFAULT; if (target_to_host_ipc_perm(&(host_md->msg_perm),target_addr)) return -TARGET_EFAULT; - host_md->msg_stime =3D tswapal(target_md->msg_stime); - host_md->msg_rtime =3D tswapal(target_md->msg_rtime); - host_md->msg_ctime =3D tswapal(target_md->msg_ctime); + host_md->msg_stime =3D target_swap_time64(target_md->msg_stime); + host_md->msg_rtime =3D target_swap_time64(target_md->msg_rtime); + host_md->msg_ctime =3D target_swap_time64(target_md->msg_ctime); host_md->__msg_cbytes =3D tswapal(target_md->__msg_cbytes); host_md->msg_qnum =3D tswapal(target_md->msg_qnum); host_md->msg_qbytes =3D tswapal(target_md->msg_qbytes); @@ -4270,9 +4264,9 @@ static inline abi_long host_to_target_msqid_ds(abi_ul= ong target_addr, return -TARGET_EFAULT; if (host_to_target_ipc_perm(target_addr,&(host_md->msg_perm))) return -TARGET_EFAULT; - target_md->msg_stime =3D tswapal(host_md->msg_stime); - target_md->msg_rtime =3D tswapal(host_md->msg_rtime); - target_md->msg_ctime =3D tswapal(host_md->msg_ctime); + target_md->msg_stime =3D target_swap_time64(host_md->msg_stime); + target_md->msg_rtime =3D target_swap_time64(host_md->msg_rtime); + target_md->msg_ctime =3D target_swap_time64(host_md->msg_ctime); target_md->__msg_cbytes =3D tswapal(host_md->__msg_cbytes); target_md->msg_qnum =3D tswapal(host_md->msg_qnum); target_md->msg_qbytes =3D tswapal(host_md->msg_qbytes); --=20 2.54.0 From nobody Mon Sep 28 02:05:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1785358774; cv=none; d=zohomail.com; s=zohoarc; b=XUFGRmtCDoBItxUCW8P4kk6FV8BpW5b0uS+9COp1whtLPjEfi7GqW0UqShwWB7bbDwNz19hC+wQe2duFoT/O1eTzWrUaYeBPglXrOHcAs2/VWoUd0UONPw7yf9NYMKe4vHEkSJxCYlyoBQL+LkoFUmhkRc2MdUFPWp0a5Uqu0Lk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785358774; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D+7TI/A5weC4o5qGGiEE6Wy+v675CcpJHfbuWtjckgE=; b=j6qHCcUD7IH6FxM/3TSEjy/+25vz+LeLf6M+ut3T3w+ZcOo8B0kv8SMxZWsVjGCoDC6c/yMnCvZXi/2Hs/m63qcJg3EaRFU2t3NRHhENv+M5t0Uj1zfoNBjjYQ+cT2b/hhjBd5HtGGRThNPfO1cYMjtITIY14GuOjthTsuEHZdk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785358774324592.3848867522476; Wed, 29 Jul 2026 13:59:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpBMw-0002eT-Hk; Wed, 29 Jul 2026 16:59:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMt-0002d0-BV for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:11 -0400 Received: from sea.source.kernel.org ([172.234.252.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMr-0003jx-Kh for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:11 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8E64843AA0; Wed, 29 Jul 2026 20:59:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 311291F000E9; Wed, 29 Jul 2026 20:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785358748; bh=D+7TI/A5weC4o5qGGiEE6Wy+v675CcpJHfbuWtjckgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Z9fCISCOL38OV+P0l0WsDsglWITnLzE2Q9ob9K5BJe5EciEPtIfjDJSiUKNrOVotQ nBR6H+yBl4wKK0JUt5I08H2FbRoIs1I9/KoGdMoLMbjH2HbyCkxCWI/2iTXoRGyafF mpyreMOU8HcRyDlaKkjC1DJnulYaL3IitOuDWykugY7sEUl5JztC4dfrM7698r6H+M BDLWcuNzl6FKYefUUlfzk1VpdbdV4FdWiQcb16rZwqSOuc+U5svkeFo7k+94nTRZN0 jweiZN+xksQCqa4AJYmWYZPIxqtpe3B9wOzUd9nH3rUmP9tMkhm31JNByI2yI417D9 rId5972KS8Kaw== From: Helge Deller To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Helge Deller , Pierrick Bouvier , Laurent Vivier , no92 Subject: [PULL 2/3] linux-user: fix incorrect msg_l[sr]pid members of target_msqid_ds Date: Wed, 29 Jul 2026 22:59:01 +0200 Message-ID: <20260729205902.3767-3-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260729205902.3767-1-deller@kernel.org> References: <20260729205902.3767-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.234.252.31; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.58, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1785358775130158500 Content-Type: text/plain; charset="utf-8" From: no92 The members are declared as __kernel_pid_t in Linux UAPI headers. Analogous members in struct target_shmid_ds (shm_[cl]pid) are also declared as abi_int. Cc: qemu-stable@nongnu.org Fixes: 1c54ff97bbde ("linux-user: fix and cleanup IPCOP_msg* ipc calls hand= ling") Signed-off-by: no92 Reviewed-by: Pierrick Bouvier Signed-off-by: Helge Deller --- linux-user/syscall.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c93b770ced..547784d971 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4228,8 +4228,8 @@ struct target_msqid_ds abi_ulong __msg_cbytes; abi_ulong msg_qnum; abi_ulong msg_qbytes; - abi_ulong msg_lspid; - abi_ulong msg_lrpid; + abi_int msg_lspid; + abi_int msg_lrpid; abi_ulong __unused4; abi_ulong __unused5; }; @@ -4249,8 +4249,8 @@ static inline abi_long target_to_host_msqid_ds(struct= msqid_ds *host_md, host_md->__msg_cbytes =3D tswapal(target_md->__msg_cbytes); host_md->msg_qnum =3D tswapal(target_md->msg_qnum); host_md->msg_qbytes =3D tswapal(target_md->msg_qbytes); - host_md->msg_lspid =3D tswapal(target_md->msg_lspid); - host_md->msg_lrpid =3D tswapal(target_md->msg_lrpid); + host_md->msg_lspid =3D tswap32(target_md->msg_lspid); + host_md->msg_lrpid =3D tswap32(target_md->msg_lrpid); unlock_user_struct(target_md, target_addr, 0); return 0; } @@ -4270,8 +4270,8 @@ static inline abi_long host_to_target_msqid_ds(abi_ul= ong target_addr, target_md->__msg_cbytes =3D tswapal(host_md->__msg_cbytes); target_md->msg_qnum =3D tswapal(host_md->msg_qnum); target_md->msg_qbytes =3D tswapal(host_md->msg_qbytes); - target_md->msg_lspid =3D tswapal(host_md->msg_lspid); - target_md->msg_lrpid =3D tswapal(host_md->msg_lrpid); + target_md->msg_lspid =3D tswap32(host_md->msg_lspid); + target_md->msg_lrpid =3D tswap32(host_md->msg_lrpid); unlock_user_struct(target_md, target_addr, 1); return 0; } --=20 2.54.0 From nobody Mon Sep 28 02:05:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1785358779; cv=none; d=zohomail.com; s=zohoarc; b=RV9xfwYbSDzHy1zuuzqgVvLVDRRQzdU7G1rcS7r2hPLiIkn+cZUp4cX/SrrY+1uWT0sR3cmN8kuoEB5mU8k9klYcip2NT11gQxboV2c9WNFew377MRWPCuMraruHGspBmc2ik0mgq0T8UEbqfKVoabQ4U/09j22GepwmYZULU98= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785358779; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pQx5YbcditN3B7gV622IuItDzYq/EcAseJ4AJoGmdfw=; b=Q5cosd2Bd8ByNSwDrVY6wsRyVVUaSMf1OZ/XNQPvKEI/UY3E1caDgyMy6zbkfDEdWT8NVX3hpi3NmJxMPyYbgbmaInZVE/7jcAdoJkY3LTPEJZSMrfA88pLkY4JLdjUdDavQQYz3eKYA7nZ48SxjuZzzFqka3uSlg/K5x/2XKFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785358779638173.00390065933004; Wed, 29 Jul 2026 13:59:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpBMv-0002eB-Ne; Wed, 29 Jul 2026 16:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMu-0002dz-Mn for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:12 -0400 Received: from tor.source.kernel.org ([172.105.4.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpBMt-0003kP-6U for qemu-devel@nongnu.org; Wed, 29 Jul 2026 16:59:12 -0400 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 6F6806004E; Wed, 29 Jul 2026 20:59:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9CFF1F000E9; Wed, 29 Jul 2026 20:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785358750; bh=pQx5YbcditN3B7gV622IuItDzYq/EcAseJ4AJoGmdfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MoAUAWyu4/JqThZgQstUPx26alNES4xuYDFZJt+YZ/ZsTwrNwdy8oSe36VSXjVA6A S07uWRI4TkMA1zjMm0BOuNBw1QA1u/8lUnr3/zM2uSq8dgUMvlyhVvrMA/PUH9/ETj U//HDsimTIAMef94Qhx2ac2YzjwXDedkhBUnH4DUzC47q1Hbm0pbevcocFH6t3l8ee 8qX6KMZZlO/RnWMP9dM6MkXQpIKjhAD7UIYL0UYnwwi1tQmK1FOJj5b3sikSkSIrz7 NoPeiaPQP7f5/zk+/g57EsVzHrW5Bus6YEE1370DK6ll48sEEFWYeLfOGdKb5Oqcv5 yI1wAoIguULsg== From: Helge Deller To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: Helge Deller , Pierrick Bouvier , Laurent Vivier , Richard Henderson Subject: [PULL 3/3] linux-user/aarch64: Fix SHADOW_STACK_SET_TOKEN Date: Wed, 29 Jul 2026 22:59:02 +0200 Message-ID: <20260729205902.3767-4-deller@kernel.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260729205902.3767-1-deller@kernel.org> References: <20260729205902.3767-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=172.105.4.254; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -36 X-Spam_score: -3.7 X-Spam_bar: --- X-Spam_report: (-3.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.58, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1785358781235158501 Content-Type: text/plain; charset="utf-8" From: Richard Henderson The token is not computed via TARGET_PAGE_SIZE, but via a fixed 12-bit fiel= d. Cc: qemu-stable@nongnu.org Fixes: ad1afe433fa ("linux-user/aarch64: Implement map_shadow_stack syscall= ") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4106 Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Signed-off-by: Helge Deller --- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 547784d971..dc028686f4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6900,7 +6900,8 @@ static abi_long do_map_shadow_stack(CPUArchState *env= , abi_ulong addr, /* Leave an extra empty frame at top-of-stack. */ cap_ptr -=3D 8; } - cap_val =3D (cap_ptr & TARGET_PAGE_MASK) | 1; + /* Note the 12 bit field is unaffected by current page size. */ + cap_val =3D deposit64(cap_ptr, 0, 12, 1); if (put_user_u64(cap_val, cap_ptr)) { /* Allocation succeeded above. */ g_assert_not_reached(); --=20 2.54.0