From nobody Sat Sep 6 14:40:40 2025 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756981439; cv=none; d=zohomail.com; s=zohoarc; b=n14wuwIQvGsG2XDDsY64i/xRKD3bf9gAETaImh8Hh2AdkUVcbmz4nAt+cn4zgFDJjn7JfVsqJw1SB+n/nnUkw/ji87Ia6O2UkVIOoMXR8ebCpxt8QI1iyYJopjv6ROMaYckgQB2h8fD5LxeScFvuqe7lJg7hKs+xirv2w3o13Xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756981439; 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=7zfQ6Ek+RL90OKpISh7ii2ukdZCuPaJC9b2Qi7cmtOQ=; b=knKiBeHlsdq9QkrouMByeNdLAWX7R0XmjB26/s2BgqJE+yJvke+zwj1EOdRDWIsSzuT6K7wzjtRc5ag64VXBjdg1VxgZKDViHerjX5wob5msREROb3S6J10qYWysQ+PUrwUIZxkotgXI0fHbsb3NE3P+3lJVi1d/VQovXlZ/1oA= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756981439789622.6026545489473; Thu, 4 Sep 2025 03:23:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uu77n-00004s-UW; Thu, 04 Sep 2025 06:23:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uu77l-0008W0-Mt for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:25 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uu77f-0005Pd-0s for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:25 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-45b7d497ab9so8490225e9.0 for ; Thu, 04 Sep 2025 03:23:17 -0700 (PDT) Received: from stoup.dot1x.polimi.it ([131.175.126.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b8f2d3c88sm147699195e9.19.2025.09.04.03.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 03:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756981395; x=1757586195; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7zfQ6Ek+RL90OKpISh7ii2ukdZCuPaJC9b2Qi7cmtOQ=; b=zYRj6C1NVb+Mn1RiwrPSdXWCiLm7ZC+haXboNmTxoh1SVFyv0WJ2rpVRH+gPHVwsFH AOqdJe7e3nuqelQjZ9zuAzk34wbRJB0IuRAxQTqOQ0D+ZIqqwA6ztwdjQPeIsbwkL94U 2+Yf3SWiPeZ22pPSNgc5YFMOT4Urw+PaMU89wmDY/yPruKe/Juxj+Zm5pVWGp7pwybKk dkven+OHbsfpIdQsuGJ1ACnUVIZuLl/kiUeY57mpPo/FdJFmWhfq/H1uyMx+zHJ6THeV ZZ/gzmkvX8Kj9ucr+Zii83o6Vj6lHPpdtCyOyQBxp2SO5/0y8xNtBTM/o7F/U759nJvh JqMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756981395; x=1757586195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7zfQ6Ek+RL90OKpISh7ii2ukdZCuPaJC9b2Qi7cmtOQ=; b=D5f3Fx9sdHQfJ7++QvUiZY9MJvXZMUUW/76+rgZidFXkWnqjOAUYZd9l7c4Ep3q4e+ uh2vthMYharYzNcq6gQvL76GAIGJgIiOnXzvJgFG1ee0T1bfpsGgm/FsW2h+1nCa2DxC UZ/TG1Sd86LsMNgGRUrxpZGGdQuzAortk7kExvDNpzs6b5ICHxHTHvB7Vh1efj1IXljV ljXvo9X/vV8wP7bPrHVg2SoGNd5xH4E/zEYnc2ia080Rod5Hr31QXJOd05bTNp2J3Ao0 N1gpV7YLjck1EJAaKy8BqMSpA0IpCOYFDAZ+KPMk6HVoF+Zkkki9NTu3U5ZwELyv7EDZ bMbQ== X-Gm-Message-State: AOJu0Yx1SWHwAErtDsSpD4Q3+EDEw/cnlcWOQHcoqr5NogTO7Y59AuUw 1lm1MXHg7LbKjhhslpFeyCcKBLNSkrm38ewcM2j8DjIalGauy1TfqyCqixCKXCAL+mXYJj2aBlK ZdhV9HYg= X-Gm-Gg: ASbGncubkmhUE/T2Z9YLK+bUNOmJBZ92IhPD/rYcvr8tEs0dyXgvbWWBHlwd5zhRaZP qSr6cvbXyLBKP2WofiGarQFtQWCTlwdWC7zAkWGez1SElwLr1iGFsD7fah4su9ua2HCkc5RTrxw Vz/VVp0ArdI2LsUoo3V22PZ2G3gPG/GRKb+lOQ0lI70ZAOxHMEmyvIoHnvn0tRFqyB+c9TZ3ySj LSg5vTt9hqJ3Z43/TwZeIxGGj9J7ZBHDpBLkLqAlBmHGntsQ6c1VnrrQWxu03C6rSw/zd+59gxB aoOGII7f2ZEBLeKj84Ae3X7flJclDldLgcPCkjTFP4ahu3+2d3qePApuzqwUUMswhGU7BIezUTw R6jQubQFf0xXzBVv1a69Z4VISSvKctBDTpig2tn6av/9dew== X-Google-Smtp-Source: AGHT+IGG23nqhZgh192viZNi89MCWHQjxifHZaGZoTevO72THq/mZGdF99KtNEHYJ/fg8V5GJl24MQ== X-Received: by 2002:a05:600c:a43:b0:459:d3ce:2cbd with SMTP id 5b1f17b1804b1-45b8556a7acmr152296125e9.13.1756981395081; Thu, 04 Sep 2025 03:23:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: floss@arusekk.pl Subject: [PATCH v4 1/4] linux-user: Create vdso_sigreturn_region_{start,end} Date: Thu, 4 Sep 2025 12:23:07 +0200 Message-ID: <20250904102311.57383-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904102311.57383-1-richard.henderson@linaro.org> References: <20250904102311.57383-1-richard.henderson@linaro.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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @linaro.org) X-ZM-MESSAGEID: 1756981441149124100 Content-Type: text/plain; charset="utf-8" These variables will be populated from the vdso, and used for detecting whether we are executing the sigreturn. Signed-off-by: Richard Henderson --- linux-user/loader.h | 2 ++ linux-user/signal-common.h | 2 ++ linux-user/elfload.c | 5 +++++ linux-user/gen-vdso.c | 6 ++++++ linux-user/signal.c | 2 ++ linux-user/gen-vdso-elfn.c.inc | 7 +++++-- 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/linux-user/loader.h b/linux-user/loader.h index e42b8fa1e3..da9ad28db5 100644 --- a/linux-user/loader.h +++ b/linux-user/loader.h @@ -117,6 +117,8 @@ typedef struct { unsigned reloc_count; unsigned sigreturn_ofs; unsigned rt_sigreturn_ofs; + unsigned sigreturn_region_start_ofs; + unsigned sigreturn_region_end_ofs; } VdsoImageInfo; =20 /* Note that both Elf32_Word and Elf64_Word are uint32_t. */ diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 196d2406f8..0b04868727 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -25,6 +25,8 @@ /* Fallback addresses into sigtramp page. */ extern abi_ulong default_sigreturn; extern abi_ulong default_rt_sigreturn; +extern abi_ulong vdso_sigreturn_region_start; +extern abi_ulong vdso_sigreturn_region_end; =20 void setup_sigtramp(abi_ulong tramp_page); =20 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 26c090c95d..28f0909d1a 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1659,6 +1659,11 @@ static void load_elf_vdso(struct image_info *info, c= onst VdsoImageInfo *vdso) if (vdso->rt_sigreturn_ofs) { default_rt_sigreturn =3D load_addr + vdso->rt_sigreturn_ofs; } + if (vdso->sigreturn_region_start_ofs) { + vdso_sigreturn_region_start =3D + load_addr + vdso->sigreturn_region_start_ofs; + vdso_sigreturn_region_end =3D load_addr + vdso->sigreturn_region_e= nd_ofs; + } =20 /* Remove write from VDSO segment. */ target_mprotect(info->start_data, info->end_data - info->start_data, diff --git a/linux-user/gen-vdso.c b/linux-user/gen-vdso.c index aeaa927db8..d6a2cdaa83 100644 --- a/linux-user/gen-vdso.c +++ b/linux-user/gen-vdso.c @@ -36,6 +36,8 @@ static const char *rt_sigreturn_sym; =20 static unsigned sigreturn_addr; static unsigned rt_sigreturn_addr; +static unsigned sigreturn_region_start_addr; +static unsigned sigreturn_region_end_addr; =20 #define N 32 #define elfN(x) elf32_##x @@ -215,6 +217,10 @@ int main(int argc, char **argv) fprintf(outf, " .reloc_count =3D ARRAY_SIZE(%s_relocs),\n", prefix); fprintf(outf, " .sigreturn_ofs =3D 0x%x,\n", sigreturn_addr); fprintf(outf, " .rt_sigreturn_ofs =3D 0x%x,\n", rt_sigreturn_addr); + fprintf(outf, " .sigreturn_region_start_ofs =3D 0x%x,\n", + sigreturn_region_start_addr); + fprintf(outf, " .sigreturn_region_end_ofs =3D 0x%x,\n", + sigreturn_region_end_addr); fprintf(outf, "};\n"); =20 ret =3D EXIT_SUCCESS; diff --git a/linux-user/signal.c b/linux-user/signal.c index cd0e7398aa..804096bd44 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -50,6 +50,8 @@ static void host_signal_handler(int host_signum, siginfo_= t *info, /* Fallback addresses into sigtramp page. */ abi_ulong default_sigreturn; abi_ulong default_rt_sigreturn; +abi_ulong vdso_sigreturn_region_start; +abi_ulong vdso_sigreturn_region_end; =20 /* * System includes define _NSIG as SIGRTMAX + 1, but qemu (like the kernel) diff --git a/linux-user/gen-vdso-elfn.c.inc b/linux-user/gen-vdso-elfn.c.inc index b47019e136..c2677a146c 100644 --- a/linux-user/gen-vdso-elfn.c.inc +++ b/linux-user/gen-vdso-elfn.c.inc @@ -84,9 +84,12 @@ static void elfN(search_symtab)(ElfN(Shdr) *shdr, unsign= ed sym_idx, =20 if (sigreturn_sym && strcmp(sigreturn_sym, name) =3D=3D 0) { sigreturn_addr =3D sym.st_value; - } - if (rt_sigreturn_sym && strcmp(rt_sigreturn_sym, name) =3D=3D 0) { + } else if (rt_sigreturn_sym && strcmp(rt_sigreturn_sym, name) =3D= =3D 0) { rt_sigreturn_addr =3D sym.st_value; + } else if (strcmp("sigreturn_region_start", name) =3D=3D 0) { + sigreturn_region_start_addr =3D sym.st_value; + } else if (strcmp("sigreturn_region_end", name) =3D=3D 0) { + sigreturn_region_end_addr =3D sym.st_value; } } } --=20 2.43.0 From nobody Sat Sep 6 14:40:40 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756981509033130.55813696860503; Thu, 4 Sep 2025 03:25:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uu77v-00008A-9f; Thu, 04 Sep 2025 06:23:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uu77t-00006y-1M for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:33 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uu77i-0005Pk-C0 for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:32 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-45cb659e858so6887055e9.2 for ; Thu, 04 Sep 2025 03:23:18 -0700 (PDT) Received: from stoup.dot1x.polimi.it ([131.175.126.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b8f2d3c88sm147699195e9.19.2025.09.04.03.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 03:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756981396; x=1757586196; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=updEquFTYNbXcHlBVDd6fTmOXTS+3MFAS45UOphconU=; b=A/KqPJbGuWp16IGrZJoirl7DN8zJE5Dn6K/g6rxImbINz0Nu22MFe2AVVZW0YYwN9o WYjnMBrDnfP4S/Q3KI+yvZ+gDvECegmxrVM/732VpWuxkoEpQnLiZV2OORJhrHBov7y1 vr+H/0PQnrFw5w864svmtA0tqK67kJjgifolQ3rOuXKKem/iAMRN9OGjU37zhbryX5ue Itct5C8vplgGoGc5Kr8bKecRuNUq4ic3kfPFLrFAiNMVfKgnCSn/hPQFuW1BEKwyoUsy lfcBC9eB9qS6atEjwh4yPSYQ+Hdn6jHkh005WJCZyq0384rxPsG66ip6u6bBR64ABC9n RQNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756981396; x=1757586196; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=updEquFTYNbXcHlBVDd6fTmOXTS+3MFAS45UOphconU=; b=CQJaQ520z9MW++ooiXN4ENZPcvQL+lUoM7y3Nd+u7F8A7wxNPDl3SfMdNb2WLD42EC FM7A92eOv9Kseu/PF0OLX0jhcHkRuXtiCF9lchfulsJK4854fQjufYXF4PgCTg6Lo+GE ZY1xb28Hwolg+Zf2zExIGJ4l6BaV+pnTHIdFabkdkeNCbrJGY19opaTqRBJ9zz/ZX/sN ky0JNuzVA/zFuVp6Gg/6+VhEHa8eFUnQRMZEUDLhfu4DXH6zMwnXzEx691drnYGEIDr0 tguEajHiuJdsXz5ckqr1MVTofBkaFeoCezHWr3C2BiKzMFS3ufPci3hFdjO/DYrbue94 hIng== X-Gm-Message-State: AOJu0YywevrfDEbedKW3YEK4iFarowAE62oyrCx+TIkedNgo4KAqXkUY zPJtVYASh1d4XDWCRqdcfy6Tng1eF82wMxodF054kOP4jZVT9V/+8GfkPqJ4mIxgF1DhNtfW4sb 5QsMfLRE= X-Gm-Gg: ASbGncsIHHyE0Sk3Y3tvKplUaUSI/XfOonx4v1IhKZT+cjWTibMTU9PMutsiXprGMVi 03DBLB12RGz6jWPyHDWm+V48jB6b7haqm7NcvnOcrv8ySPNuP6MW92niREurice+S9p8ruu6b4f fxia4+dT2CdcBUGHwzHDGt73uWdKtPkIGNOMVXAoZWjt92JDdCV+8aodtaZ9B1H4FPYvtkTgzeQ WeV7Kq27hQ1E4CbV7cxCAIBiV77XgDFFHnxAmxO948SenP3Rzi6P4ihnHEeWEKVcn06p37aiFhp 0azitb0Tg1rBwZTTMWtfQCySezJYW9lC4RAkah8qDX62h6kgR9fZGMS3NzeZovxIr69xWejXjiM KYFseE8gyI/boQd1mEesnhMR8ERRIIlxN2qRRS4imvRpKsmWonLrkgcRX X-Google-Smtp-Source: AGHT+IGyz5/w1czOcMwStGo4u8wKeLM7Vg6N+pIRPJrmBEzkcXRK9lUrmxiwD8f7212Ppil54iw7JQ== X-Received: by 2002:a05:600c:3541:b0:45b:8a0e:cda9 with SMTP id 5b1f17b1804b1-45b8a0ecfbcmr117867925e9.2.1756981396078; Thu, 04 Sep 2025 03:23:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: floss@arusekk.pl Subject: [PATCH v4 2/4] linux-user: Populate sigreturn_region_{start, end} in all vdso.S Date: Thu, 4 Sep 2025 12:23:08 +0200 Message-ID: <20250904102311.57383-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904102311.57383-1-richard.henderson@linaro.org> References: <20250904102311.57383-1-richard.henderson@linaro.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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x331.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756981511690124101 Content-Type: text/plain; charset="utf-8" Mark the regions which contain sigreturn syscalls within each vdso. Rebuild the shared objects. Signed-off-by: Richard Henderson --- linux-user/aarch64/vdso-be.so | Bin 3224 -> 3320 bytes linux-user/aarch64/vdso-le.so | Bin 3224 -> 3320 bytes linux-user/aarch64/vdso.S | 2 ++ linux-user/arm/vdso-be32.so | Bin 2648 -> 2724 bytes linux-user/arm/vdso-be8.so | Bin 2648 -> 2724 bytes linux-user/arm/vdso-le.so | Bin 2648 -> 2724 bytes linux-user/arm/vdso.S | 2 ++ linux-user/hppa/vdso.S | 2 ++ linux-user/hppa/vdso.so | Bin 2104 -> 2224 bytes linux-user/i386/vdso.S | 2 ++ linux-user/i386/vdso.so | Bin 2672 -> 2792 bytes linux-user/loongarch64/vdso.S | 2 ++ linux-user/loongarch64/vdso.so | Bin 3560 -> 3712 bytes linux-user/ppc/vdso-32.so | Bin 3020 -> 3140 bytes linux-user/ppc/vdso-64.so | Bin 3896 -> 4048 bytes linux-user/ppc/vdso-64le.so | Bin 3896 -> 4048 bytes linux-user/ppc/vdso.S | 2 ++ linux-user/riscv/vdso-32.so | Bin 2980 -> 3124 bytes linux-user/riscv/vdso-64.so | Bin 3944 -> 4104 bytes linux-user/riscv/vdso.S | 2 ++ linux-user/s390x/vdso.S | 2 ++ linux-user/s390x/vdso.so | Bin 3464 -> 3616 bytes 22 files changed, 16 insertions(+) diff --git a/linux-user/aarch64/vdso-be.so b/linux-user/aarch64/vdso-be.so index d43c3b19cdf6588757f2039f2308a8bce21aed9c..4089838b30535738e89252a146a= 039af54ed8be1 100755 GIT binary patch delta 372 zcmbOs`9pGoKI4y#1`&)RyJD|o>HWC-e5%H5Ca1P4-f+Z z%LfPzCN+U1O#I8_0yb-3J4S~8A0a9j7eHt*=3D?)~hAbgezB=3DIPOdS(wK@d81hITIU& z>uZ5_!>qUgRUiPQCnJf!fr@hg>6J+0JCM}xM-o2)7f(($@JUXqDAdbmP)T7>sbDD1 zOfO0;DJ{y2FG@|%%+HgKFD^+eD!~wsPt8l&T*;oqIB^2Y=3DGz=3D9%$y5=3DhVlWi_+$;zG-qO?aDAW<0|O6K;|-_+0U(`@B>n~} z&H%?iU*Gy7?J< qAme6hP8DX(0-!EFAQqjR!K2Ta0X1XQSxE{t}Xmv61yy2m1;okeN+zms!1<2TP?yu+d>!~g<33?Ep) z3^<_)X7Mn5nViXHFKGwlF*1Dozkm_00L*Zoe2`6CG72i|!Hg{!IA<+TPzY$l zjmeJe;*)PM2{5jl%*ZUxxPNjWyOdRaibY7VlU_c9N(zHY1w(OWdQoagX;EH$QEGZ- zeqMZWNn%k6rf_Or%H~S;c*cnnST^6_P+;a=3Dzyz_I4@ikmX64c5oWTwexiSxrfSl257}AgzHD2Uk@GeFM#i?fJDcY)-eH-%g3Uluh=3DGBD zk>TV21&lxj5|Ez!kxg7u4=3D4hX^dyyqIfNkk=3DK=3DYtKt30gzX`~XM({ltP67o2;R4CYRh3x*p%!}i3@RlI z#hK|vsU@XFdGST5>6!U?@x>*HMOcJW^HMgKu{APtUH}@z55y9axTIM-fQ);S6}Xf| O(}1igKnw$nAO-;P2tZ~4 delta 232 zcmZ1?dP8J_GUJAcDhEV9iF@2Qn5bfLZGwFE!TAAV%KxoCZv1hKW%4~%*?J)c28JI% z%)rR-|09r+W?*1x1kwsj3=3DBL#TAP7^2`mp}a{;j(P~{CE4O1TiVuOGnM1LGme?E}Q z0W=3Dt-zX-@r1=3D3tlejAVdyyqIfNkk=3DK=3DYtKt30gzX`~XM({ltP67o2;R4CYsV*V8W`=3DtC3@RlI z#hK|vsU@XFdGST5>6!U?@x>*HMOcJW^HMgKu{APtUH}@z55y9axTIM-fQ);S6}Xf| O(}1igKnw$nAO-;BYCz-w delta 232 zcmZ1?dP8J_GUJAcDhEW2jvP6cAn`ta_SEXT7Yg+lW8zuPZ2WPIW%4~%*?J)c28JI% z%)rR-|09r+W?*1x1kwsj3=3DBL#TAP7^2`mp}a{;j(P~{CE4O1TiVuOGnM1LGme?E}Q z0W=3Dt-zX-@r1=3D3tlejAV+%m4rY diff --git a/linux-user/arm/vdso-le.so b/linux-user/arm/vdso-le.so index 38d3d51047372391b3125c3f9f6ea5401f04bba1..d34e577b69e6cb22a90982570d5= e66a1fa22e195 100755 GIT binary patch delta 309 zcmca1vP5)(0^^^Fiibto-btLS^tfAl`qJz2U8lY?Z_Q&mz46Bp7TE?C1}NZRPy@0S zAn~my?_`y)w*!j)fU03+`1s!)$ZiCxQUKCS3_J|sK>7z0kN^WNhAbd`gAu|5sc(QV z!K5IN-vwml1NCzNX(6Egc|bZ9$mfFcHv#Er1mBzCBv2p_A;7?poNQne6;a`(m(QS5 z!cd%iibs{A2M=3DDJTKY)!fEEqs*sO2HQxVB+W6xL%j7$(GW9|X3=3DBVj z7z7v@KK_>m(v2((3<^M+iGhbf8%Y0P0uo@r#b5`dZ!ki5AoU>-CYTfi^5cN4e4u^~ zAT0#cUj(F6fqX6~zYR!7Blz+RbAbYZ2muC$X+$tBI2!N$O_Y4Sua;mI{z0*q3Vd%45`Chsqh diff --git a/linux-user/arm/vdso.S b/linux-user/arm/vdso.S index b3bb6491dc..d84d964730 100644 --- a/linux-user/arm/vdso.S +++ b/linux-user/arm/vdso.S @@ -140,6 +140,7 @@ SYSCALL __vdso_gettimeofday, __NR_gettimeofday =20 .balign 16 sigreturn_codes: +sigreturn_region_start: /* [EO]ABI sigreturn */ slot 0 raw_syscall __NR_sigreturn @@ -172,3 +173,4 @@ sigreturn_codes: =20 .balign 16 endf sigreturn_codes +sigreturn_region_end: diff --git a/linux-user/hppa/vdso.S b/linux-user/hppa/vdso.S index 5be14d2f70..a6f8da2981 100644 --- a/linux-user/hppa/vdso.S +++ b/linux-user/hppa/vdso.S @@ -156,8 +156,10 @@ __kernel_sigtramp_rt: ldi 0, %r25 ldi __NR_rt_sigreturn, %r20 +sigreturn_region_start: be,l 0x100(%sr2, %r0), %sr0, %r31 nop +sigreturn_region_end: =20 .cfi_endproc .size __kernel_sigtramp_rt, . - __kernel_sigtramp_rt diff --git a/linux-user/hppa/vdso.so b/linux-user/hppa/vdso.so index e1ddd70c37e9eb6871c21d538dcce0a1e736a918..68baf80fd3943cc2d847744f136= 37810788fafc1 100755 GIT binary patch delta 287 zcmdlXut9Kw5)+%jM3n;~wM-GFSH2~uzvW>xy0IuFLc1|}=3Df)rNnd=3D!qfQ8}zMD-eV*Sd?APT7Vb^7(omG-ZjNUA!li diff --git a/linux-user/i386/vdso.S b/linux-user/i386/vdso.S index e7a1f333a1..8df77b5a94 100644 --- a/linux-user/i386/vdso.S +++ b/linux-user/i386/vdso.S @@ -114,6 +114,7 @@ vdso_syscall3 __vdso_getcpu, __NR_gettimeofday */ nop =20 +sigreturn_region_start: __kernel_sigreturn: popl %eax /* pop sig */ .cfi_adjust_cfa_offset -4 @@ -128,6 +129,7 @@ __kernel_rt_sigreturn: movl $__NR_rt_sigreturn, %eax int $0x80 endf __kernel_rt_sigreturn +sigreturn_region_end: =20 .cfi_endproc =20 diff --git a/linux-user/i386/vdso.so b/linux-user/i386/vdso.so index bdece5dfcf8da036d013262d4e37208350283cfa..e01c3818d0d2e4871cf39b2ddd2= 1043d0695d07e 100755 GIT binary patch delta 444 zcmew$@=3DkzJ5{@jp{@LTJl;I7NjX(ad)H6T<3&Y3%JV5q2 zR+tDkgEEkL4~Y+x0ns4!7C`z3RFIK@iNO)b=3D3s#eFmN)2z?eW<5U4&5NQVH;V+PVf z4BQL_3=3DH)QlYs&vP=3DOX8y&cFGgYqWg9x-u{<2MP#41sIZ(!&1}2ybbm88HzL0i&9HUi}K=3D&Qqwc@ z^Wuw35{pVOg;VoVHXmSXVBBoaah6d_fsuiM7ib#DiJ+hWnal~qAV0$aP*RX_vKg0> RgdorOeY#m4Sg7NDDD=3DGgt!Y$w0mclYp!s=3DSQWathS7noo`vD#e+D$b z1LpHE)UcsSC_}{?(8NK)*vzp2iZcSuZ(sy#gcFW1aW;m@x7m3mqroy<3?EqFO2CY~ z$&4K0j4hJ|nZ+4rOfCeH%O*Pl$z78ZIm9K;0o4dG@Gt~GT?2771HsGt-MwOG=3DCK;)_z#GxPJ}i%SxVN-%{}^HMgi;Amjntj?v#%-g{PaSR`j a5}h2%tIf&52@!cWxs%tN@!RBsyy^hfi%Eb0 delta 205 zcmZpWeIY$TgXsn5MlCx=3D5mA9%)#h=3Do$th|*U-GxV_f~Om__Vo((Sc2rk>TV221W)H zz%|*BLtIh?EXKv~fdxg9!F+Nehd86}WI<+e#>B~mKr(-_Bam#Kd=3DRK>I#96?0}n$0 z8$=3DfmRP&n2A2}p8J8;%BZa%=3DJz|5<`1d-qaQi7A;@@jLg;DCs1pRCAd&Kb`M;k8Uo Hjenet|GUJhnDhEWA#S8BnzBO%iakv;8rJgEnt>YiE@dr0sJp%}^F#P`rq<9z@ z*d)LLU^as?kgtQphce;nEr0?)K!S`63`{`Ek%58v4Tui}TtFNG6xIN7fbuLrDhtF0 z0YQj;iaYlTCGNaE#l>;J~u3G}Hz1nkb!uCykg)t8^X6|Be-uQ!?t^NlC5HK<@Faaqp z1_tIgAU+TP*$lEkVGR%mD9-|j@-*l|TgoKt2mp!+s!N0?B}DKnp+)h8ge#$iD*PZ+7Nb o&A9nJ=3DNCrK1wb)AAQqVXhFgk_{S1)#domA?5);Sq$p$DOEI@iQk~qvq96<3?5b;=3D$QuZw%5(q#R-$2qZ z0W1m#Eh#O^i!Vw|&&jGKjdRG2w6fMR?=3D%s<(I YUyqCP2UN+9$rb!&Ok5i#Z{Sw|0MvRWxBvhE diff --git a/linux-user/ppc/vdso-64le.so b/linux-user/ppc/vdso-64le.so index 424abb4290b7d3100e9dede2f3059483608ba703..22499d2701530ee2aa003ae5fec= ce695441a5f77 100755 GIT binary patch delta 383 zcmdlXcR_xF2IGZ|n)Zw$d#8TmX85vf$%g!(v+1T^wTi0NT-{v5IDx&Mh2i6W1~k9} z=3DJPO|U`LfuhKgT669)-nGsglb&d9*T(7*`R2qzrDEG~u@EDV#iIe8^RfP6tL?ns>c zkx5*#5GX6az{4;HYAeKb3=3DHj)6`92)=3DR#!um3a93!Z2rO7z__`bTalT! kg9&0bACMBByp&IyGlB~u@_zD7K66fYZV0bsvLvrO0GX9Yi2wiq delta 220 zcmca0ze8?<2BXDBO?yU>es=3DTCa!hWME=3DwU}Qi6 zT$39)#U*8dVuB1G|D#9&Ia-rHGKouC0a*eJJPdQ#A@V#>WdV~FnZ+g3pt1*`vMf;9 zn#qD(;*66gA7qlA9KtNRc>-5G<7NRK1!i6iCWsO~AjLn~mS3Cm2PZ^i$K*nObIuK1 L5MImVjlA*zt)(a1 diff --git a/linux-user/ppc/vdso.S b/linux-user/ppc/vdso.S index 2e79ea9808..e9256a2dea 100644 --- a/linux-user/ppc/vdso.S +++ b/linux-user/ppc/vdso.S @@ -220,6 +220,7 @@ endf __kernel_sync_dicache =20 nop =20 +sigreturn_region_start: __kernel_sigtramp_rt: raw_syscall __NR_rt_sigreturn endf __kernel_sigtramp_rt @@ -235,5 +236,6 @@ __kernel_sigtramp32: raw_syscall __NR_sigreturn endf __kernel_sigtramp32 #endif +sigreturn_region_end: =20 .cfi_endproc diff --git a/linux-user/riscv/vdso-32.so b/linux-user/riscv/vdso-32.so index c2ce2a4757900a16b891bb98f7a027ac30c47a5f..4818a994f0394d83ca5e8213f6e= 2d2d3ee2f504c 100755 GIT binary patch delta 447 zcmZ1?zC~h!0#gs?L?tIipNXmSMas5*X}YtK&*i=3DK5rz{7_FXjfZHe71!C1(`Ah&Y5~ zVfgsJ6v&idgzy=3DG{5l|W0#rSSKLg00!3>dSVBlg{4P-hnLHHo~gD@!|Ey(b({{I;u zqXcLG2apzG;9+B(DYJ2O#kol9OHh zi$k)E^zs>0DvHXCjWUf24C8Z+3Jl^CjV7;TRWyZ%3PW*bdQoagX;EH$QEGZ-eqMZW zNn%k6rf_Or%H~<@U5uNRIKMG6`b?h4Ej(F=3DTY&cp(BcO`2k-+OD?ZtiTbgYPI|G9~ P;G_8jvml>gNE`LJT|%RY3X&3j;$0l-~!WGl23u5WYRb z93Z0sNy7#pKL(+I;Rui)fW&7=3DPEO1*3&{4=3D%V$uj*sQ_P#khG3=3DNCps=3DgEpZ!jt!K m3-F!+Dn9`96Uc9(lW%fMv-YqvFx&*o^Y92TrcRdS5eESNR6iB~ diff --git a/linux-user/riscv/vdso-64.so b/linux-user/riscv/vdso-64.so index ae49f5b043b5941b9d304a056c2b50c185f413b0..cc6f7e974be67bd08ed412eccb9= af22138385e56 100755 GIT binary patch delta 453 zcmaDM*P$>$gYm>f&3s0mjWgL9MZUOZ%%7)STEdup@5PH(j}Av>WiW2u!l=3Dl~mu)4hczqpe!T9$NxJRfea)dF`1E5T+#?E z!o{G#iX;VOx=3DuC(%0>fOfBdakV2*m2=3DQkG9)Kwn!34I1nK27s8noD;abGFnS)1x8RF~7HvB5066_FD m7cfC+kat8Um-1_K?%;%o+ysTtULZ3;kBLiRqk#pZh})fO-I~!HOHa>f*qfa!daD0cMEm9%#s{n{EDZlYPHYr5 z0V*y5r1uCyyqa;M|Y2gD+ifAHvYu7Dc+d9neoIp=3DIBuVr!pw*&xqqDfc) delta 305 zcmZ1=3D(;+=3DUkBPHmqk#pZ$eP<0^W+mAZmVidw^)#U>fWD6>!)n4VSK<^&&crqBLf&P zHb7`F$ps`q7zkKiKxi;2i%`$(fFy1##K6D<;j_VnWq=3DH4ggEOHs02tn5-P3>WV6XZ zC76J8K9YtFP;m($-6{xl=3D)^{0-AM=3DqY#@_B0Hkp#LY(ykSd@W5X7hcHX2#9QTq?|* d8bC2VAQqTBfmff?1FB-r Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756981451015889.923371252821; Thu, 4 Sep 2025 03:24:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uu77u-00007Y-5j; Thu, 04 Sep 2025 06:23:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uu77q-00005o-Du for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:30 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uu77g-0005Pt-Gi for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:29 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-45b88bff3ebso6228215e9.3 for ; Thu, 04 Sep 2025 03:23:19 -0700 (PDT) Received: from stoup.dot1x.polimi.it ([131.175.126.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b8f2d3c88sm147699195e9.19.2025.09.04.03.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 03:23:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756981397; x=1757586197; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5sVOgytoa7Rgm1zLxtei1J/KNHixNy8iKKKriI6vpRg=; b=yLmuIn1JM7FLfL+HRbYk3qaXbX8daSlSvnr+KnkBbNJZyN/E8KJ7IXhXo/BaJ5herr 4bUNrXkruwHpXY87hhxnzLUxtlIIBUCBFMP+zHmNCpvcRCq46OAYLA7a5yOdt0Fj2/46 VBjTY5vG50dHCDWtuIg4F0S0whX4rVCrbbimZlJWP1vtyGaRlXdDCJX8Vz76+qYaPKBx +kiBHsbGp5ScZv0oeIrjn3P4U3vjRj76rYi48qlK6FOct4UaK5WL8H0Jv71deHE6kFck mS8kR6NJs4QiQi7HQ5MToDHdS9cnKwTAvEirs3Xt38RU1qHakit9EsbhfZ09v440xCtC Dlvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756981397; x=1757586197; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5sVOgytoa7Rgm1zLxtei1J/KNHixNy8iKKKriI6vpRg=; b=XnEneGdywpscIcZMNQcXiUWVOrIqrjYSYpD480c8SDu6z60P5zB3zMINk/FUUnKRKd aHULSN1JHnxuFYi7Kiz0jySHKoOaLpJpFsnrUbCTiSIlHJtxLzkh/BND+B3V4ci5v73j 67P75AV4UK5WmsUKRIl8eQsBugFVYDrbEjcFSoclPDbgyzRsiRP9LQk0gXT718L57HAL +QV3t+Rqa5PTjd0DmMt54I1bJTfa4vd0mjuLpfg/saH6wWEKmmEmfhfCKV+dtyaiAkKY Zo4DFVkpD3UcqKqGPZf/OuzmaKlu264x77hCroMYLQQDvslbxgZkCfmUntO2yWphaFiV dqwg== X-Gm-Message-State: AOJu0YwcQJI/+SKBx9PyEZSSyHny9YhIGQn5ei0ueHcIgc0VdsckEFrJ noUzu04JzIwHulxS+w8VlolsysN1Zy2GMffsiM7C7fKr84lfeNX8ijDSfAYAmCvl2G/BV5rmq6R a0xNCGr0= X-Gm-Gg: ASbGncv7brxrjvimaq7T8bdSd0rCVe5lDatOJq/vKqvpTxKeMH869yj9beC2QwACgzi R3+ToKhA8c6HSe4hN1LvJ+VUpiVPRtgN1LPZRG7PJxJPwF4yP+MQZjSTvocsggSiJPVJx+NCJL4 TbOi7ZFtlZkJthAcyh+UkcSY8yuQWTgjkgBrXt8OjOU2Q27uECdxyx1Mgen6dMO+P1znFWXJ47U Grwq/xcLQHbCB22JCViJfxE3nfFRo/vGp2s7Vix1z8Z9wdDgPb84XscLmz/WJrNteIxku8l6Uxq mfRX15/HRKSNIZ+cln75365KNzzOIZbL0EolH3fuFKO4ueyYEl8gCwCNISVKAuEmjOvGhAM+Zpx eALYsDLSVnZB4ciXoxCogc2uTmIff9PgLJqn+kGjyLSif5g== X-Google-Smtp-Source: AGHT+IFZW6vFHa1/5Zvt0YCr3p3OJjpJkvyVRye0Tf4v8SzY51P8lG+wjrPKdNKOI+8V+VKSf0EByA== X-Received: by 2002:a05:600c:4711:b0:45b:9c93:d22b with SMTP id 5b1f17b1804b1-45b9c93d49dmr59874235e9.2.1756981397275; Thu, 04 Sep 2025 03:23:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: floss@arusekk.pl Subject: [PATCH v4 3/4] linux-user: Populate vdso_sigreturn_region_{start, end} from sigtramp page Date: Thu, 4 Sep 2025 12:23:09 +0200 Message-ID: <20250904102311.57383-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904102311.57383-1-richard.henderson@linaro.org> References: <20250904102311.57383-1-richard.henderson@linaro.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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x333.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756981452430116600 Content-Type: text/plain; charset="utf-8" When a target does not support a vdso, we generate a sigtramp page. The only thing on this page is a (set of) signal return syscalls. We do not need to narrowly restrict the vdso_sigreturn_region; simply record the entire page for all such targets. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 28f0909d1a..1370ec59be 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1974,6 +1974,8 @@ int load_elf_binary(struct linux_binprm *bprm, struct= image_info *info) =20 setup_sigtramp(tramp_page); target_mprotect(tramp_page, TARGET_PAGE_SIZE, PROT_READ | PROT_EXE= C); + vdso_sigreturn_region_start =3D tramp_page; + vdso_sigreturn_region_end =3D tramp_page + TARGET_PAGE_SIZE; } =20 bprm->p =3D create_elf_tables(bprm->p, bprm->argc, bprm->envc, &ehdr, = info, --=20 2.43.0 From nobody Sat Sep 6 14:40:40 2025 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1756981482; cv=none; d=zohomail.com; s=zohoarc; b=TzpaJkD7+T1sRPYcbLM3GXzYmqF3ODGaNAgTPZEcQcVjjYYGWaJVWaeNo4KPhAwqXvGmtnvzzGT4OlnpxClKZZBC5b34UmpFDBrmpQEhVLXBNjfDdq0BQQqxj/V4M5WNZwe2qVPN4fJj4kITi6MKc8c5Fkh9GpJrNCMm8GD4HEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756981482; 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=uv1VGaAfeJc2rHFeH1ycLENFjj6GVkfaFa1r+x3eGjA=; b=bV9VtFAb6ftwwCTF8z99hsTrVGILWP188CalHJIb3yRAcLyZ7QGWIJ+Fz8GHl3X8Yj869ZavOgZYG8DsmsZizrj9LSmZt1vRN2X+zXhQzk9PSxk26WaEqFDqBa5AckbhiEX5LZF7gB9RnENCPuCFdFEx0lf2D5CiZsIaRsOaPBs= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756981482797289.20375368156067; Thu, 4 Sep 2025 03:24:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uu77s-000067-83; Thu, 04 Sep 2025 06:23:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uu77o-00005K-Oi for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:28 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uu77g-0005Q2-HO for qemu-devel@nongnu.org; Thu, 04 Sep 2025 06:23:28 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-45b7d485173so6188975e9.0 for ; Thu, 04 Sep 2025 03:23:20 -0700 (PDT) Received: from stoup.dot1x.polimi.it ([131.175.126.3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45b8f2d3c88sm147699195e9.19.2025.09.04.03.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Sep 2025 03:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1756981398; x=1757586198; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uv1VGaAfeJc2rHFeH1ycLENFjj6GVkfaFa1r+x3eGjA=; b=xe90Rp06T1I9kDP+nNpnYtMTqLeZfngAZiWMXe7bBDabqVGpiA4XWe7KZ6aDm0Il/L bWoYcwpYc22Cz7YYQp8b0NQmnjaKJml9RgYz8lGiY4BG9wO/CYqvvO92mG5cTD/l/Trs jl7hMAqkXMKkWbHXzsX9K4tTA1H3YNvbHiv1dp99Wt8cUhjCD6wumbimZkjP0hS+qNFl a+14PFUHgcJN2uAjDkl4ONyz9hFvlJFcqDA+9KcZqkqwR1o0LjxjIPgbXNHdR2xEO1hf 2PHPCx+H0HfNL85ZVUrOZ1sEId0155ASn29TuM5TS5ymBtkDJcdgWWEYE2Z9tWiuXUv9 FGPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756981398; x=1757586198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uv1VGaAfeJc2rHFeH1ycLENFjj6GVkfaFa1r+x3eGjA=; b=OU7ru57Y+DLN/Yq8LX9Omg1F+H2LvBkdFYySDAmutYPrBByiMQQ1yEaQQumHkyZrL0 5e2qDDPZ09r9UX6pOvs/CNqmrn6PF/nJvLm6mSTRV0zaxUYKiQBL4di9uK7Nkw2d1jTo HcP/rJmqXxXj8z/VWbEfIlvOFICzpEMvpi4MikIQYU6R8ffi+qs+e66pwOMs81JY402I JUZ1hM81/7vX7+mcermRUcf4dcdUfmD7Ekmh6jy/q9rbSlh+MOmHUO1lUeM8/KbjpaBY x1AyFYgvgiGCeBgcZCCKaOCBIk54tDx8Rwnu9FG4svJRkYWYa7aYE5SF+Q3kVBvfK2k4 dptw== X-Gm-Message-State: AOJu0YzPrm71m9EGqkR+b8BsxefJc0/61egGchNUEm6jpvUi4K0EfEmF bWzM0Lo0QSoHSiVmtCJeaoDCCcVujNVGYQGYyzd3glekFaGm4F9bqEPPljgNlrmIGRhm2sGYcg+ ENGpqJ4c= X-Gm-Gg: ASbGnctQoeolJqn7oASnVRtAlP+n10wDag1QTON0Mz5KLc8muTlZSXIDYVvLFztTsGY Sq8bDqWow+bwFIg06jVR58tnsy+0LtUNmAp0eu0oisv01rmPIAFUZIFa/rKWrXkqaYB0TU7ma2F g9i6NEZFUVV70GtWKyXFYiZD9qCloCkBhiL58Sj9XQPxP5ZiXTWfn20tNXAAjKoTQxdJZdfqIxx rKk7s0rmfqVYeRawH3sKuyOUxCJcjTeEb1wKhXMUG/cIjXPIrju97S8bCYpADu9VGdCleip/EdY PK9ZG2qhDzS3dM6uC/b312fsTzfZsYzPhYwhkrF80i4bK01uCgCM9/kMTspJs9+okkEQQ8v0ZS2 LPGRR0HWOsC8FjJHlN3URK+E1ZAGsHpvsqbYpC6drOUdJUkllJVlEfiUE X-Google-Smtp-Source: AGHT+IGxdLSzwvA8mupWv5/wrCv1s1ayhtSbIZCuRVHl2erqeoAsQ6Sg1Q/PcKdejAT6e+hOznxP5A== X-Received: by 2002:a05:600c:3589:b0:45d:d353:a491 with SMTP id 5b1f17b1804b1-45dd353a5b5mr5950925e9.1.1756981398200; Thu, 04 Sep 2025 03:23:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: floss@arusekk.pl Subject: [PATCH v4 4/4] linux-user: Add syscall dispatch support Date: Thu, 4 Sep 2025 12:23:10 +0200 Message-ID: <20250904102311.57383-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904102311.57383-1-richard.henderson@linaro.org> References: <20250904102311.57383-1-richard.henderson@linaro.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=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32c.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @linaro.org) X-ZM-MESSAGEID: 1756981484792116600 Content-Type: text/plain; charset="utf-8" From: Arusekk This commit adds support for the `prctl(PR_SET_SYSCALL_USER_DISPATCH)` function in the Linux userspace emulator. It is implemented as a fully host-independent function, by forcing a SIGSYS early during syscall handling, if the PC is outside the allowed range. Since disabled SUD is indistinguishable from enabled SUD with always-allowed region length =3D=3D ~0, this encoding is used instead of introducing a new flag. Tested on [uglendix][1], will probably also apply to software like tiny-wine, rpcsx, limbo, lazypoline, vicar, sysfail and endokernel, to name a few. [1]: https://sr.ht/~arusekk/uglendix Signed-off-by: Arusekk Message-ID: <20250711225226.14652-1-floss@arusekk.pl> [rth: Split out is_vdso_sigreturn region matching and other minor tweaks.] Signed-off-by: Richard Henderson --- linux-user/qemu.h | 5 +++ linux-user/signal-common.h | 5 +++ linux-user/syscall_defs.h | 6 +++ linux-user/main.c | 2 + linux-user/syscall.c | 76 +++++++++++++++++++++++++++++++++++++- 5 files changed, 93 insertions(+), 1 deletion(-) diff --git a/linux-user/qemu.h b/linux-user/qemu.h index e4dca0c20f..cabb7bd6a8 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -155,6 +155,11 @@ struct TaskState { /* This thread's sigaltstack, if it has one */ struct target_sigaltstack sigaltstack_used; =20 + /* This thread's SYSCALL_USER_DISPATCH state, len=3D~0 means disabled = */ + vaddr sys_dispatch; + vaddr sys_dispatch_selector; + abi_ulong sys_dispatch_len; + /* Start time of task after system boot in clock ticks */ uint64_t start_boottime; }; diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 0b04868727..8a44714251 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -28,6 +28,11 @@ extern abi_ulong default_rt_sigreturn; extern abi_ulong vdso_sigreturn_region_start; extern abi_ulong vdso_sigreturn_region_end; =20 +static inline bool is_vdso_sigreturn(abi_ulong pc) +{ + return pc >=3D vdso_sigreturn_region_start && pc < vdso_sigreturn_regi= on_end; +} + void setup_sigtramp(abi_ulong tramp_page); =20 int on_sig_stack(unsigned long sp); diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index df26a2d28f..cd9ff709b8 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -689,6 +689,12 @@ typedef struct target_siginfo { #define TARGET_TRAP_HWBKPT (4) /* hardware breakpoint/watchpoint = */ #define TARGET_TRAP_UNK (5) /* undiagnosed trap */ =20 +/* + * SIGSYS si_codes + */ +#define TARGET_SYS_SECCOMP (1) /* seccomp triggered */ +#define TARGET_SYS_USER_DISPATCH (2) /* syscall user dispatch triggered */ + /* * SIGEMT si_codes */ diff --git a/linux-user/main.c b/linux-user/main.c index 7b0ccb6fd6..d8b7df4a79 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -233,6 +233,8 @@ void init_task_state(TaskState *ts) ts->start_boottime +=3D bt.tv_nsec * (uint64_t) ticks_per_sec / NANOSECONDS_PER_SECOND; } + + ts->sys_dispatch_len =3D -1; } =20 CPUArchState *cpu_copy(CPUArchState *env) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 91360a072c..9098cdb9fa 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6344,6 +6344,10 @@ abi_long do_arch_prctl(CPUX86State *env, int code, a= bi_ulong addr) #endif #ifndef PR_SET_SYSCALL_USER_DISPATCH # define PR_SET_SYSCALL_USER_DISPATCH 59 +# define PR_SYS_DISPATCH_OFF 0 +# define PR_SYS_DISPATCH_ON 1 +# define SYSCALL_DISPATCH_FILTER_ALLOW 0 +# define SYSCALL_DISPATCH_FILTER_BLOCK 1 #endif #ifndef PR_SME_SET_VL # define PR_SME_SET_VL 63 @@ -6398,6 +6402,36 @@ static abi_long do_prctl_inval1(CPUArchState *env, a= bi_long arg2) #define do_prctl_sme_set_vl do_prctl_inval1 #endif =20 +static abi_long do_prctl_syscall_user_dispatch(CPUArchState *env, + abi_ulong arg2, abi_ulong a= rg3, + abi_ulong arg4, abi_ulong a= rg5) +{ + CPUState *cpu =3D env_cpu(env); + TaskState *ts =3D get_task_state(cpu); + + switch (arg2) { + case PR_SYS_DISPATCH_OFF: + if (arg3 || arg4 || arg5) { + return -TARGET_EINVAL; + } + ts->sys_dispatch_len =3D -1; + return 0; + case PR_SYS_DISPATCH_ON: + if (arg3 && arg3 + arg4 <=3D arg3) { + return -TARGET_EINVAL; + } + if (arg5 && !access_ok(cpu, VERIFY_READ, arg5, 1)) { + return -TARGET_EFAULT; + } + ts->sys_dispatch =3D arg3; + ts->sys_dispatch_len =3D arg4; + ts->sys_dispatch_selector =3D arg5; + return 0; + default: + return -TARGET_EINVAL; + } +} + static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) { @@ -6473,6 +6507,9 @@ static abi_long do_prctl(CPUArchState *env, abi_long = option, abi_long arg2, case PR_SET_UNALIGN: return do_prctl_set_unalign(env, arg2); =20 + case PR_SET_SYSCALL_USER_DISPATCH: + return do_prctl_syscall_user_dispatch(env, arg2, arg3, arg4, arg5); + case PR_CAP_AMBIENT: case PR_CAPBSET_READ: case PR_CAPBSET_DROP: @@ -6527,7 +6564,6 @@ static abi_long do_prctl(CPUArchState *env, abi_long = option, abi_long arg2, case PR_SET_MM: case PR_GET_SECCOMP: case PR_SET_SECCOMP: - case PR_SET_SYSCALL_USER_DISPATCH: case PR_GET_THP_DISABLE: case PR_SET_THP_DISABLE: case PR_GET_TSC: @@ -13897,12 +13933,46 @@ static abi_long do_syscall1(CPUArchState *cpu_env= , int num, abi_long arg1, return ret; } =20 +static bool sys_dispatch(CPUState *cpu, TaskState *ts) +{ + abi_ptr pc; + + if (likely(ts->sys_dispatch_len =3D=3D -1)) { + return false; + } + + pc =3D cpu->cc->get_pc(cpu); + if (likely(pc - ts->sys_dispatch < ts->sys_dispatch_len)) { + return false; + } + if (unlikely(is_vdso_sigreturn(pc))) { + return false; + } + if (likely(ts->sys_dispatch_selector)) { + uint8_t sb; + if (get_user_u8(sb, ts->sys_dispatch_selector)) { + force_sig(TARGET_SIGSEGV); + return true; + } + if (likely(sb =3D=3D SYSCALL_DISPATCH_FILTER_ALLOW)) { + return false; + } + if (unlikely(sb !=3D SYSCALL_DISPATCH_FILTER_BLOCK)) { + force_sig(TARGET_SIGSYS); + return true; + } + } + force_sig_fault(TARGET_SIGSYS, TARGET_SYS_USER_DISPATCH, pc); + return true; +} + abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg8) { CPUState *cpu =3D env_cpu(cpu_env); + TaskState *ts =3D get_task_state(cpu); abi_long ret; =20 #ifdef DEBUG_ERESTARTSYS @@ -13919,6 +13989,10 @@ abi_long do_syscall(CPUArchState *cpu_env, int num= , abi_long arg1, } #endif =20 + if (sys_dispatch(cpu, ts)) { + return -QEMU_ESIGRETURN; + } + record_syscall_start(cpu, num, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); =20 --=20 2.43.0