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=ham 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 1B5F8C432C0 for ; Tue, 19 Nov 2019 05:30:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E3A82222A2 for ; Tue, 19 Nov 2019 05:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141451; bh=53j+0S0OSWVeJeVDu6K2ecCbyB86jeed+TBSMYu2ALw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GJel4VWSChiNX6nlvdVlexEEtHEu9YkiLko4KFsH3saFNsdxZHO8fi7PyMbknxnMP lC9iUa4tj/MLOM2/mm/7FOeFHDzv9Cg+MXu9kfrtDFLx6qhwgyUPDBx8EhFVAaeWH9 xpsHe6WGpslMgIpqcb2pJSlMzn9kgzHfVh6cwFhY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729183AbfKSFau (ORCPT ); Tue, 19 Nov 2019 00:30:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:49628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728704AbfKSFaq (ORCPT ); Tue, 19 Nov 2019 00:30:46 -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 0711E208C3; Tue, 19 Nov 2019 05:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141445; bh=53j+0S0OSWVeJeVDu6K2ecCbyB86jeed+TBSMYu2ALw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IdZEfKLJ4RUXhaXtNrE+/u6PtSRxvIYg2RqQuhqwMpAWmVtavu/Vc117lZ4TKqKpx o8RV80OJFwLnnz8Cu56CHG81jmGzFb+xdjNF/Ul28eoD/39VeHeWe6Wn4pE4CY4sVg Ia1Puaf2BEfv1Mwc2w0EA6v+BH9o38a2bkpJNWLI= 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 163/422] signal: Properly deliver SIGILL from uprobes Date: Tue, 19 Nov 2019 06:16:00 +0100 Message-Id: <20191119051409.038918845@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 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 578d4ac54484f..c173e4131df88 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1858,7 +1858,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); } @@ -1974,7 +1974,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