From patchwork Fri Sep 24 16:59:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 514594 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp1683938jao; Fri, 24 Sep 2021 10:10:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpqZfT/5LxdweP7fVZydtBtXqTszShHD5OqZCQ9vZVLcVvYg39GLM41gDDmmvvwGOEUl9Y X-Received: by 2002:ab0:73d7:: with SMTP id m23mr10690977uaq.118.1632503448119; Fri, 24 Sep 2021 10:10:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632503448; cv=none; d=google.com; s=arc-20160816; b=rXIVFry8Vx0gtNm+d+JljqkFQ5ew5FpC+OG2ZVZl6996/pL7hMjDv+78sykLJ7StDb o+UmBQt3CfPETUYu1oBwZ80pFzVJ0Rm1K6aIGaWX5gN1MoM78oy1PvmSq4x4IggnfygK LOFZnVJ4xFWhDmm+aKLCdtnuPC8f5vuOFBlit9jb4awxIhaK44HBlwWUxnFTwro0A4TU VzyrQifd08S//ynjZn2322u5C+c1wWo2XBMbpuO+U8VoS6HO2aFWgSr7/XbQj7A64XSe 2Tr88m89X80K96bk8w+gNmaj+IusmomTw7vEh841rN2KLjXMMvfe7Y7WrAsosFrO1HEs gr3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ULwFc4fsoMDCKBA2xVTYfXV3nCZVlLyz/guJ8iaI5Rw=; b=Wdjnu1+I43Tf5QThCQ+F0vRp4e3MuRyLc5Wci4KdDs3Lvfwt3spvqQ8JYJ9bAuMWUt LH8w6/HVeUMSDcuI38PGSNDYFCVUqpl3W5BRvc/PVKgAXnNDD1sobWdOoCrYjZPUnTKW ux9GqG4tzd2t2oGMi2gZuuw7x9Tq7Uf7W8Nbx0INLB04oa8NeEsiLaCJOD2lJxoBpqtJ yVItHgWVTAUtgLTWOkl+Vkf29UaxlywiyX3PF/cLgQz5SwF8aRzpb2C8cEtBYH+vEsvb fbWzYwNlurDc12lrbQU+BnQIxaMDgcWquZgyotW4IkQBJsWavA+rJvEl3R1QnDUcGLwH Q4/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KNu6QFb8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j21si6210885vsf.266.2021.09.24.10.10.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Sep 2021 10:10:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KNu6QFb8; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mToil-0003mS-J6 for patch@linaro.org; Fri, 24 Sep 2021 13:10:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mToY2-0002fO-1f for qemu-devel@nongnu.org; Fri, 24 Sep 2021 12:59:43 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:46693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mToXx-0006yT-1b for qemu-devel@nongnu.org; Fri, 24 Sep 2021 12:59:40 -0400 Received: by mail-qk1-x735.google.com with SMTP id b65so28387706qkc.13 for ; Fri, 24 Sep 2021 09:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ULwFc4fsoMDCKBA2xVTYfXV3nCZVlLyz/guJ8iaI5Rw=; b=KNu6QFb8ex3Ct5FPynmI5DxsbDncOGuIO75EcbmuBF3jbNt79pVcljFkepUYRi89rO T5UMNy6uW5nTrHuYDBMgZwrmoISGPZe6kiQp0xy5LF+HWtCCMT7DOJ4sguKFJWpljxhM 2KXBSdTH8kL/7VW3XeldCmoAwG29i1N8Vbrho6GOYbxHe2olKfoaMEDUBza1wZp2ucAS 8XGJIWh8Ii1Ku5gYSPjPDFJ0m/nodFfUTk1yDhJmgXanietodh1iFKYYpN2TCA9QklAl GlStyjvcnxJ/rbHv3+WQM7R56QBOsiWnfZ5w0wcMfpNgyApkeK4AmsKV23ZjsC1BmMS5 YOOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ULwFc4fsoMDCKBA2xVTYfXV3nCZVlLyz/guJ8iaI5Rw=; b=GEFIOWiOK8W+UIZSB1YY2J+FSiDoyCNqho+HYaisMdfddBSbzgm4/URA8bT82C5zUc cF5+qvgu00iwoSGQRHYwNrOg6YTjjgMCnWzs24OxM9w8MicRoXkQPYyVj1hPjceRiIUa c4thMS8e8Oc0bmheDvm7khU5Iw5U+2Zeu2XmyJQIDpusY2G6Zrr4d6ZER8e7bc+UnwRs HlQOQFbByCpxt7cLN5aw2Ro98NCFZqidUI+67ZLdTOX+03uhe0S+e95DSGh7JMV517LP K/T9RALuWxudBZ+x7wMrRGcBfiWA3NBfYiMEMsJ7W0pGqCWe3EI8ORiltoY+KPP924cU ybuA== X-Gm-Message-State: AOAM532jTHIdIcEiHcLOPmpXiAmJmhjYSRA6FPaLIp08kcKBu6py2r2x vyrI+U4ANPoFYf1K00JDayNCERhgq5UCMg== X-Received: by 2002:a37:b703:: with SMTP id h3mr11870358qkf.240.1632502776173; Fri, 24 Sep 2021 09:59:36 -0700 (PDT) Received: from localhost.localdomain (cpe-24-74-129-96.carolina.res.rr.com. [24.74.129.96]) by smtp.gmail.com with ESMTPSA id r13sm7141104qkk.73.2021.09.24.09.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 09:59:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/27] linux-user/x86_64: Raise SIGSEGV if SA_RESTORER not set Date: Fri, 24 Sep 2021 12:59:10 -0400 Message-Id: <20210924165926.752809-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210924165926.752809-1-richard.henderson@linaro.org> References: <20210924165926.752809-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x735.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This has been a fixme for some time. The effect of returning -EFAULT from the kernel code is to raise SIGSEGV. Signed-off-by: Richard Henderson --- linux-user/i386/signal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index 94ab6396a0..55a36476d1 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -421,19 +421,18 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, /* Set up to return from userspace. If provided, use a stub already in userspace. */ -#ifndef TARGET_X86_64 if (ka->sa_flags & TARGET_SA_RESTORER) { __put_user(ka->sa_restorer, &frame->pretcode); } else { +#ifdef TARGET_X86_64 + /* For x86_64, SA_RESTORER is required ABI. */ + goto give_sigsegv; +#else /* This is no longer used, but is retained for ABI compatibility. */ install_rt_sigtramp(frame->retcode); __put_user(default_rt_sigreturn, &frame->pretcode); - } -#else - /* XXX: Would be slightly better to return -EFAULT here if test fails - assert(ka->sa_flags & TARGET_SA_RESTORER); */ - __put_user(ka->sa_restorer, &frame->pretcode); #endif + } /* Set up registers for signal handler */ env->regs[R_ESP] = frame_addr;