Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp179060ybc; Mon, 18 Nov 2019 22:53:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzbDbedJKNL5RPt/3jHgFQdz2B+R+TagRQ48t3MnxNLCBCvAR0qYvIVvsL8c47VdD6CdcpI X-Received: by 2002:a17:906:57c3:: with SMTP id u3mr27544575ejr.254.1574146408414; Mon, 18 Nov 2019 22:53:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574146408; cv=none; d=google.com; s=arc-20160816; b=HWP33JX0p45WnsK5kU7DYF+Y0IoUfF8MDj1ULbpNxC4+2RV90A7SWCy77tJvOuAqx9 4nNx0J2XDE/l5Se3gQkI9qdGQpnNWiBCIrtCdJRXIgQt9DhE7VAOtwCxO95OMrWsDEew 3fqqbs+IuVJe+eAgWqySMWnwlqaMXgQfU/5HSp/3OUb5WchnV4xSgz8E+xjs+AdOiUbq iuqCutxF8nw8xIe3o4ohxV/q/fTvbyFVciwrT/TJuLX+9a0/ZPqj4/mTb2jaNSQjB7Et 91ipesqXQCMZr/b056wZa6O8/fxIvhY298cd6D/B3YmHJ8r5Fi7KL/KsCbfKgB/S/iQl LKxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vf4F9pJ0ymWf5K3OCJMRmNw+9rqSL23CjNJ/SdLH62I=; b=0dHytG+4arTYRs3RZO5dDPHcCVtNKGu5KzZ2mA8jTh9RfYO9N6HY88pmMeaoisMIzt jmWfqnEW0NSpNHoaN3E5xOeQ73hThw4qJEBGYJx33yhsgu0x9LB7iUJ7tGN7Oy6Zb5Cc TflMUPsVPMNf2YXDcwk8wm9/LM2NKiitcZZWZNUjYm0viCMEsqfj+RMne8AADL+Hw7tx b+CVqiMjHJd0SvT8+5rzErpvYJH83R1iCqPwNroVvM2ApYRRAK/nYeHb+xZb1JehWTPB 7AvGp+7mB2SMETwUIP0tk4kmt+bsl62RFQFPcKU4soinqeaa1+3kdQO5RKVA5zwVTzUh VESw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sLIqpKT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d30si15468492edj.289.2019.11.18.22.53.03; Mon, 18 Nov 2019 22:53:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sLIqpKT9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728921AbfKSGI3 (ORCPT + 99 others); Tue, 19 Nov 2019 01:08:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:49676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728318AbfKSFas (ORCPT ); Tue, 19 Nov 2019 00:30:48 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2D6E21823; Tue, 19 Nov 2019 05:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141448; bh=3mxGYgjOUmLHh+Ma6tUAavgz5Jr5Y9Xm0paYCjzN3B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sLIqpKT9s8CdSjrqg6UD+I/yTsWkZDVgJCW9sPytX7yL/wZZ9KZeRXOEJYnBBOfm+ w8lDpgeOeEyIDjxz4NTtZLL3OKzzYamXH/X/YSPL5YOXnAg33auBLVzYqN6vBN7C9t rw2htDaCf4EJXMd12s6cimaXFUjd+g7Vet+RTy48= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Eric W. Biederman" , Sasha Levin Subject: [PATCH 4.19 164/422] signal: Properly deliver SIGSEGV from x86 uprobes Date: Tue, 19 Nov 2019 06:16:01 +0100 Message-Id: <20191119051409.089423391@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051400.261610025@linuxfoundation.org> References: <20191119051400.261610025@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric W. Biederman [ Upstream commit 4a63c1ffd384ebdce40aac9c997dab68379137be ] For userspace to tell the difference between an random signal and an exception, the exception must include siginfo information. Using SEND_SIG_FORCED for SIGSEGV is thus wrong, and it will result in userspace seeing si_code == SI_USER (like a random signal) instead of si_code == SI_KERNEL or a more specific si_code as all exceptions deliver. Therefore replace force_sig_info(SIGSEGV, SEND_SIG_FORCE, current) with force_sig(SIG_SEGV, current) which gets this right and is shorter and easier to type. Fixes: 791eca10107f ("uretprobes/x86: Hijack return address") Reviewed-by: Thomas Gleixner Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- arch/x86/kernel/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 9119859ba7871..420aa7d3a2e6b 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -1089,7 +1089,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs pr_err("return address clobbered: pid=%d, %%sp=%#lx, %%ip=%#lx\n", current->pid, regs->sp, regs->ip); - force_sig_info(SIGSEGV, SEND_SIG_FORCED, current); + force_sig(SIGSEGV, current); } return -1; -- 2.20.1