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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 79D46C43381 for ; Thu, 4 Mar 2021 13:18:15 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7489C61477 for ; Thu, 4 Mar 2021 13:18:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7489C61477 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc: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=J+ZggbScSvfwkSoXXatuTXVlXe0ZC0vYTo9TOtMVapg=; b=LZ2+nxzGTBLvr6OK1ngomYTxJ KkiISbRlm2q0OOeT39TjunRgXTrAcHBIeUgG45MiOb+5DqlXY1xtDtx5iML+zNrnpuVOUT5ddkOs5 +U1h7kg8lyg+qkQ2YpvD8hvbx+XYdyUmE81uwxuUZtNGTmqIU+WewQcYDDxeg8w4lGaWhB1MSwSNC L+uVty9B3SSglrbMMxllySwlb/rAl2dP3Z4P2OSQYBNBzt36ojlP2BmCQjDdXGfnZ7qUsU8Z8yOLI fNJtngg/5aDtAuBMBOMYhmhQsUMVvsF/WmfAsDlWKXI+yulxmdQdcDIqmqJL6fdw7xrLA5tGMTePv JcCl5t8BQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHnje-008hYp-VN; Thu, 04 Mar 2021 13:09:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHnik-008hSZ-AD for linux-arm-kernel@desiato.infradead.org; Thu, 04 Mar 2021 13:09:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xXzyIxbVNfwddnCnD7dUV9t/WY7tFQKgivsvWjwgN6g=; b=lGoTSDt/wxZ0vQeqw+jxe7nMZi ezk59veDSTJcz7zFqUL1ivejWGEq45/1PukRr217p3f1xCSQxWnsvz7KKGBcn7ViOrBobGjxNEnhH VKmG5hTVzCHcgBvetovURfFfsSYcoEf9lHiTZHz5ufXV6kJSI1+2fA+L2aqXNOcEk/DLQWC29nP4y +Rsb5agpOWB3Hn4zh9KMHHwizRO60dnlZVahfOwUuLwHpWtP0qP+aMLGSZdmBECD9cK3siwNjaCU4 UN56Ety97sfpUUfIecCP9yyPioWFFuyDRgiGiNG2Ol/Q3x6nZS9ngfNJgmeCB5ZnCB46Tx8GTpnmA Qj++Q+pQ==; Received: from foss.arm.com ([217.140.110.172]) by casper.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHnii-0078lr-Q4 for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 13:08:49 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AF77C31B; Thu, 4 Mar 2021 05:08:39 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.53.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 601903F766; Thu, 4 Mar 2021 05:08:38 -0800 (PST) Date: Thu, 4 Mar 2021 13:08:35 +0000 From: Mark Rutland To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, cai@redhat.com, catalin.marinas@arm.com, elver@google.com, james.morse@arm.com Subject: Re: [PATCHv3] arm64: initialize per-cpu offsets earlier Message-ID: <20210304130835.GB54534@C02TD0UTHF1T.local> References: <20210302115335.42135-1-mark.rutland@arm.com> <20210304124510.GA20956@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210304124510.GA20956@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210304_130849_302457_2B531EE6 X-CRM114-Status: GOOD ( 15.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 Thu, Mar 04, 2021 at 12:45:11PM +0000, Will Deacon wrote: > On Tue, Mar 02, 2021 at 11:53:35AM +0000, Mark Rutland wrote: > > The current initialization of the per-cpu offset register is difficult > > to follow and this initialization is not always early enough for > > upcoming instrumentation with KCSAN, where the instrumentation callbacks > > use the per-cpu offset. > > > > To make it possible to support KCSAN, and to simplify reasoning about > > early bringup code, let's initialize the per-cpu offset earlier, before > > we run any C code that may consume it. To do so, this patch adds a new > > init_this_cpu_offset() helper that's called before the usual > > primary/secondary start functions. For consistency, this is also used to > > re-initialize the per-cpu offset after the runtime per-cpu areas have > > been allocated (which can change CPU0's offset). > > Is this still early enough now that we have the idreg overrides on the > command-line, which are parsed from C code? Hmm... no, it's not, given the override code can be instrumented and calls potentially instrumented library code too, so we can't just prevent kcsan instrumentation of the file. I'll go give this a more thorough audit, since (while I had previously convinced myself otherwise), the early KASLR bits look potentially problematic too. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel