Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp516543rdf; Tue, 21 Nov 2023 08:38:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuFznIhYKq1O7qbbsVw0SV4nO8qsO4LKEvwUfQ0LOEswmwwpCAnkRnZcuBhvSF5WrkxSYQ X-Received: by 2002:a05:6808:8fc:b0:3ae:12f6:ac51 with SMTP id d28-20020a05680808fc00b003ae12f6ac51mr6304092oic.41.1700584726796; Tue, 21 Nov 2023 08:38:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700584726; cv=none; d=google.com; s=arc-20160816; b=fJA9QZuvxH1avkDKrhlXHRGeU3QZEKpWMLkvMLz7B7xQ+T5Y+CcZzeG1mbu7oiy0vc mxUz0bI88DGOgbEXbmutBJ4+lZzMBKG77EJ/gOEsrBRCAPieNt2ghC9Bln+lvBBNk6jf k8o/9a1nNXlfO6U73bIyZkmJ0oCcfbas8FNTIm7F6RBtOLmADGNHwakX4B6AF/CYwNqb QX38MjPHd/IU8SFxgtQeuKDsp8eCTbMGqI8ub4I60JexSJYBESws0BTY4iWygRwD669B XWuDgxuq5AepcCiktO16fGcmJIZP5fdmYtUCOyQ5je+bxmR857gkwBnOD2G4x5dWVa89 IXcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=p2GprK58IiqUb2lEdHL91OtuFBDB2IOSGuG2l4Gj73c=; fh=Ldm6SyEsiRsl0VSnv5kddDE+hRCW6k1+cKnFx7/SSvU=; b=LyxMd4Gvvbi+KFlKx+p9i7ZA9lHquqdhddq8ZC4jQjt9XqJlQCnm/Fp9W5glqB4cM2 TeA5J0Yaod0OVFUuAfRvhXFU/WMVZQgVl6ADe58DJpCB++e/TnRIbsGE23H9mOU9IiuV pAgCa+eaU3yWuvJzJI/V4eUFpjBUepL2O4uAj4R0f5kFqfz3q5aioBnkWyrFtAG88tYg oONKjBSEa9ddb6vmKL7914e/S6DSgrGZed4mqBVS+s5u7Kg7k01ytZyHozn96DCEZSqa Fyvw5a5MfaKa9uFzoQt88MT97rj/TyQWMf7NxCiP0y+jbr0v32nMaWQmkR7BBwGdqHdm cbYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CIuck4j4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bq20-20020a056a02045400b0059beadab759si12116421pgb.652.2023.11.21.08.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 08:38:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CIuck4j4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 3DABC804C6CA; Tue, 21 Nov 2023 08:38:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233912AbjKUQih (ORCPT + 99 others); Tue, 21 Nov 2023 11:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbjKUQig (ORCPT ); Tue, 21 Nov 2023 11:38:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC829E7; Tue, 21 Nov 2023 08:38:32 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1008C433C8; Tue, 21 Nov 2023 16:38:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700584712; bh=I9ZH/e6KtTHN2UHi0fUQgC/I219UZFtlAoAwKkrjbcE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CIuck4j4FS3Th2Qg6/yfyYjczl8E2bvtKdh8PF0v8/T1n7u5A3PTNFdZmXNNkVwY5 3lRB+7j8NjJHp4GSIMKmhmMO6UZs+6JnKEK4YK6avhOQ7k+Th+QxH9whbGIqzgeFHS NFZQwEF5iHtTXdRDw1SYU8iSsfejNVCoDA6LSHiBCBT9CL6uQNU49cmrIc2Q6KwLKn /drPNzhKzZbcBz0MTX9Bh4ek04c6IA887OqF08oLR7WtSdrW4sKrzZK8gm8xMAFGNf BnQVtsjMLGUnys8OpppGt7itl83rfcA5+hzKjZ5dFi3oagDSHiPwbG7UjCSmyy5ZyX OX64f7FCJfZAQ== Date: Tue, 21 Nov 2023 09:38:30 -0700 From: Nathan Chancellor To: Ard Biesheuvel Cc: Maria Yu , 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 Subject: Re: [PATCH v3 1/1] ARM: kprobes: Explicitly reserve r7 for local variables Message-ID: <20231121163830.GA3437094@dev-arch.thelio-3990X> References: <20231120032909.19186-1-quic_aiquny@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Tue, 21 Nov 2023 08:38:44 -0800 (PST) On Tue, Nov 21, 2023 at 11:11:56AM -0500, Ard Biesheuvel wrote: > 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. I have no qualms with this approach, there are no issues with the couple of LLVM versions that I tested. Cheers, Nathan