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 A323EC433E0 for ; Thu, 4 Mar 2021 15:04:39 +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 3758464F51 for ; Thu, 4 Mar 2021 15:04:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3758464F51 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=SA6DeHVn9eEXfGuXFhyn5OzyeyuhWZQvqMZZVewDjlk=; b=hRker67TDbCW6hxl7LRGjX07x g4ACty5LIBAXmoSGKOVeUweT9NscoNNq8MY4AqJkOXC/fy7VgybV5mMdbH+E6KNiKERoqokdsQ5cm wrkRNO5f2WeMMxfQjlPg3CrAOpMxuwNWExHbDaHdKVsthniAz5pulmv5apgVerZXntSJwg95aLFkk 0BryNSFdI3MG9cnq/NvF1btNQoAIXl7owHDu1Ghi0h2r61LB4YCxCsO9RSqOKN4Fsho6i7fiAQEvt AQ5CY2ODWIItvqVLFkk8+4tUW1po9RmBbhQAVbGW3kmg51gs/MYVthQZtYK8+a5+BDEw0jducRIDm tPpJIQvvQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHpUe-008yun-E9; Thu, 04 Mar 2021 15:02:24 +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 1lHpUa-008yuJ-Hf for linux-arm-kernel@desiato.infradead.org; Thu, 04 Mar 2021 15:02:21 +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=fDhdF0Jd6K5ablRf8tZlcmrHHyugSJoRQvrBvfpbxNI=; b=tdyn0z+xP23+LW4pGph5A+PIRa lHZ114TpWFJ04lasQAK3nc8npMbY23TMns1c/xuyfadJt2d9qsNLfeBwTBT+OoUuH6V1aVqc+JI0A 4dwdIQtuZsVw1ELASswrx4r6ml04RdcsNY/WcJqHcgIBhZh+7psbCzLNRKH7fatu2trU5OAo933Yv +hAkd9YgMK7v8kjRhFRRqfg7w9idpU69zhbJxe3wQ8VQzgs4mBzeXNhNL7sXGsNn2I290owkC7hVh GWKmPA0c8GMOr3RXgyKf773DuEP32kY+JkEF7oKwCmREsRu4M1R9xEq1XPSWDCLow/eBx8mwm7o7U 07C37zmw==; Received: from foss.arm.com ([217.140.110.172]) by casper.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHpUL-007Uws-Ha for linux-arm-kernel@lists.infradead.org; Thu, 04 Mar 2021 15:02:11 +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 471E0101E; Thu, 4 Mar 2021 07:01:55 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.53.210]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CD08E3F766; Thu, 4 Mar 2021 07:01:53 -0800 (PST) Date: Thu, 4 Mar 2021 15:01:51 +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: <20210304150151.GD54534@C02TD0UTHF1T.local> References: <20210302115335.42135-1-mark.rutland@arm.com> <20210304124510.GA20956@willie-the-truck> <20210304130835.GB54534@C02TD0UTHF1T.local> <20210304133023.GA21229@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210304133023.GA21229@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210304_150211_849498_04997080 X-CRM114-Status: GOOD ( 22.30 ) 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 01:30:24PM +0000, Will Deacon wrote: > On Thu, Mar 04, 2021 at 01:08:35PM +0000, Mark Rutland wrote: > > 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. > > Ideally, we'd be able to use KCSAN anywhere we can use KASAN and then not > have to worry about the two independently. Yup; I completely agree -- that's the "simplify reasoning" part of my rationale. ;) Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel