Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp498084rdf; Tue, 21 Nov 2023 08:12:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJx8yK0h29/Ok+X7h03Mf5686OPfVemEESnYjYzs6jw3U6uBOxdyoT/y/kvRNbZ2etKHe/ X-Received: by 2002:a17:90b:4a8a:b0:280:1d67:16a6 with SMTP id lp10-20020a17090b4a8a00b002801d6716a6mr11598107pjb.34.1700583145536; Tue, 21 Nov 2023 08:12:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700583145; cv=none; d=google.com; s=arc-20160816; b=CJwrfq2fwsboGAE5jnQqRsOrjltJql7LAdOPmFHkEAZ1sbiZaCBHpR+u5rNyt7vSd8 91AVD0gk5TX0v0Rg1w9ACwyPL7ERB2RlF84tIpsoxqFcdtyLX17h+4X48NU6Z7WaK3cU lWkltZVmQo3A/gFFFDtoKYF8lcaRSssXZ6XSeCu79konV+ZrqEgF137BRfqsxn5GJ50x XBgPvEux6oMR057iIn0UpcDk271itJ94KQw5GecNFcCcQ9ZA9KI+G3uD+5syIkF/PohJ k9b5WrmWGx96rAMSLz1D92hZQnJ8nJlBaFB6JLl+yAm68UjEj9geTRIrkFnj+eh4z7kl PZ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LyHCIPulRbDwBycPmHaiodw7c5//nC6ajeHaxBMLX/E=; fh=9RpTnfhBjS7aInYfy4s3YSeqVfE/5xaCcsA8izD9Vow=; b=bsAZJew0tf10m+UQs0U3VdPomFLmxNrNPs+rWyDfy+gl/XwSaxseVbwQ/gewYmoe6e ztsz1jXm5Rp/PNhxuaz8bXzkvs5YTJbQtRLqta9zT1h4HVAYDUydrLV4mAffA5AheSRo dOysR6E2Lq9HbyoZuvxIksBnXghrNWBkN9lQMw0ffDTe2ThtlRlR4WYDzI7z6Fl+h4Jr mdQs5jgV6jHk2Wm1tylnCpl5bMojyWINYO1Gdq2GAYtnruhTdk1vUE/6OP2aNtPmo9GJ AY1VJX0trKB6aBIxohA7WQ3ziF0tlWv8DGGdm79EKbaDLbsQQR9SGoPm+yAYfVgQ3SB2 SuHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fa9CfV8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h22-20020a17090ac39600b0028525cfb9f9si4679408pjt.105.2023.11.21.08.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 08:12:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fa9CfV8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EC10980C2550; Tue, 21 Nov 2023 08:12:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233581AbjKUQMP (ORCPT + 99 others); Tue, 21 Nov 2023 11:12:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjKUQMN (ORCPT ); Tue, 21 Nov 2023 11:12:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF18B199; Tue, 21 Nov 2023 08:12:09 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48D16C433CB; Tue, 21 Nov 2023 16:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700583129; bh=A0Y7+6CPTDVIv38TNvsOqsS9EpEwKcUF5pOzGVfc3jY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Fa9CfV8wI+kl+tVZgpFokGfpPaGMDFVHruwnzBKEDVlGUXC6jrfRuh5l2MNbxya+F kycnxByNfNaLEAfKkT1iKPbfjt1SjKFPwVuxEjBedYQ0J3VqTYzzqgTu8/UnXJna7Q Dxd3X50XtiI5y9x8AB8jCPW6MdfXzgaJzQ0hWuTdFC654Sn89nS3cFobdrdzLcO07Q l0oYjz2awBViFn/v8P2pcs2YyWhIG+v29qfnQ59UQgVjIwg6lNVuaNEPDqhE/5dv6z DFajlOR8U8O6juoudANe+0cRIksgPmTlHomRLocj5Csk2AfpYqppGslXuhBmrlqI5b xcS3c6SjVEA1A== Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2c6b30acacdso72188971fa.2; Tue, 21 Nov 2023 08:12:09 -0800 (PST) X-Gm-Message-State: AOJu0Yy1fV8QLHCIrI2fHHU4sU5VPlox2rfw/6ss76AcbAPBrsNnoz61 uNRg8ANOCKhkajoKMWx6sAL6LKs/1hRBWXqDXKI= X-Received: by 2002:a2e:a4a8:0:b0:2c5:1b82:a533 with SMTP id g8-20020a2ea4a8000000b002c51b82a533mr6940656ljm.15.1700583127437; Tue, 21 Nov 2023 08:12:07 -0800 (PST) MIME-Version: 1.0 References: <20231120032909.19186-1-quic_aiquny@quicinc.com> In-Reply-To: <20231120032909.19186-1-quic_aiquny@quicinc.com> From: Ard Biesheuvel Date: Tue, 21 Nov 2023 11:11:56 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 1/1] ARM: kprobes: Explicitly reserve r7 for local variables To: Maria Yu Cc: Nathan Chancellor , linux@armlinux.org.uk, mhiramat@kernel.org, kernel@quicinc.com, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_lijuang@quicinc.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 08:12:23 -0800 (PST) On Sun, 19 Nov 2023 at 22:29, Maria Yu wrote: > > Registers r7 is removed in clobber list, so compiler may choose r7 for > local variables usage, while r7 will be actually updated by the inline asm > code. This caused the runtime behavior wrong. > While those kind of reserved registers cannot be set to clobber list > because of error like "inline asm clobber list contains reserved > registers". > Explicitly reserve r7 by adding attribute no-omit-frame-pointer for this > file, then in T32 asm code r7 is used as a frame pointer and is not > available for use as a general-purpose register. > Note that "no-omit-frame-pointer" will make the code size a little bigger > to store the stack frame pointer. > > Fixes: dd12e97f3c72 ("ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds") > Suggested-by: Ard Biesheuvel > Signed-off-by: Maria Yu > Cc: stable@vger.kernel.org > --- > arch/arm/probes/kprobes/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/probes/kprobes/Makefile b/arch/arm/probes/kprobes/Makefile > index 6159010dac4a..b1f21e78950b 100644 > --- a/arch/arm/probes/kprobes/Makefile > +++ b/arch/arm/probes/kprobes/Makefile > @@ -8,6 +8,7 @@ test-kprobes-objs := test-core.o > > ifdef CONFIG_THUMB2_KERNEL > obj-$(CONFIG_KPROBES) += actions-thumb.o checkers-thumb.o > +CFLAGS_actions-thumb.o += -fno-omit-frame-pointer > test-kprobes-objs += test-thumb.o > else > obj-$(CONFIG_KPROBES) += actions-arm.o checkers-arm.o > If Nathan is happy with this, I think we can drop this into the patch tracker.