From nobody Mon May 25 13:47:55 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=1777323955; cv=none; d=zohomail.com; s=zohoarc; b=VBY+rtkL1vWlQbD4FNYWkmN/igP4Xupr5ViJWDQlu6JvBnE2JLdoV1guGxCQ20ST3kD6ASpwnv8hC3baICmdasicMW+MbgAI43gtw3Pp3wJt4eED+ksSG7RQzQyxkYAtoDzGKrx2SfO390kWR8bidOtu2nE0F0Klxxwkx2/Ob5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323955; h=Content-Type: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=Af6/i9fFoVcGBPy6MlyRLeOEh6EFPH/5LyhU9grLyd4=; b=gIc+b6ijA2dY91zE/f+n7GVUkeWuEhai+13rLeKPKi3YyiwGj/zpjlqYEv+T0GBem3ubMCIFsK1oCWNdncxChlYIHbR3TkI8jeoLUe0zEDBjAIAXNkf3xBS6wnYQpiNKF2o6Gt8ozWQGi7l0Q2fUQqeiitPh/svXgCfKvV31p38= 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 1777323955568313.56416541397164; Mon, 27 Apr 2026 14:05:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5V-0000CW-0i; Mon, 27 Apr 2026 17:01:53 -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 1wHT5M-0000Bk-7x for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:44 -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 1wHT5H-0003T9-IU for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:43 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id E57F460139; Mon, 27 Apr 2026 21:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FD34C2BCC6; Mon, 27 Apr 2026 21:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323698; bh=yYjMRoFt4jzIE4IARqI1Ple+n8OFUuRP8/w/Pzm2guw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fd4R3fKA+0DucIxQqghe5A4DYcHyfqz+Lxk/xMBwiUskYpOhM4pkkWII6BkdUgt8Z FenYdo3xaBa7WQz+BgkL9MM7dOGOiT+m5JGFlSJxWnr5OBPCFGULwu71ZzD0wBuqgF 7LyuTdxx08Hei93vMK2GRr5nRWSlRPr3/xlwGFrQ7SOrVkJwOsR6mVokizzWRlbNSI DNAi00Aahy5y5P8kq6+o/+sTv39fmKw8WU1aWU6BPBST8Ft9pJ7Q+9Jx6aHZrelndV GovVxrQBV4YRPOsNV/tV1APQz+Tr7lgC96fdnMxoDE6AAM0z+AcPD8NaSvViMGef8E T22YglktDg9pA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 01/15] MAINTAINERS: Add myself as maintainer for linux-user Date: Mon, 27 Apr 2026 23:01:19 +0200 Message-ID: <20260427210133.6016-2-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323957803154100 From: Helge Deller I'd like to step up as maintainer for linux-user. I'm actively using linux-user to emulate a HP-PARISC (hppa) linux environment on my debian buildd servers, so I'm very much interested that linux-user is running good and stable. Signed-off-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Laurent Vivier --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ad215eced8..e0f707a1ec 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4075,6 +4075,7 @@ T: git https://github.com/qemu-bsd-user/qemu-bsd-user= bsd-user-rebase-3.1 =20 Linux user M: Laurent Vivier +M: Helge Deller R: Pierrick Bouvier S: Odd Fixes F: linux-user/ --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323844; cv=none; d=zohomail.com; s=zohoarc; b=bXuMUhmu3372+o4r88tfBrWg0OACJNF4io4hg5AMeQaM9WGn6WkT9PyNKhaYXyVgh+FvVTQU2KSdxCkkCZFIYOAGvV5fJQ3E7/rhkbOSDRqM+r48CFL3/4z8hCU9Qu8LRi1e9K8VVnihC+JBJI73pE0EGdxiNks36y/2hek+TA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323844; 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=TCRW/JSOtOLWYOieOHflVXmryu23zYpYHlwvHWuGWmM=; b=nAUrC4Ew6D/wpo9Ql1wHm5u/k0cVTh+CHJzN/h5PUc+nmYh/JSLU3oEf4UPFrvJugN1spUSo1sZDmGzpdGNLQzOFL+BYDfXeA/y74jxityokamq8el2V0jd1VLFr1t5XDkNVhV6IaCETnXDuu4s540xe602mbAiYUAly1Te6Umc= 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 1777323844687138.29560275660162; Mon, 27 Apr 2026 14:04:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5X-0000JK-Pp; Mon, 27 Apr 2026 17:01:55 -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 1wHT5R-0000CU-4w for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:50 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5K-0003TU-P4 for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:44 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 9B744408CB; Mon, 27 Apr 2026 21:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16A97C2BCB5; Mon, 27 Apr 2026 21:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323700; bh=N0SltF6kWrhKYQvGQd+k67AMBYWPlgGMkWYMzuPa5JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJIV4Ohqm4oYfmdBPKEC9tENPUxqCv2ktdv0Ru3Z1LePrpdUimOIXfVItCi8fhDyF PCc5F1S+9jb36b8CWNZa/e2SRJdw14H896dBL3XVosdaKqd67TsyEQ7t208cG0iGVr 4V9zhff2iutsQvW4PNh6+aFc9YSkU4/SQZGThZNQuSowD/RsS1e6gxtFWuitOwzEwu +MK6ruPn4S1FjWb02GhARRaKTGfNX+d4pViXAtNlcgdZZHwu3pOnvbMNBWffoQAIKX jZ7md7ijioVz73RdX/6tLcjeFB+B5TRoLXvS+bOSV6vllARPGZsXo7/09kafu9MXiT y8bUpElIFZhHA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 02/15] linux-user/ppc: Fix ppc64 rt_sigframe stack offset Date: Mon, 27 Apr 2026 23:01:20 +0200 Message-ID: <20260427210133.6016-3-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323846693158500 Content-Type: text/plain; charset="utf-8" From: Matt Turner The kernel's 64-bit signal delivery (signal_64.c) uses: newsp =3D frame - __SIGNAL_FRAMESIZE while the 32-bit path (signal_32.c) uses: newsp =3D frame - (__SIGNAL_FRAMESIZE + 16) The extra 16 bytes in the 32-bit case is to place siginfo and ucontext at the same offsets as older kernels (see the comment in signal_32.c). The 64-bit rt_sigframe starts with ucontext directly and does not need this adjustment. QEMU's setup_rt_frame() unconditionally used (SIGNAL_FRAMESIZE + 16) for both 32-bit and 64-bit, placing the handler's SP 16 bytes too low on ppc64. Signal delivery and return still worked because do_rt_sigreturn had the matching wrong offset, but the vDSO DWARF unwind info encodes the correct kernel offset. This caused any DWARF unwinder (libunwind, libgcc, etc.) to compute a CFA that is 16 bytes off, reading garbage register values from the signal frame. Define RT_SIGFRAME_ADJUST (0 on ppc64, 16 on ppc32) and use it in both setup_rt_frame and do_rt_sigreturn to match the kernel. This was verified by A/B testing with libunwind's test suite: ppc64le: Gtest-bt, Ltest-bt, Gtest-concurrent, Ltest-concurrent, and Ltest-sig-context all change from FAIL to PASS. ppc64be: Gtest-bt, Ltest-bt, and Ltest-sig-context all change from FAIL to PASS. Signed-off-by: Matt Turner Reviewed-by: Peter Maydell Signed-off-by: Helge Deller Cc: qemu-stable@nongnu.org --- linux-user/ppc/signal.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index 24e5a02a78..a9c10e0987 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -210,6 +210,18 @@ QEMU_BUILD_BUG_ON(offsetof(struct target_rt_sigframe, = uc.tuc_mcontext) =20 #endif =20 +#ifdef TARGET_PPC64 +#define RT_SIGFRAME_ADJUST 0 +#else +/* + * For 32-bit rt sigframes we have an extra 16 bytes of gap + * on top of __SIGNAL_FRAMESIZE; this is to get the siginfo + * and ucontext in the same positions as in older kernels. + * See Linux's arch/powerpc/kernel/signal_32.c. + */ +#define RT_SIGFRAME_ADJUST 16 +#endif + #if defined(TARGET_PPC64) =20 struct target_func_ptr { @@ -525,7 +537,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, env->fpscr =3D 0; =20 /* Create a stack frame for the caller of the handler. */ - newsp =3D rt_sf_addr - (SIGNAL_FRAMESIZE + 16); + newsp =3D rt_sf_addr - (SIGNAL_FRAMESIZE + RT_SIGFRAME_ADJUST); err |=3D put_user(env->gpr[1], newsp, target_ulong); =20 if (err) @@ -641,7 +653,7 @@ long do_rt_sigreturn(CPUPPCState *env) struct target_rt_sigframe *rt_sf =3D NULL; target_ulong rt_sf_addr; =20 - rt_sf_addr =3D env->gpr[1] + SIGNAL_FRAMESIZE + 16; + rt_sf_addr =3D env->gpr[1] + SIGNAL_FRAMESIZE + RT_SIGFRAME_ADJUST; if (!lock_user_struct(VERIFY_READ, rt_sf, rt_sf_addr, 1)) goto sigsegv; =20 --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323847; cv=none; d=zohomail.com; s=zohoarc; b=SipUrz+v/rA7RsEp4+ipFEapPO+hzlTuFLvG5VsGKEUn458pz+uZfdUn0H/B3ZGjzmNEui3FjpqzXTI7IBtd99rtlEEUZ+K34f0aGhsXGdThOygsXnfVIR726ioAbF+nG34Q+xzmzX6sKPoyDBN4SXFksJNApQK0xC7blY1ZGBQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323847; h=Content-Type: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=hK4D6qlUrHc1besYIDLeSHAI9myyqLOFGnDJjKK88FU=; b=Jx9mbQRxLv0fj/h2dAjNpShPgrQTkRy0zOhm7cnpBHA27j5k5ISORpjBJEfL33IsgvWFIh/AmQ6DYgagWdIA/HkreeodmnHX1Mf41di/C/G6CtX6vgy3/LZQrMYmZ0ex0qZVmoyoJFKvdJmApB9B/r/AHT5Dc3oXSN9Y/cizU80= 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 1777323847241632.3568246371458; Mon, 27 Apr 2026 14:04:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5a-0000PG-50; Mon, 27 Apr 2026 17:01:58 -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 1wHT5R-0000CV-7c for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:50 -0400 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5L-0003Tn-UR for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:45 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id A997360138; Mon, 27 Apr 2026 21:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE350C19425; Mon, 27 Apr 2026 21:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323702; bh=qF/E4NTHGEzqRslmvhkeGAs4imRoAsHDEXNz7p4ViJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dolpgwhFKQTL1J8SAS2gLOQ+ffjAi00MC5jjjJsUSgIdbJtS3upO1e7Nz1THbqmTu fEAsM8D3PyNRWCzXJoWlJtOfUJgoTfu5r6D+WFYTf05YpC8jc/ObdAb4Dkg7PJ4lH0 4hV4w3RiTKmEOfr/Ybw8Q2/+wx0OBlXqpcDd4NxkE3my8GxHMj2+bESMhGn0lQ+tOD oKJPCSj6J95ZBFIDWo3WRn8bCm1PyFtoUnFizvoI3NBrNVvwMmY8Ke9JwVyUmiGNVc lJpS+WM1ikcXqUtxVdU54Q7/bFflFveQUmMZU2WMRd9TCaCY6hXjDfw1nRmGGSZaFt c77TzS2rVMhkg== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 03/15] linux-user: fix off-by-one in host_to_target_for_each_rtattr() Date: Mon, 27 Apr 2026 23:01:21 +0200 Message-ID: <20260427210133.6016-4-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323849594154100 From: Yixin Wei host_to_target_for_each_rtattr() uses "len > sizeof(struct rtattr)" as its loop condition. When the last rtattr in a netlink message has exactly sizeof(struct rtattr) (4) bytes remaining, the loop exits without byte-swapping its rta_len and rta_type. A big-endian guest then reads rta_len in the wrong byte order and fails validation. The companion function target_to_host_for_each_rtattr() correctly uses ">=3D" (added in commit fa2229dbf8). The kernel's RTA_OK macro also uses ">=3D". Fix the host_to_target direction to match. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2485 Signed-off-by: Yixin Wei Fixes: 6c5b5645ae0 ("linux-user: add rtnetlink(7) support") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Helge Deller Cc: qemu-stable@nongnu.org --- linux-user/fd-trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index 64dd0745d2..7f55a0690b 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -480,7 +480,7 @@ static abi_long host_to_target_for_each_rtattr(struct r= tattr *rtattr, unsigned short aligned_rta_len; abi_long ret; =20 - while (len > sizeof(struct rtattr)) { + while (len >=3D sizeof(struct rtattr)) { rta_len =3D rtattr->rta_len; if (rta_len < sizeof(struct rtattr) || rta_len > len) { --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323729; cv=none; d=zohomail.com; s=zohoarc; b=lqMdzKj2pNAYsEVqSiWNa7aeE4nkE2mSBYhutk+sSxaleiZN7h2CPXxsLutMKVmCwsXyl3NeONkzaBIcUv339Woj5iuH3C6dqaA1shKa97koCGMRqplR/WRZD5kQIUgK23uq2YdfpgR9s5O2qAMkVp6keLAviYQIakJdyXHn5Kg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323729; 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=irvoo5hTRqD9NWMsJQPboTPdM4S6n22UGf4ZWtz+79U=; b=OK/iaZoTHKTA/xmPy7y0sbr9BRX0wx/jK0yq5P27f2lkW9DTrzok0l+tWwTCw6TpHYPYLrPqfI3lPTlnKO2/6bMhysNxyyLYwP1lqWEPglI/q/7QRQD3I4/sfqgfBgiqKPV3KGAEMlrB8hVgSOQ7omVW5ktKKbbi90WhDCRXohY= 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 1777323729893400.2774993537738; Mon, 27 Apr 2026 14:02:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5a-0000Qp-Nv; Mon, 27 Apr 2026 17:01:58 -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 1wHT5T-0000GD-HR for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:52 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5P-0003UG-4D for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:50 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 5E4EC4099D; Mon, 27 Apr 2026 21:01:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF0F4C2BCB5; Mon, 27 Apr 2026 21:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323704; bh=SNBeEj5KSiWYkyqRyYX2gQdrt+ivR89RyfGpq4YmrsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPz2s4XgJKOdLKh0y4lui14zYkrMp2F6Cs9GuPvry66VvD9DLXRFUOvU6t9sG3aHR HrluWiCTSoNV66JdadnK1xDKm8WtzFrTHzlCf/jcX+9luTkDwR70Syy42k+GVcLjUY LtNvTWwn2Gq86KksCpuW71GmD+iTb34INSB3Z292//EwoFyE8BiTrKLX10Q5jDKyv0 7C9ooG1qXOxzVQBt1ZV4UghfRPkPd5nNGjyrJchZbJl/Hp2Gsx7mdWpkfY+Z9V2eG0 BbWUY7bVst4QEmDH2rAloFq4Ayznjm2aExXrtLXofAxBkdZveWbDQvhPPGRGSwkGYO SjjNH/jKaGIuQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 04/15] linux-user: Don't define target_stat64 struct for loongarch64 Date: Mon, 27 Apr 2026 23:01:22 +0200 Message-ID: <20260427210133.6016-5-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323732222158500 Content-Type: text/plain; charset="utf-8" From: Gyorgy Tamasi The kernel defines 'struct stat64' only if __BITS_PER_LONG !=3D 64 || defined(__ARCH_WANT_STAT64). loongarch64 doesn't set __ARCH_WANT_STAT64, and it isn't 32-bit, so it won't get this struct. QEMU incorrectly does define a target_stat64 struct. However this isn't causing any guest-visible problems, because defining the target_stat64 struct and TARGET_HAS_STRUCT_STAT64 affects these syscalls: TARGET_NR_stat64 TARGET_NR_lstat64 TARGET_NR_fstat64 TARGET_NR_fstatat64 TARGET_NR_newfstatat For loongarch64 the only one of those we provide is newfstatat, and that is actually a separate QEMU bug, because the kernel does not provide that syscall for this architecture. No real guest code will be using a syscall that doesn't exist in the ABI. (Some of these syscalls are present in the loongarch64 "ABI1.0", but that ABI was never accepted in the upstream kernel, and QEMU does not model that ABI, only the "ABI2.0".) Stop defining TARGET_HAS_STRUCT_STAT64 anyway, for consistency with the kernel and to avoid confusion. Note: Commit message suggested by Peter Maydell Signed-off-by: Gyorgy Tamasi Tested-by: Gyorgy Tamasi Reviewed-by: Pierrick Bouvier Reviewed-by: Peter Maydell Signed-off-by: Helge Deller --- linux-user/syscall_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 679af640c0..6967306be4 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2005,7 +2005,7 @@ struct target_stat { abi_uint __unused5; }; =20 -#if !defined(TARGET_RISCV64) +#if !defined(TARGET_RISCV64) && !defined(TARGET_LOONGARCH64) #define TARGET_HAS_STRUCT_STAT64 struct target_stat64 { abi_ullong st_dev; --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323863; cv=none; d=zohomail.com; s=zohoarc; b=UzGRcuUqpyqk0WKKeCcoh1Ic4OOcXCgbMF4RLKJYWsO/8vtKpZZKkbQY0nBo9ZcD9yGpDAdDTN5IgeGzvrowVCxxpoBbaiMytkEHeoJE1Bcs8BWdAM/M9JoI3E86FpkhNhViYUgjG/yZKCO2JT6JHf8a9MKxacHCEByEejA7doY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323863; h=Content-Type: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=QLgfdkSK8cCWnaX38iYPlxYsaVb9zqrB+9pqkNWh1+8=; b=g06toqrchP7M51gTK2X1PQZebMRiFfXpFUvdzAxZYErYwLSt+P6wrCSKddYHMY7qH87nx6kK0BCR5dtp/ctkj/81t2HidsBk4TJyqqRdA/3gklTCZ/Jcg9j1LOm2qsu7Cw/5VPIeJX4MDzFr45U6bmMU2TnnP53CuCYybviGN0w= 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 177732386360844.110559445803574; Mon, 27 Apr 2026 14:04:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5b-0000Ru-3i; Mon, 27 Apr 2026 17:01:59 -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 1wHT5T-0000GC-DU for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:52 -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 1wHT5Q-0003US-0J for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:50 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 6CAFD60139; Mon, 27 Apr 2026 21:01:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0928C2BCB6; Mon, 27 Apr 2026 21:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323706; bh=QIFtf3dqQlSgmjSkVvwlhh3G2J8OJkshPhuv1bYI+XA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BwGpa9rKG0c/BwdWPvOypSZsNdaD6tBR8ALcRoshODu1Es/RR4C9B31SpTqjnVDSn iv9kAFJpmiZV7QJmlxTrZoXuxMBMdfJ0JRaggO5Lao2FgYZ1Un0ExwvSTnFxJb0KLg MsjNyuqQfdQVDZ0CAIRhvC6ex0FrTiu/Su9lp57fgrlkFoz1GErpPOOwlfF02ylDza 1ABkl9ovhG5nmjGi82G0DojfyXL4F/IBrpwXrXZVFamRqAe7xdevotMMlu5IiGRi3x sdcPAVpQ0QzFLe9tAlxs0BKVSbK6PnMuK8YYEg7jrqWmfC3d/roYmeFssOjU6gzWof 8SmaJKMz/MAQw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 05/15] linux-user/arm/nwfpe: Replace user_registers with current_cpu Date: Mon, 27 Apr 2026 23:01:23 +0200 Message-ID: <20260427210133.6016-6-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323866478154100 From: Richard Henderson Use the thread-local variable current_cpu instead of a global variable to access the general registers. This also means we don't need to pass env to EmulateAll. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Helge Deller --- linux-user/arm/cpu_loop.c | 2 +- linux-user/arm/nwfpe/fpa11.c | 9 +-------- linux-user/arm/nwfpe/fpa11.h | 23 +++++++---------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index 19874f4c72..262ab5cc41 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -215,7 +215,7 @@ static bool insn_is_linux_bkpt(uint32_t opcode, bool is= _thumb) static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode) { TaskState *ts =3D get_task_state(env_cpu(env)); - int rc =3D EmulateAll(opcode, &ts->fpa, env); + int rc =3D EmulateAll(opcode, &ts->fpa); int raise, enabled; =20 if (rc =3D=3D 0) { diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c index 0f1afbd91d..44783934b2 100644 --- a/linux-user/arm/nwfpe/fpa11.c +++ b/linux-user/arm/nwfpe/fpa11.c @@ -30,7 +30,6 @@ =20 =20 FPA11* qemufpa =3D NULL; -CPUARMState* user_registers; =20 /* Reset the FPA11 chip. Called to initialize and reset the emulator. */ void resetFPA11(void) @@ -156,7 +155,7 @@ void SetRoundingPrecision(const unsigned int opcode) =20 /* Emulate the instruction in the opcode. */ /* ??? This is not thread safe. */ -unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qre= gs) +unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa) { unsigned int nRc =3D 0; // unsigned long flags; @@ -173,12 +172,6 @@ unsigned int EmulateAll(unsigned int opcode, FPA11* qf= pa, CPUARMState* qregs) } =20 qemufpa=3Dqfpa; - user_registers=3Dqregs; - -#if 0 - fprintf(stderr,"emulating FP insn 0x%08x, PC=3D0x%08x\n", - opcode, qregs[ARM_REG_PC]); -#endif fpa11 =3D GET_FPA11(); =20 if (fpa11->initflag =3D=3D 0) /* good place for __builtin_expect */ diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h index d459c5da02..20f9d2eb81 100644 --- a/linux-user/arm/nwfpe/fpa11.h +++ b/linux-user/arm/nwfpe/fpa11.h @@ -25,15 +25,6 @@ =20 #define GET_FPA11() (qemufpa) =20 -/* - * The processes registers are always at the very top of the 8K - * stack+task struct. Use the same method as 'current' uses to - * reach them. - */ -extern CPUARMState *user_registers; - -#define GET_USERREG() (user_registers) - /* Need task_struct */ //#include =20 @@ -91,25 +82,25 @@ void SetRoundingPrecision(const unsigned int); =20 static inline unsigned int readRegister(unsigned int reg) { - return (user_registers->regs[(reg)]); + CPUARMState *env =3D cpu_env(current_cpu); + return env->regs[reg]; } =20 static inline void writeRegister(unsigned int x, unsigned int y) { -#if 0 - printf("writing %d to r%d\n",y,x); -#endif - user_registers->regs[(x)]=3D(y); + CPUARMState *env =3D cpu_env(current_cpu); + env->regs[x] =3D y; } =20 static inline void writeConditionCodes(unsigned int x) { - cpsr_write(user_registers, x, CPSR_NZCV, CPSRWriteByInstr); + CPUARMState *env =3D cpu_env(current_cpu); + cpsr_write(env, x, CPSR_NZCV, CPSRWriteByInstr); } =20 #define ARM_REG_PC 15 =20 -unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qre= gs); +unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa); =20 unsigned int EmulateCPDO(const unsigned int); unsigned int EmulateCPDT(const unsigned int); --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323859; cv=none; d=zohomail.com; s=zohoarc; b=nytPv+koTll5mZsPuA4BF32nT7C5AqheuYqpZY4cTZMcLrjwSeXESFBsoCzxy0tXnZUpBAXfn0z/TdwvfuUyqGxjwUL3fV4wTaJfo8te9/OP5gdv5wn13BL4PVSVFQ0jvjC2Mx5/GTyc78rkAPHlvjyy3i5WY6ahOZQKINgQbVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323859; h=Content-Type: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=BUf4zjJmLeuQ9h21FN4/btHO8MJymeV2N9cZXKMb/qY=; b=nAAQJgZ5LVPYphsFYMoEk+tdRjzBAtKTHOIUL13+77Xc0WAElc60mbY2cRWkVcG8wQ/OpJymH2ctkzVHXDg6C9el8Y9plHx7BwKCArovA6zeBcWZjHkGA67QcT2qIswGVimq7zXiS7LvqYoLW0Eukcx94imtPnY0cOCA65DY79c= 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 1777323859594428.07041493158715; Mon, 27 Apr 2026 14:04:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5X-0000JJ-QS; Mon, 27 Apr 2026 17:01:55 -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 1wHT5T-0000GF-Ii for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:52 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5R-0003V0-2l for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:50 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 22E6640979; Mon, 27 Apr 2026 21:01:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92773C19425; Mon, 27 Apr 2026 21:01:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323708; bh=WKjvKh3WS9aFV3WDMKRIHdU/l7XY2HCHrBoFujAWcmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nbqgvr/CVerZdmWVgwmLUzhS3e/nR+tOX8qqkPVj2F5SxsoPWfskiNl4Hs6vcVq5L WQvjxC/Uiu2bFpnpxEE4EDNdHUGgk7sopWfZhg94QuzSDjMa7RV+0GgcyymbgfYPyZ DnoFy97myfRqp968H7F+8NGZ9iWVSYfsU+8zxaGlVTmtS0mKYkuYEbxUcpkn9aviMV OSUN70zC8L0To9ST8NlSzjqNXIWng1c6vcqOAFXK3RfxHw+qJESs0boLMmEHrqc0eS 9PCPsYMJuN2itvIzajXF4W1McpBRau0AOaEUzlGys0rkIsEz/rn+jwqFTqtwxp7LSB rhK7c+ee93LfQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 06/15] linux-user/arm/nwfpe: Use thread-local storage for qemufpa Date: Mon, 27 Apr 2026 23:01:24 +0200 Message-ID: <20260427210133.6016-7-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323860717158500 From: Richard Henderson Fix the thread safety of the emulation by not storing a pointer in global storage. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Helge Deller --- linux-user/arm/nwfpe/fpa11.c | 3 +-- linux-user/arm/nwfpe/fpa11.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c index 44783934b2..15888463f7 100644 --- a/linux-user/arm/nwfpe/fpa11.c +++ b/linux-user/arm/nwfpe/fpa11.c @@ -29,7 +29,7 @@ //#include =20 =20 -FPA11* qemufpa =3D NULL; +__thread FPA11* qemufpa =3D NULL; =20 /* Reset the FPA11 chip. Called to initialize and reset the emulator. */ void resetFPA11(void) @@ -154,7 +154,6 @@ void SetRoundingPrecision(const unsigned int opcode) } =20 /* Emulate the instruction in the opcode. */ -/* ??? This is not thread safe. */ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa) { unsigned int nRc =3D 0; diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h index 20f9d2eb81..659d38ae3a 100644 --- a/linux-user/arm/nwfpe/fpa11.h +++ b/linux-user/arm/nwfpe/fpa11.h @@ -74,7 +74,7 @@ typedef struct tagFPA11 { float_status fp_status; /* QEMU float emulator status */ } FPA11; =20 -extern FPA11* qemufpa; +extern __thread FPA11* qemufpa; =20 void resetFPA11(void); void SetRoundingMode(const unsigned int); --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323835; cv=none; d=zohomail.com; s=zohoarc; b=Au0tveTujty/4wKR/PXNMa2kTDaHHu/x37q5UVoy2KW3vC3RrkLlA8AhhMAO+9xNFi2i4ehzK1VjltuFK7+paHCITujQQKW2yNwnA00V+0rcUQnl9Z/hVNAxSbJhuRZSSNdCZTz2j2jwJ5yjuA1L/0PweF51y82xsB4P0gyyo/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323835; 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=7nxzd6lhlL4G63Vg6wkHD2EFfDYs0ZikecNfZHj7pCE=; b=CIbwNKndKqp2gUkzihzR7NqJBRZsDut1maLuOp4LDuCHw0kMjDMCI1OrABsz+nJ+wWdrzj8DaISc76+piyjaLah3l9n0BdYrPXuDNaWslM1hQM8UNP5Fe3HsVTnkYdd2/GMou9Ncrd0Yn3si4yG6/cLHfvd2Q4ahtbabKiv3Fzg= 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 177732383537134.45950410492492; Mon, 27 Apr 2026 14:03:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5b-0000TV-Q8; Mon, 27 Apr 2026 17:01:59 -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 1wHT5X-0000Iz-I3 for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:55 -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 1wHT5U-0003WD-4y for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:54 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 0339B408CB; Mon, 27 Apr 2026 21:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7473BC19425; Mon, 27 Apr 2026 21:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323709; bh=wru9oPkln2hoGe2ulS/uGq6EqHcd0/+fKmWJSpYsnvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPKto8VZATcgZ61gkvS4qHCc4MS1W35efLQlYTLi74TNeJR79+/ML+EUwTOZ23lGg 5dMOplWwUut7qfw5RYZrTZsxyR+HbdVNxURB4XZSfH5aEl283NtZvPMfQAbjvjsc+o C2r1OjwEjYeqxswavHIjbLqCEsEsk2RWyHwhYbDnzuQZL7O3tjmf2UEy4e324Zh9nI 4HgJ8HjUwz1af35OgscWvcEexkb2IgfLPrNs/wxdUbBh87RS9nFCH1+u5KfJ2UPTxU 2U8AnJNtFdWdFHSruOD2RXeR76EsnJoggyf9U5Btgc74uXmGDDXXezxYQ/HrD1H8Af 5c+L+C+mPehLw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 07/15] linux-user/strace: Use pointer type for read and write values Date: Mon, 27 Apr 2026 23:01:25 +0200 Message-ID: <20260427210133.6016-8-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323836594158500 Content-Type: text/plain; charset="utf-8" From: Alistair Francis The stack pointer is being truncated as 32-bits for qemu-riscv64, so let's use %p to print the syscall pointer argument. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3238 Signed-off-by: Alistair Francis Reviewed-by: Nutty Liu Signed-off-by: Helge Deller --- linux-user/strace.list | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/strace.list b/linux-user/strace.list index 35f001fecd..6162a407f9 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1114,7 +1114,7 @@ { TARGET_NR_quotactl, "quotactl" , NULL, NULL, NULL }, #endif #ifdef TARGET_NR_read -{ TARGET_NR_read, "read" , "%s(%d,%#x,%d)", NULL, NULL }, +{ TARGET_NR_read, "read" , "%s(%d,%p,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_readahead { TARGET_NR_readahead, "readahead" , NULL, NULL, NULL }, @@ -1674,7 +1674,7 @@ print_syscall_ret_waitpid }, #endif #ifdef TARGET_NR_write -{ TARGET_NR_write, "write" , "%s(%d,%#x,%d)", NULL, NULL }, +{ TARGET_NR_write, "write" , "%s(%d,%p,%d)", NULL, NULL }, #endif #ifdef TARGET_NR_writev { TARGET_NR_writev, "writev" , "%s(%d,%p,%#x)", NULL, NULL }, --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323833; cv=none; d=zohomail.com; s=zohoarc; b=kAiqzi6jXRdF+jI57ARyAnp52qsP+tFbPlO7n9FX8fimyfQQi8d5CYrBurkMMfEkauczrykc2fz5f7xoJ4bVGtiMf04Zx+8W7awG8vsVzbvy8Yn2mflJqS6qtnn4basEWThUST0D0ynbn4T0TSAS1GbBpWKTiCvlD8tTng8CIjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323833; 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=d77C33jIzCXQQlj+XrIcHnofLm5IvIkaCI0ccUq1HII=; b=VqQF8eRr9JinC0qpaOnHlsT8PNhBlPCyxW2Oe6K/21ni4kWH9VCXXuy9O7psnkc9yPBZxoJnxQ+gPEShjOuu+vqjDmchy1U9LNkZmgu7ilw6w7kPL/wvWYRE3L/Pqd6f80Eoa90XdC7ZRO8AyWHVLB0xMRaLYqV07gOqlHg8s34= 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 1777323833664816.7058928154872; Mon, 27 Apr 2026 14:03:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5b-0000Sw-IX; Mon, 27 Apr 2026 17:01:59 -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 1wHT5X-0000J1-IG for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:55 -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 1wHT5U-0003Wk-UF for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:54 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 1163260138; Mon, 27 Apr 2026 21:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55866C2BCB5; Mon, 27 Apr 2026 21:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323711; bh=ZCgbefl3znT//LnX5C+F02YXGLn7Vtw2haVvLrZdTz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIDwp7HzuIdSMdH+ZOsnuOmBgJ0H3sIhTFXdexpOSDOqmTQR6Z91Y0Su/36pPFMm3 hlW81d+N3U7Jnnn+ePZ7wyYY3I0KfXsx1equgMMcd+37IsPE/acgq4m4SZVvGC6gwk 4ZyRLvvWZ8w98but5/aIcgsZ8yN8ZPq9jKQ/hA8BkOfPcbbMbcd3WDJoDKURksiIWJ tilNs21L3IY+Qf338O9JbxR/9VODfEIqdp7MCEE1ObdWAzQDdSjkHRcD0iO3et4PJX N2I97j0ULUMpLHkbDze3nq3a8OHtM1ZSw2eSd869fluJz51BznZnwZ6jMmYU/DZX0V EQoyXnl6REM+A== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 08/15] linux-user/mips: sync k0 TLS for EF_MIPS_MACH_OCTEON userlands Date: Mon, 27 Apr 2026 23:01:26 +0200 Message-ID: <20260427210133.6016-9-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323834765158500 Content-Type: text/plain; charset="utf-8" From: James Hilliard Cavium Octeon userspace is not following a generic MIPS Linux TLS ABI rule here. Older Octeon glibc uses the k0 register as the fast thread pointer, while newer Octeon2 and Octeon3 glibc variants use the normal rdhwr $29 path. linux-user already updates CP0_UserLocal for cpu_set_tls() and TARGET_NR_set_thread_area, but it does not keep gpr[26] synchronized. That leaves EF_MIPS_MACH_OCTEON userlands able to complete set_thread_area() and still reach pthread startup or pthread_self() with a stale k0 value. Use the existing MIPS ELF machine flags from linux-user/elfload.c and mirror CP0_UserLocal into gpr[26] only for EF_MIPS_MACH_OCTEON. Signed-off-by: James Hilliard Reviewed-by: Richard Henderson Signed-off-by: Helge Deller --- linux-user/elfload.c | 3 +++ linux-user/mips/target_cpu.h | 5 +++++ linux-user/qemu.h | 1 + linux-user/syscall.c | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 59b543f740..0e757787d2 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1476,6 +1476,9 @@ static void load_elf_image(const char *image_name, co= nst ImageSource *src, /* Usual start for brk is after all sections of the main executable. */ info->brk =3D TARGET_PAGE_ALIGN(hiaddr + load_bias); info->elf_flags =3D ehdr->e_flags; +#ifdef TARGET_MIPS + info->use_k0_tls =3D (ehdr->e_flags & EF_MIPS_MACH) =3D=3D EF_MIPS_MAC= H_OCTEON; +#endif =20 prot_exec =3D PROT_EXEC; #ifdef TARGET_AARCH64 diff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h index c375616c55..2bbd0a81c5 100644 --- a/linux-user/mips/target_cpu.h +++ b/linux-user/mips/target_cpu.h @@ -35,7 +35,12 @@ static inline void cpu_clone_regs_parent(CPUMIPSState *e= nv, unsigned flags) =20 static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls) { + TaskState *ts =3D get_task_state(env_cpu(env)); + env->active_tc.CP0_UserLocal =3D newtls; + if (ts->info->use_k0_tls) { + env->active_tc.gpr[26] =3D newtls; + } } =20 static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index cfe5f45fc4..7f98fb2607 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -65,6 +65,7 @@ struct image_info { uint32_t note_flags; =20 #ifdef TARGET_MIPS + bool use_k0_tls; int fp_abi; int interp_fp_abi; #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index f4b74ad350..8e96cc26db 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -13216,7 +13216,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, = int num, abi_long arg1, #ifdef TARGET_NR_set_thread_area case TARGET_NR_set_thread_area: #if defined(TARGET_MIPS) - cpu_env->active_tc.CP0_UserLocal =3D arg1; + cpu_set_tls(cpu_env, arg1); return 0; #elif defined(TARGET_I386) && defined(TARGET_ABI32) return do_set_thread_area(cpu_env, arg1); --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323844; cv=none; d=zohomail.com; s=zohoarc; b=VX9A7pOwQY55zrlive5Zn+JT0onMnwKi5hIguBmTV/zSlKGlmxt61xMI6f4F2+JEHpUqnCUyGA9bqMG1A0JCXKPJqfLUBr7kRpurAsqdNgwwXHR94FiXAP6iOc39Wa/stiJhEPKzItRvklrB5xusuV8C59jtvBW0JrovPQCAZbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323844; 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=k8wB79k77jfiScPuqo400Ox7fQ3uCc5qqOQvfhlFdAQ=; b=HdhLLgIfuU4s/qWnaQ15WCqoVmIJUpbxjZgRjbKVQIgV/gjSszIJ0EDUB4VHSRuZx1yDoT+InwkPMmdvYA3Me69Q0vdFVIDCbuwKEniaum4e+I2C4zURyo4+NPjz4444cMxe3qLDAFdsyfKqcLNvQSSVwkpz9bZY0C83It2ybkM= 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 177732384434922.267395135214088; Mon, 27 Apr 2026 14:04:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5c-0000VL-HN; Mon, 27 Apr 2026 17:02:00 -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 1wHT5Z-0000OO-2S for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:57 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5X-0003X1-A9 for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:56 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BB7A040979; Mon, 27 Apr 2026 21:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37916C2BCB5; Mon, 27 Apr 2026 21:01:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323713; bh=KG2fwHQvDISByslvVy41WuAySIFV/sri4ZntnBzQCgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrfCq7fg5Gt8lgBWYHXyxT9bxIlTKU6EXx4r+JIfiDYKBcYAUzZ4EGLwpUXOI10hy ZWScrmuR0jKxKt1MXAleT1RjQDc7QGoULmGQpN+11y06Jvn5WVXmTIiOS6fd2GhmHH 875cW+xQjT8IQyC5DTJybpUr5f3yuZ8QkzxeLOJfyZ8V/rYsJZEzwguDqV+vh/ZbgC TzH9DD7BoTfJ/WjVw3VTiZSzOLhdHvcyRV4At+8UGx0ccohCopBUqL8PWAvDHyvWwi 7P4DzzY4PkTT7aEKPkA1Rv2MfrybaYi8rcNm4oauh90IS1lNVYAodbwl8vu40tH6h5 al9013YmhO8nA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 09/15] linux-user: Define SO_TIMESTAMP*_NEW and SO_RCVTIMEIO_NEW Date: Mon, 27 Apr 2026 23:01:27 +0200 Message-ID: <20260427210133.6016-10-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323844755158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller Define the entries which always use the 64-bit timestamps. Signed-off-by: Helge Deller --- linux-user/alpha/sockbits.h | 7 +++++++ linux-user/generic/sockbits.h | 8 ++++++++ linux-user/hppa/sockbits.h | 7 +++++++ linux-user/mips/sockbits.h | 7 +++++++ linux-user/sparc/sockbits.h | 7 +++++++ 5 files changed, 36 insertions(+) diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h index d54dc98c09..0201ab9374 100644 --- a/linux-user/alpha/sockbits.h +++ b/linux-user/alpha/sockbits.h @@ -75,6 +75,13 @@ /* Instruct lower device to use last 4-bytes of skb data as FCS */ #define TARGET_SO_NOFCS 43 =20 +#define TARGET_SO_TIMESTAMP_NEW 63 +#define TARGET_SO_TIMESTAMPNS_NEW 64 +#define TARGET_SO_TIMESTAMPING_NEW 65 + +#define TARGET_SO_RCVTIMEO_NEW 66 +#define TARGET_SO_SNDTIMEO_NEW 67 + /* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefo= re we * have to define SOCK_NONBLOCK to a different value here. */ diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h index b3b4a8e44c..33e6c3a572 100644 --- a/linux-user/generic/sockbits.h +++ b/linux-user/generic/sockbits.h @@ -58,4 +58,12 @@ =20 #define TARGET_SO_PROTOCOL 38 #define TARGET_SO_DOMAIN 39 + +#define TARGET_SO_TIMESTAMP_NEW 63 +#define TARGET_SO_TIMESTAMPNS_NEW 64 +#define TARGET_SO_TIMESTAMPING_NEW 65 + +#define TARGET_SO_RCVTIMEO_NEW 66 +#define TARGET_SO_SNDTIMEO_NEW 67 + #endif diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h index 23f69a3293..2304dbbf79 100644 --- a/linux-user/hppa/sockbits.h +++ b/linux-user/hppa/sockbits.h @@ -67,6 +67,13 @@ =20 #define TARGET_SO_CNX_ADVICE 0x402E =20 +#define TARGET_SO_TIMESTAMP_NEW 0x4038 +#define TARGET_SO_TIMESTAMPNS_NEW 0x4039 +#define TARGET_SO_TIMESTAMPING_NEW 0x403A + +#define TARGET_SO_RCVTIMEO_NEW 0x4040 +#define TARGET_SO_SNDTIMEO_NEW 0x4041 + /* TARGET_O_NONBLOCK clashes with the bits used for socket types. Therefo= re we * have to define SOCK_NONBLOCK to a different value here. */ diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h index 562cad88e2..1f479d54aa 100644 --- a/linux-user/mips/sockbits.h +++ b/linux-user/mips/sockbits.h @@ -71,6 +71,13 @@ #define TARGET_SO_RCVBUFFORCE 33 #define TARGET_SO_PASSSEC 34 =20 +#define TARGET_SO_TIMESTAMP_NEW 63 +#define TARGET_SO_TIMESTAMPNS_NEW 64 +#define TARGET_SO_TIMESTAMPING_NEW 65 + +#define TARGET_SO_RCVTIMEO_NEW 66 +#define TARGET_SO_SNDTIMEO_NEW 67 + /** sock_type - Socket types * * Please notice that for binary compat reasons MIPS has to diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h index 0a822e3e1f..42ecfdc8f9 100644 --- a/linux-user/sparc/sockbits.h +++ b/linux-user/sparc/sockbits.h @@ -61,6 +61,13 @@ #define TARGET_SO_TIMESTAMPING 0x0023 #define TARGET_SCM_TIMESTAMPING TARGET_SO_TIMESTAMPING =20 +#define TARGET_SO_TIMESTAMP_NEW 0x0046 +#define TARGET_SO_TIMESTAMPNS_NEW 0x0042 +#define TARGET_SO_TIMESTAMPING_NEW 0x0043 + +#define TARGET_SO_RCVTIMEO_NEW 0x0044 +#define TARGET_SO_SNDTIMEO_NEW 0x0045 + #define TARGET_SO_RXQ_OVFL 0x0024 =20 #define TARGET_SO_WIFI_STATUS 0x0025 --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323777; cv=none; d=zohomail.com; s=zohoarc; b=mrcp/99dFfae8PPrvU6hO1d8zSP42p75Memj7yuZYCDF+w2PPjJu92nJmfp7+3q02SFVB8tfOtcQzHBJBzbBV8b92Z5ixB+fGw24FMZ69vDfq9Tg2rBoovEibRhQGuDq67nJUVNdEOSrSUl3EqsvgGy3/6I5TNNQxJ0nEtUBuW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323777; 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=UoCl3WIROChkNJUr+WLkhWYMlBYiLW8U1i1t5meFcE4=; b=NPXa28GR5Al4sOqm7SqAoXNXtszK6Y9JovpddGHp8DgAkNkGV4E548YjK0Sct42Ky2p+UWBt8eD8zNTT0dNqDnX9LTd04qH5cOn9RvA6SYizmikPsllLPx5Xkcaz7ZOWpOUM/B5tEza4UYBYN3kBT4Ggl3p6T2UoBkyQfWoKCZg= 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 1777323777948910.9286933620667; Mon, 27 Apr 2026 14:02:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5f-0000X7-3a; Mon, 27 Apr 2026 17:02:03 -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 1wHT5a-0000Rk-Sb for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:58 -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 1wHT5Y-0003XX-Ec for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:58 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id CA53960138; Mon, 27 Apr 2026 21:01:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19298C2BCB6; Mon, 27 Apr 2026 21:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323715; bh=vV5gAp6A1fV7/G4QQ1bgHmKV5IUIINSjN34lG8oX+zU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yeo0ZjaMJb2GEWJP4V57ou8vfN083sjcZWbN+sPoPAEyWIi6PP//d9l/kqriOIoUr mKrY5bwshXFAtQaN3ajiJfLoWgCsDWgHnJep/iGkHRZ8Ss4fyQBzsp+atu4iGA5oKl WQB1D/3Lnjgyp/MBlkmr+j3Ddbmuehslip1Upc7Qd+RYWCoj3/B8vvV7IumdaOUpKy pjbhDWsT2k2AD83nf2thyXrWMH0mEkZ9m6odNaTyiNRS9eOEcV2z7VjFtqB7u2ZGN4 SzbdSxUzrq2ZZroBlEstwVld/WJNSUATSg+Ab8f31IhTNSoctlu08KXjXEZx9F+YZr vaX282PRs9TwQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 10/15] linux-user: Add setsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Date: Mon, 27 Apr 2026 23:01:28 +0200 Message-ID: <20260427210133.6016-11-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323779271154100 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add handlers for both sockopts which use 64-bit time_t from userspace. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/885 Signed-off-by: Helge Deller --- linux-user/syscall.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 8e96cc26db..751e6eabe5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1143,7 +1143,6 @@ static inline abi_long copy_to_user_timeval(abi_ulong= target_tv_addr, return 0; } =20 -#if defined(TARGET_NR_clock_adjtime64) && defined(CONFIG_CLOCK_ADJTIME) static inline abi_long copy_from_user_timeval64(struct timeval *tv, abi_ulong target_tv_addr) { @@ -1160,7 +1159,6 @@ static inline abi_long copy_from_user_timeval64(struc= t timeval *tv, =20 return 0; } -#endif =20 static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr, const struct timeval *tv) @@ -2391,6 +2389,25 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, &tv, sizeof(tv))); return ret; } + case TARGET_SO_RCVTIMEO_NEW: + case TARGET_SO_SNDTIMEO_NEW: + { + struct timeval tv; + + if (optlen !=3D sizeof(struct target__kernel_sock_timeval)= ) { + return -TARGET_EINVAL; + } + + if (copy_from_user_timeval64(&tv, optval_addr)) { + return -TARGET_EFAULT; + } + + ret =3D get_errno(setsockopt(sockfd, SOL_SOCKET, + optname =3D=3D TARGET_SO_RCVTIMEO_NEW ? + SO_RCVTIMEO : SO_SNDTIMEO, + &tv, sizeof(tv))); + return ret; + } case TARGET_SO_ATTACH_FILTER: { struct target_sock_fprog *tfprog; --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323730; cv=none; d=zohomail.com; s=zohoarc; b=QG3ZksEak8IKRC6UZjWhpOCDDwbE2hjIOyPFWNUTqMGgcc8XGBOHHunoXjcLKmRg4nf/9FdnlERSKi++CbBZ/PmrBMzsqoWtV2IVVkcixCmZbWLBEShhtcwynJrBjRlzJgVHSirBAB97vgPbHHX7saB9ny+mJ5G/Lp8H9lcShgo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323730; 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=4YmrgKweIhOywPMn7gGpQ4iHsV9AZmpQkpUFAZcfOFc=; b=SzyohKHj5ityA6xvVCNf9I/pDF5c0NlZ6aYWpT+PZgwx44VXrSB6Fx7klFn/0GkxOsTJKrFhQZLx9i6BFk/auqv7Uj5N23v45QxREqSztJiZVeu6wIg4vZY0Y5WuOcXK0Ku+4RFFiD32Xpf0bE3DGpuDVLYU4aJ8umFHwPKuwa8= 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 1777323730401130.26960583716016; Mon, 27 Apr 2026 14:02:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5d-0000WV-AW; Mon, 27 Apr 2026 17:02:01 -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 1wHT5c-0000US-4b for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:00 -0400 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5a-0003Xr-GV for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:59 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 84F86408CB; Mon, 27 Apr 2026 21:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0049C2BCB5; Mon, 27 Apr 2026 21:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323717; bh=9XG9CSjH8eRrdK70JCXl+tYP+K497/Yv9bzjW1OONfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vOgd8LqqU4Ai550EcX4O1YzXwDtmmHmoxTkbcGtaC4N5Wp63GCSMBCkZEtgmVC/qM GlHrc0HCTNoUkSGFbAk084pL7j54dVx+/sdHI7EcxW49sk42suR4ylwkZ7hOedwob4 UdvFPL9jmNJeNGvoyndn0B/uM/f7m69ahxgX53EIYpjtvo+VMMTX3DK0kb6rI24rLO qgxg5k/MG5q2Kl6SodUoupETVUIjS2u7DXZHvqVm45DCMR6/cwuwx0QdtHKoIwDd5B uQoMP7kSpkb1DKmI0u7YQXXGtH4CHDm4GAT2VFZ+w+8Uwh1n0gU/nPLArGl3WXxunw TUunFbgm2O4xA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 11/15] linux-user: Add getsockopt() for SO_RCVTIMEO_NEW and SO_SNDTIMEO_NEW Date: Mon, 27 Apr 2026 23:01:29 +0200 Message-ID: <20260427210133.6016-12-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c0a:e001:78e:0:1991:8:25; envelope-from=deller@kernel.org; helo=sea.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323732216158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add handlers for both sockopts which use 64-bit time_t from userspace. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/885 Signed-off-by: Helge Deller --- linux-user/syscall.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 751e6eabe5..d0390e04b4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2621,7 +2621,8 @@ static abi_long do_getsockopt(int sockfd, int level, = int optname, /* These don't just return a single integer */ case TARGET_SO_PEERNAME: goto unimplemented; - case TARGET_SO_RCVTIMEO: { + case TARGET_SO_RCVTIMEO: + case TARGET_SO_RCVTIMEO_NEW: { struct timeval tv; socklen_t tvlen; =20 @@ -2641,11 +2642,17 @@ get_timeout: if (ret < 0) { return ret; } - if (len > sizeof(struct target_timeval)) { - len =3D sizeof(struct target_timeval); - } - if (copy_to_user_timeval(optval_addr, &tv)) { - return -TARGET_EFAULT; + if (len =3D=3D sizeof(struct target__kernel_sock_timeval)) { + if (copy_to_user_timeval64(optval_addr, &tv)) { + return -TARGET_EFAULT; + } + } else { + if (len >=3D sizeof(struct target_timeval)) { + len =3D sizeof(struct target_timeval); + if (copy_to_user_timeval(optval_addr, &tv)) { + return -TARGET_EFAULT; + } + } } if (put_user_u32(len, optlen)) { return -TARGET_EFAULT; @@ -2653,6 +2660,7 @@ get_timeout: break; } case TARGET_SO_SNDTIMEO: + case TARGET_SO_SNDTIMEO_NEW: optname =3D SO_SNDTIMEO; goto get_timeout; case TARGET_SO_PEERCRED: { --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323774; cv=none; d=zohomail.com; s=zohoarc; b=OUvzfx23MH/6JduHvOkh9VIeZD0viebQcviQk5omjlWKJKB+8d6T7NWU37+DKdmlKBzZJeSYv+O6iZ/PmYdUkTiVAyjld4ypzQU85adts/+/r39cLK6bR3fmzLuzmFvB36C3Zj7QpOSdq1gkq8/NppUUSsZA7DHIFvvTa1F4mLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323774; 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=iAUeb3Q/JSVu719SIBCxc6dUbkhvHmKTvGScRw3PFus=; b=YWjKqx7+i6b6+qnxQm8MQvDtcWeCArxbojzM6m7UdbSD3tyv+AKHqgrW9iCcS18iqaenoD6hmi/Aaa8maaZW2B96NzzfS+uZAxm7ozLDPcSlHpRuxp2AXKPHzsn/f8L0YXJJoZOxdFyEKUhZKffO/jb56mTzIGfjRdIoG7fOKSw= 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 1777323774242258.7732468791437; Mon, 27 Apr 2026 14:02:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5g-0000Xs-Qn; Mon, 27 Apr 2026 17:02:04 -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 1wHT5f-0000XB-86 for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:03 -0400 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5c-0003Y6-59 for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:03 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 8D2D460138; Mon, 27 Apr 2026 21:01:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B4CC19425; Mon, 27 Apr 2026 21:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323719; bh=z9prjR+BocYciwsUKoSOvL3HoAICSfSydNGV4GRnsv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WnOPnhM4B1ko9fyD8ARKNB5EjOOqmBTo637Opraic/e0moYWa2UX+G3yfg0Gp+Njy nOxzK0TLrO+siC0vSdSpzmzEhXGtmpSswl2SOYlHIPH+5KwJaQR3JmnbXGR9mObSmD b1mC0isdThXjAQCT/Yo2eQZFFz2TNUA/f/UBAaL1a8X/+6TFJQOWDBzUuW6wHVLx2z OfCAvS5zCG8bJKdlYr3bYKqIradgsKMfUgHGzYPGrWsrqVpx/+WJ9Qt1BOoRXaIJho HxH0+B6SU8vqJhQWvenfPXRJz6ECNJdUktexQ674qx+VMU2Gb5ca/btTrKulvf302A PehUlL/GKHchw== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 12/15] linux-user: Fix CLONE_PARENT_SETTID when using fork-like clone Date: Mon, 27 Apr 2026 23:01:30 +0200 Message-ID: <20260427210133.6016-13-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323776335158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller The CLONE_PARENT_SETTID option requires the implementation to store the child thread ID at the location pointed to by parent_tid in the parent's memory. Fix our implementation and move the code from the client side (where fork returned 0), to the parent side and store the return value from the fork call (which is the client TID) in the parent_tid pointer. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3340 Signed-off-by: Helge Deller Reviewed-by: Peter Maydell --- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d0390e04b4..910a4da0a6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7050,8 +7050,6 @@ static int do_fork(CPUArchState *env, unsigned int fl= ags, abi_ulong newsp, the child process gets its own copy of the lock. */ if (flags & CLONE_CHILD_SETTID) put_user_u32(sys_gettid(), child_tidptr); - if (flags & CLONE_PARENT_SETTID) - put_user_u32(sys_gettid(), parent_tidptr); ts =3D get_task_state(cpu); if (flags & CLONE_SETTLS) cpu_set_tls (env, newtls); @@ -7059,6 +7057,8 @@ static int do_fork(CPUArchState *env, unsigned int fl= ags, abi_ulong newsp, ts->child_tidptr =3D child_tidptr; } else { cpu_clone_regs_parent(env, flags); + if (flags & CLONE_PARENT_SETTID) + put_user_u32(ret, parent_tidptr); if (flags & CLONE_PIDFD) { int pid_fd =3D 0; #if defined(__NR_pidfd_open) && defined(TARGET_NR_pidfd_open) --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323954; cv=none; d=zohomail.com; s=zohoarc; b=KFxuGSiRDu2H4XzOk70oxxh97ZsELYwQS0wJlATzjGCnTFZDQVstE+fMsqaVMAd9vXoHVF5P3nQkTA3FbFy+MIKMv3mt3kuuSts/vcTKug6iUZlSHoolA5XkVuRGqkt9lD7n4N9pelhNEM2Kl6lVrziu34XBQ66cviOK6w0jtNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323954; 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=dwCdhjBe1u2enLQ7GE8O074qf3LgsuZ4K2Vt21ZZfms=; b=mf6BSkKgPCz2UxmPXkM/OP48MwScYi+QgMmVCqHDf0hTFLf7Cpu8TAeNzDbUP17quoEU8LGWqMzySRyM989WN0iDuWQUmcgPQrRkPnE4KOrf/Ha7Knkhx8lFwzThQH1i4GIJeP+S3NFXoShQjpkOuMKKMyxnBTsEFz07R1LCmgs= 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 1777323954580603.8027417181472; Mon, 27 Apr 2026 14:05:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5h-0000Xv-Ai; Mon, 27 Apr 2026 17:02:05 -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 1wHT5f-0000XW-QM for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:03 -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 1wHT5e-0003YH-4i for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:03 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 711EB60139; Mon, 27 Apr 2026 21:02:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2B85C19425; Mon, 27 Apr 2026 21:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323721; bh=srPndtwvrTUYJ7OM9qm9DxiqBEi9dXm+PHtlQXIamDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ePPn5YXJZ/w9UGEFV9qLj668RejUU+yjDjPWcCZLzkVCz50nW3cy2FnOFQOGI09IL /ZOtN+GFBP7fnhsJtJAmztmdtsL2DkEEdbpzBOVFmmjOGQAL7HmO3JNjf+5PlRbvGZ xWlVlnyKGKgKtCE0ueKcqnI7qHK1uD56o+bsoPh6wlr4SIN/33m0wFxl0ntwZLWn85 84KQ+yJ0aTMKw4N4jFxvkbw/KMu+PQ1xIXthZTiM20k+VgQKZNzUdfD8paL7KzyIUV zPzcPI0q3yGiQNkrG5U0NDr0G0faJ+uogsH3FjJ+10NXUm67o8V3BDpmIRlMddMBFc ieCVM4jVJSBGA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 13/15] linux-user: Use abi_int for imr_ifindex in ip_mreqn struct Date: Mon, 27 Apr 2026 23:01:31 +0200 Message-ID: <20260427210133.6016-14-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323955199158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller Peter Hartley noticed, that in the qemu code the imr_ifindex member of struct target_ip_mreq needs to be of type "int" instead of "long", which is what the Linux kernel uses on all architectures. Adjust the type accordingly, and add a QEMU_BUILD_BUG_ON() checker to prevent such issues in the future. This change should fix multicast issues when using hosts and guests with different endianess or bit size. Reported-by: Peter Hartley Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2553 Signed-off-by: Helge Deller --- linux-user/syscall.c | 2 ++ linux-user/syscall_defs.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 910a4da0a6..4594909242 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2161,6 +2161,8 @@ static abi_long do_setsockopt(int sockfd, int level, = int optname, =20 QEMU_BUILD_BUG_ON(sizeof(struct ip_mreq) !=3D sizeof(struct target_ip_mreq)); + QEMU_BUILD_BUG_ON(sizeof(struct ip_mreqn) !=3D + sizeof(struct target_ip_mreqn)); =20 if (optname =3D=3D IP_MULTICAST_IF) { min_size =3D sizeof(struct in_addr); diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 6967306be4..5799769f83 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -210,7 +210,7 @@ struct target_ip_mreq { struct target_ip_mreqn { struct target_in_addr imr_multiaddr; struct target_in_addr imr_address; - abi_long imr_ifindex; + abi_int imr_ifindex; }; =20 struct target_ip_mreq_source { --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323781; cv=none; d=zohomail.com; s=zohoarc; b=lC1SSyNa8gHXAsVXqKq41iqmY2szayJF3G7XQKS9UeqtQ7/4awA5bydJgJZyiqAPvDpltAMTjNdJ+2g52AbVi73UOqGbq+orlxjdD5jl+StUu6sxZv3cw3xu6IesYKFOXBVpX8p+e1p5t7SOErQUmw3xSd6A4g9mvXnKJ0o/OUo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323781; 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=TpliuFAMPKPIh++lxxVloHEV+Id7iP1FhWSz8tEe3E4=; b=hXCPcQU9HKiKMcP8mE7XaoPTOENDk3r8+a2PIyqxmyyu6vVpV5wKLZFIKxx2y8kpR21wABM4UXZj+21fU5kP2Z0QYb7YQYSFqoj4+F4o/xydHmn9G8ApMOjFv4JSkZW3HwWwcEyr/CQOkFyeg5I1j6yvecGkghOKUPddfax+TSo= 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 1777323781837110.7287780715834; Mon, 27 Apr 2026 14:03:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT5l-0000bq-UO; Mon, 27 Apr 2026 17:02:10 -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 1wHT5h-0000YC-QF for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:05 -0400 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wHT5g-0003YV-6Q for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:05 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 4FEB260138; Mon, 27 Apr 2026 21:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94170C19425; Mon, 27 Apr 2026 21:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323723; bh=eiCe2Z8GEP+H9O+Da1ktqEstW2+uT0RtWjxQoq92iKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W3OkbIPaSOB0Zp6sdHZBrJDPtTCOwJoQRwl+nDmiJ0yO55I7yAL4ooBJA0VRl8A79 wMsFY8s6xwfuLI89NCuqUXOJKPUP30Gntp9TLlXHSb4wx7I8M3hSHw4UKQ8R+2Sw1g mRDbZYK9nDtPvTCDeqzQFWbgPy5HkhLcmS2wxzBwhZ0tmPBwzJ1ifSUd5550CT1qvi wJOZM2aT3lhaLEVMBSol3xNJZzbQ780t+rBi/rSsnHFZywnRvjvwz8cxWNaVxleZHg 8dBNy9dOlwtGbqEaWXvgK6ST26/vZVRQwl4+KdqMLqOSoxwQ47fvjdKATX1RTnVehJ jFtZIaVu3pBiA== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 14/15] linux-user: Flush errors by using exit() instead of _exit() in error path Date: Mon, 27 Apr 2026 23:01:32 +0200 Message-ID: <20260427210133.6016-15-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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=2600:3c04:e001:324:0:1991:8:25; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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: 1777323782374158500 Content-Type: text/plain; charset="utf-8" From: Helge Deller Qemu user mode does not properly flushes error messages related to bad arguments when exiting (at least when the output is piped to a file instead of running on a terminal). Ensure that we always flush by using exit() instead of _exit(). Reported by: Tobias Bergkvist Reviewed-by: Warner Losh Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2544 Signed-off-by: Helge Deller --- linux-user/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index c49d1e91d2..86d04cca3c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -767,7 +767,7 @@ int main(int argc, char **argv, char **envp) execfd =3D open(exec_path, O_RDONLY); if (execfd < 0) { printf("Error while loading %s: %s\n", exec_path, strerror(err= no)); - _exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } } =20 @@ -975,7 +975,7 @@ int main(int argc, char **argv, char **envp) info, &bprm); if (ret !=3D 0) { printf("Error while loading %s: %s\n", exec_path, strerror(-ret)); - _exit(EXIT_FAILURE); + exit(EXIT_FAILURE); } =20 for (wrk =3D target_environ; *wrk; wrk++) { --=20 2.53.0 From nobody Mon May 25 13:47:55 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=1777323757; cv=none; d=zohomail.com; s=zohoarc; b=Nu3EE2on2o7x7tvK9RWyofFJPErQFeKLYgaXIHbdiK2k/iWdVEnFxmPw/95j/LWdxmo+LHTP4yoSyatJqLn4BtOEoZBRN6Gcb/bQlwwPoM1Z6LxpfmZ26DRgGLhv0kXtGPbMajOJGsWxPuyO3M5jX/m+80jRmE4TcIj2sW0O+M4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777323757; 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=2rGF19OVXTJxsbYiMUmuaIz38YUDG0JXQvBSJhEuy9A=; b=U6P/JfDvf43F5P3rtQGzjDrk+LUtLSDm020+3L/Y1xVG5UPDaA/Z8F+Y1MOM9eucTiM5xz7l5ULdcvtXLXf0f8v9zL2a1igGdUaQ/Ui+d+eEy8YqpPXn/Wi9tzOZtJtEaeZRQcaPC0T7v6wFDis1eaKX4wNI437PP3pseesZucs= 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 1777323757343149.53366956008745; Mon, 27 Apr 2026 14:02:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wHT64-0000jG-0D; Mon, 27 Apr 2026 17:02:29 -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 1wHT5k-0000Yk-1h for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:09 -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 1wHT5h-0003Zw-QV for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:02:07 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 32BC760139; Mon, 27 Apr 2026 21:02:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75F02C2BCB5; Mon, 27 Apr 2026 21:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777323724; bh=Q/iXGdIHYdJNB8woaida8AHWG6igtbbz4i/W4/TIG+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPPeiz5vQShGCy47FvY0yGjg61aN7GX78rlPmkT9RMEtGDLa+Yg1Y/nqGfA5aYE1f ICFlgNFWBlHXAQ11IS7Kq6RpY3xxLaoPyIdrrimXoIGC2rmVKmd1m4eX2xAiGVC4yN pusv3KkoSx/89/Ilb1G2EKSQVE51px+GYrMI5NRYQ182YDYry2F26hf9BqktStwXxH VJ4h1CrEFDWIq/vAt923RdArKzmxkWmjVT2ltKsSGQEfXGiXv0bc45FT4NzXlZnCTB fuDGgXgQ/AMl+5iI7iEXdLygyCWrPzLlBsNby2RZkAlLLlqaG1F8CD2CRZhHT+K4CU 7rXLUFTFdhjMQ== From: Helge Deller To: qemu-devel@nongnu.org Cc: Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Helge Deller , Jiaxun Yang , Pierrick Bouvier Subject: [PULL v2 15/15] linux-user: Add missing CDROM ioctls Date: Mon, 27 Apr 2026 23:01:33 +0200 Message-ID: <20260427210133.6016-16-deller@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260427210133.6016-1-deller@kernel.org> References: <20260427210133.6016-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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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, UPPERCASE_75_100=0.001 autolearn=no 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: 1777323758912154100 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add the missing CDROM ioctls and bring them in same order as documentation. Signed-off-by: Helge Deller --- linux-user/ioctls.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index 5b7d00e92f..aa485ee6e5 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -416,19 +416,18 @@ #endif =20 IOCTL(CDROMPAUSE, 0, TYPE_NULL) - IOCTL(CDROMSTART, 0, TYPE_NULL) - IOCTL(CDROMSTOP, 0, TYPE_NULL) IOCTL(CDROMRESUME, 0, TYPE_NULL) - IOCTL(CDROMEJECT, 0, TYPE_NULL) - IOCTL(CDROMEJECT_SW, 0, TYPE_INT) - IOCTL(CDROMCLOSETRAY, 0, TYPE_NULL) - IOCTL(CDROMRESET, 0, TYPE_NULL) IOCTL(CDROMPLAYMSF, IOC_W, MK_PTR(TYPE_INT)) IOCTL(CDROMPLAYTRKIND, IOC_W, MK_PTR(TYPE_INT)) IOCTL(CDROMREADTOCHDR, IOC_R, MK_PTR(TYPE_INT)) IOCTL(CDROMREADTOCENTRY, IOC_RW, MK_PTR(TYPE_INT)) + IOCTL(CDROMSTOP, 0, TYPE_NULL) + IOCTL(CDROMSTART, 0, TYPE_NULL) + IOCTL(CDROMEJECT, 0, TYPE_NULL) IOCTL(CDROMVOLCTRL, IOC_W, MK_PTR(TYPE_INT)) IOCTL(CDROMSUBCHNL, IOC_RW, MK_PTR(TYPE_INT)) + IOCTL(CDROMEJECT_SW, IOC_W, TYPE_INT) + IOCTL(CDROMRESET, 0, TYPE_NULL) /* XXX: incorrect (need specific handling) */ IOCTL(CDROMREADAUDIO, IOC_W, MK_PTR(MK_STRUCT(STRUCT_cdrom_read_audio))) IOCTL(CDROMREADCOOKED, IOC_RW, MK_PTR(TYPE_INT)) @@ -438,16 +437,22 @@ IOCTL(CDROMREADALL, IOC_RW, MK_PTR(TYPE_INT)) IOCTL(CDROMMULTISESSION, IOC_RW, MK_PTR(TYPE_INT)) IOCTL(CDROM_GET_UPC, IOC_R, MK_PTR(TYPE_INT)) + IOCTL(CDROM_LAST_WRITTEN, IOC_R, MK_PTR(TYPE_LONG)) IOCTL(CDROMVOLREAD, IOC_R, MK_PTR(TYPE_INT)) IOCTL(CDROMSEEK, IOC_W, MK_PTR(TYPE_INT)) IOCTL(CDROMPLAYBLK, IOC_W, MK_PTR(TYPE_INT)) - IOCTL(CDROM_MEDIA_CHANGED, 0, TYPE_NULL) - IOCTL(CDROM_SET_OPTIONS, 0, TYPE_INT) - IOCTL(CDROM_CLEAR_OPTIONS, 0, TYPE_INT) - IOCTL(CDROM_SELECT_SPEED, 0, TYPE_INT) - IOCTL(CDROM_SELECT_DISC, 0, TYPE_INT) - IOCTL(CDROM_DRIVE_STATUS, 0, TYPE_NULL) + IOCTL(CDROMCLOSETRAY, 0, TYPE_NULL) + IOCTL(CDROM_SET_OPTIONS, IOC_W, TYPE_INT) + IOCTL(CDROM_CLEAR_OPTIONS, IOC_W, TYPE_INT) + IOCTL(CDROM_SELECT_SPEED, IOC_W, TYPE_INT) + IOCTL(CDROM_SELECT_DISC, IOC_W, TYPE_INT) + IOCTL(CDROM_MEDIA_CHANGED, IOC_W, TYPE_INT) + IOCTL(CDROM_DRIVE_STATUS, IOC_W, TYPE_INT) IOCTL(CDROM_DISC_STATUS, 0, TYPE_NULL) + IOCTL(CDROM_CHANGER_NSLOTS, 0, TYPE_NULL) + IOCTL(CDROM_LOCKDOOR, IOC_W, TYPE_INT) + IOCTL(CDROM_DEBUG, IOC_W, TYPE_INT) + IOCTL(CDROM_GET_CAPABILITY, 0, TYPE_NULL) IOCTL(CDROMAUDIOBUFSIZ, 0, TYPE_INT) =20 #if 0 --=20 2.53.0