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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,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 B5580FA372C for ; Fri, 8 Nov 2019 11:49:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 82CC9222C5 for ; Fri, 8 Nov 2019 11:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573213751; bh=zrACi/zrpE++6Yp8Y3AqZM16ao3eA7zrnaBCivxJV+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=X9UUVzlzhTJhLes5hg1zhRie0aM/YKWU+NfT0X1efefCXrDBHYbkVrGROF/AUWO4X h6LNG5mL1nOVgBP3/0EtAfgAhhLwJl8wNEWrm4I1laq6nvYbCIeb5JoyC6hdGxY6mF BfDXwFwL9kOZDbOpveVCquC2X7TPrSIXjx+F9Npw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391739AbfKHLsZ (ORCPT ); Fri, 8 Nov 2019 06:48:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:36738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391689AbfKHLrz (ORCPT ); Fri, 8 Nov 2019 06:47:55 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B9A65222C5; Fri, 8 Nov 2019 11:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573213675; bh=zrACi/zrpE++6Yp8Y3AqZM16ao3eA7zrnaBCivxJV+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2ACvtfMnC+v9xyIx5+8MHxWw8CnJKvNkypZkOMeYg9Vg4tkeOl/cXEHnoMHy+Zx7 BuDWNTUnT3NT72JJvgsZxSYDmea90xYPSsCCu606/WWY4vDpa/T8+oeW7MUaNq1Umm 02f8PHPmwhzt8La3u7M+XZysJTkf3EKBZTZw7Heo= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Eric W. Biederman" , Thomas Gleixner , Sasha Levin Subject: [PATCH AUTOSEL 4.4 26/44] signal: Properly deliver SIGILL from uprobes Date: Fri, 8 Nov 2019 06:47:02 -0500 Message-Id: <20191108114721.15944-26-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191108114721.15944-1-sashal@kernel.org> References: <20191108114721.15944-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 55a3235fc71bf34303e34a95eeee235b2d2a35dd ] For userspace to tell the difference between a random signal and an exception, the exception must include siginfo information. Using SEND_SIG_FORCED for SIGILL 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(SIGILL, SEND_SIG_FORCE, current) with force_sig(SIG_ILL, current) which gets this right and is shorter and easier to type. Fixes: 014940bad8e4 ("uprobes/x86: Send SIGILL if arch_uprobe_post_xol() fails") Fixes: 0b5256c7f173 ("uprobes: Send SIGILL if handle_trampoline() fails") Reviewed-by: Thomas Gleixner Signed-off-by: "Eric W. Biederman" Signed-off-by: Sasha Levin --- kernel/events/uprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index aad43c88a6685..8cad3cd92e23e 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1836,7 +1836,7 @@ static void handle_trampoline(struct pt_regs *regs) sigill: uprobe_warn(current, "handle uretprobe, sending SIGILL."); - force_sig_info(SIGILL, SEND_SIG_FORCED, current); + force_sig(SIGILL, current); } @@ -1952,7 +1952,7 @@ static void handle_singlestep(struct uprobe_task *utask, struct pt_regs *regs) if (unlikely(err)) { uprobe_warn(current, "execute the probed insn, sending SIGILL."); - force_sig_info(SIGILL, SEND_SIG_FORCED, current); + force_sig(SIGILL, current); } } -- 2.20.1