Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp141481ybc; Mon, 18 Nov 2019 22:04:20 -0800 (PST) X-Google-Smtp-Source: APXvYqw0W+f86iUZ3UImMAe8R6qwKbhndnj6LM2fsVWv+adjaIJnXj4cyn2EY8vD7ITdmIMcKri7 X-Received: by 2002:a1c:1fca:: with SMTP id f193mr3115257wmf.173.1574143322122; Mon, 18 Nov 2019 22:02:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574143322; cv=none; d=google.com; s=arc-20160816; b=pKQAIbS2PEoaX9EWwAC1sTGXv6PA1WPd3WNfeBSKYnZdatnfMVFG/Ac/32NbJP4bhg KGHjJ5mNvJaiRg+MtybchkqTonmATjkPyzMAnr2gDQEWzTe6flwK+xJQUJ58GrD+J5sv aNk08fIdtIixkVwe5a6nvw5/sSbyvhHaOSNXTd68V8BJ+whvpM/DqPMgV5tumZQfDbaS vGMmcOKtPUliU1ykB6hNUxij1SiA2MpvitSi6mtwT836+PRBhgU8igl/F52qg7iSHCc5 chNbm7t5e1F9W1VgG24C9VkRcKc4zTxpKdTszKNlSTm1opvR60KVlmuREa/lLD5kaiWr +kdw== 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=bkOu5+Cf7C4UL+ARKUy1oqrOxNrrAl9yGUlK+fwy/co=; b=kP/CInpkfjnwEK4lp9HE+Pm5DyMwe2x4O7WHabbnk4sIZ/f4Iq41HAFRWxLe6ya5sY uBRo1JfBhilVm8px8xpbiEEJ1g2O824/AAE+nVo3BmvXiYYcfrM+vxWgsjFJAn01YKeN mnkM5BoMX8fHbr8dnqtJmuNKiF/5v7TWsuhMb4BucMqpDO1OrQ8oPdTE/+Ev7ns2wPYA Bfeo5/F9HtXEJQudWL5aBlIUVnhsE6jORp7s6EI/3wckVOKxYHyMuPbG1wa6h15zLSpg EfMjaYAkknhnVUbC26ZjMbndb5hV/0L5YKOqWSgS1i9RvRG4c8uUmzBoOB894uxmusrf FaUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=af5zeFcA; 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 d15si14679506edn.49.2019.11.18.22.01.31; Mon, 18 Nov 2019 22:02:02 -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=af5zeFcA; 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 S1731294AbfKSFrz (ORCPT + 99 others); Tue, 19 Nov 2019 00:47:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:44192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731276AbfKSFrs (ORCPT ); Tue, 19 Nov 2019 00:47: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 1135521783; Tue, 19 Nov 2019 05:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142467; bh=6MASBMvSjedbUBKnlD71QlaSd44QwcHpO8AQ3LfEVJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=af5zeFcAfQjDT4rmEV80mCpsX9pPLwo/KN+JFbi90YWmQgdk5988NAsxBJP48qQ/F kWjTBCsUbaHFmtnZi6sNMyDyCexF5sYl8hELFiuPrVEaKbWnSVAGeMn+4iEIGIPcmV gQWrmekzcmSKKpuVfcFj6JVoDVCSVcwet51suR2Q= 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.14 092/239] signal: Properly deliver SIGILL from uprobes Date: Tue, 19 Nov 2019 06:18:12 +0100 Message-Id: <20191119051320.368558389@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@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 01941cffa9c2f..c74fc98262508 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1854,7 +1854,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); } @@ -1970,7 +1970,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