From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70263C432C0 for ; Fri, 22 Nov 2019 10:41:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 385F320721 for ; Fri, 22 Nov 2019 10:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419276; bh=8AN2pFZyrm0yIe8Lxq0JW9552ptGWoMKWXo+U6zPmiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cmCb/0qPt3zFW9U8QV6MoJaI7ytg8qCSJf3+P5W8O9aj0fHIkn2/f03v6JGUcCJPF 7PEAzNS7mDSqmMYSWG6tgTatphmcsGlq+Hff3AUvtqbZntQt4F80z3nsyfH7g69nUj m09j526P91oLlA4ypqKSs/xztld44J8xAXKA3gWU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728986AbfKVKlP (ORCPT ); Fri, 22 Nov 2019 05:41:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:45614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727733AbfKVKlM (ORCPT ); Fri, 22 Nov 2019 05:41:12 -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 BB78220717; Fri, 22 Nov 2019 10:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419271; bh=8AN2pFZyrm0yIe8Lxq0JW9552ptGWoMKWXo+U6zPmiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wznjFRwZVAPirzAIoWQSArb5KEs9dsQ3nQ0pb9MabssGPpEXtoYY2eCrYvD1Z+P/1 rs8RiLS6ZQwNjN7R/JgHQZ60wGrVg6MFXqh7WOZxXGC+0moDygy2A2YgM4BdHq00PE 9e4fkgsg3QfQvj70Ft5iOntvRtGpYLHtRYptVk3M= 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.9 054/222] signal: Properly deliver SIGSEGV from x86 uprobes Date: Fri, 22 Nov 2019 11:26:34 +0100 Message-Id: <20191122100856.164465952@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@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 e35466afe989d..eac679ab543f6 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -983,7 +983,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs pr_err("uprobe: 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