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=-8.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 F2D0EC433E7 for ; Tue, 20 Oct 2020 10:18:05 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70DF42222D for ; Tue, 20 Oct 2020 10:18:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1XiHVNC6"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="bW/0XvzF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70DF42222D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UQ4ZZxkUJCVrrcgtuCrgN5iby1XYDFBEf+BXjcmKKx8=; b=1XiHVNC6Q16I7tIIIPCr8fHTd pQrhlpFzdwkEzDMmOGcav9tAmYN8QvsNQGh2ePbySzSoWU5GfpKA/erOQh+W4u+v1eyHwgOZm8NMK p5DstgyAcp3l4dLD9BP2dPm7G22mId72FAXpygA9vMToTY5WvWxUFqqNOQW9RJjbGJZ0JjTn6EZd1 k1DK4CzJF3b2rBsI2/Jvlgz02KIXWLuSa8FG8i/L8E6LVc0ePbetOrUKGuf/k5BA7OC1mmEl/F8Vi u5NboFBtE9lVc9lRtFmBsoT422WwlanzjtpdY7XA0aXTl3943ww2SNaaSx4Ge6M22+YlgQUtsIz84 OxJ7vJhpg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUohB-00006y-9R; Tue, 20 Oct 2020 10:16:45 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kUoh5-00088u-EG for linux-arm-kernel@lists.infradead.org; Tue, 20 Oct 2020 10:16:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ulf1b4scapw8ctjjAAz+4kLXfTbjmbhJeEFBO0fcNVE=; b=bW/0XvzFz0jzLulc5aAH1fFri e3xmMJmksLdSUc7UG9xzd2z49GU6JCPdz/3zV3CvN8dtLpUt0iGWkfEhTA6rqzDughAlLRWSAnSB5 unVgdLOzvO8oTTE7bnWIYQMuZ/yDXSBH0hKYz38Hpj/myzEUaocO6GvD3pzo310ORPuzNKuyqedlA yZSnSgnWuUT/vMFBs5fQPcNsY5ZxJ4FTUksoTuMxin/nq8R5qEhQPJZnEAnLD0X0P2EX0QGyGuLU6 OOMYtgg5bIlRC+atsL9HS6HOKnw5Kt43gdxikf/QqeN1/1tFAf09brxvRTgHtRV0e/ngKV10TbyMZ rrtXBEwtA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:48618) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kUodz-00076j-FI; Tue, 20 Oct 2020 11:13:27 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1kUodw-0005CL-QC; Tue, 20 Oct 2020 11:13:24 +0100 Date: Tue, 20 Oct 2020 11:13:24 +0100 From: Russell King - ARM Linux admin To: Joel Stanley Subject: Re: [PATCH v2] ARM: kprobes: Avoid fortify_panic() when copying optprobe template Message-ID: <20201020101324.GA1551@shell.armlinux.org.uk> References: <20201001042927.2147800-1-andrew@aj.id.au> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201020_061639_536905_D8424A86 X-CRM114-Status: GOOD ( 23.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Andrew Jeffery , Juraj Vijtiuk , Linux Kernel Mailing List , Mathieu Desnoyers , mhiramat@kernel.org, Luka Oreskovic , labbott@redhat.com, Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Oct 20, 2020 at 05:32:26AM +0000, Joel Stanley wrote: > On Fri, 9 Oct 2020 at 05:20, Joel Stanley wrote: > > > > On Thu, 1 Oct 2020 at 04:30, Andrew Jeffery wrote: > > > > > > Setting both CONFIG_KPROBES=y and CONFIG_FORTIFY_SOURCE=y on ARM leads > > > to a panic in memcpy() when injecting a kprobe despite the fixes found > > > in commit e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with > > > FORTIFY_SOURCE") and commit 0ac569bf6a79 ("ARM: 8834/1: Fix: kprobes: > > > optimized kprobes illegal instruction"). > > > > > > arch/arm/include/asm/kprobes.h effectively declares > > > the target type of the optprobe_template_entry assembly label as a u32 > > > which leads memcpy()'s __builtin_object_size() call to determine that > > > the pointed-to object is of size four. However, the symbol is used as a handle > > > for the optimised probe assembly template that is at least 96 bytes in size. > > > The symbol's use despite its type blows up the memcpy() in ARM's > > > arch_prepare_optimized_kprobe() with a false-positive fortify_panic() when it > > > should instead copy the optimised probe template into place: > > > > > > ``` > > > $ sudo perf probe -a aspeed_g6_pinctrl_probe > > > [ 158.457252] detected buffer overflow in memcpy > > > > > > Fixes: e46daee53bb5 ("ARM: 8806/1: kprobes: Fix false positive with FORTIFY_SOURCE") > > > Fixes: 0ac569bf6a79 ("ARM: 8834/1: Fix: kprobes: optimized kprobes illegal instruction") > > > Cc: Luka Oreskovic > > > Cc: Juraj Vijtiuk > > > Suggested-by: Kees Cook > > > Signed-off-by: Andrew Jeffery > > > > Tested-by: Joel Stanley > > Reviewed-by: Joel Stanley > > > > Thanks Andrew. > > > > > --- > > > v1 was sent some time back, in May: > > > > > > https://lore.kernel.org/linux-arm-kernel/20200517153959.293224-1-andrew@aj.id.au/ > > Russell, are you picking this fix up? Sorry, but I don't "pick" patches off the mailing list. See my signature. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel