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=-4.0 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 27791C433DB for ; Fri, 19 Mar 2021 12:28: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 B272264F6E for ; Fri, 19 Mar 2021 12:28:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B272264F6E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org 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=DHFkgGlAN/VEXtfjHbKJEbODgEAnu7wDeWK5lCpk2gQ=; b=ZjJX0ogj478lEK8HAKpIsABKl mb1n9zY3w6B8/EvsduYUuBboAfldGLyMiG2nsIKaiTHcPYxrF0W9JLQKmHLNtFWzVzmVP46MM8HMM cDFBNqeR5GEeoEnGCj0+yVPGivGATA/14cxS5U8/5JE0C9WYpPQUm4BKVIM18Ys0G2cl1xRcK814G B1yiAGDyjASpPCNRyYUwne9N51f5EReR1i60YZ9V4efE3YJHs2hGeFy+e01/zj+CQ4HbPRnenI0ke S1z04GDnJbPn9K+RSsu6mZVNYTr6CEAzEBPwTTdXzMLrHNp/xs0tYFlNsgbf8ry8Mq+zxTqRqjPdJ qRwLAHFzw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNEDm-007Ok9-Ho; Fri, 19 Mar 2021 12:27:18 +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 1lNEDj-007Ojt-Vj for linux-arm-kernel@desiato.infradead.org; Fri, 19 Mar 2021 12:27:16 +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=HGGyfd8GrXRUYl8t/lIrcBczKW5EZl0r2vGbtH69BjM=; b=adFFxpGZQzg62xh/9Ba4l9lwfu F6vR/ZaT6jVOK8XBdN443zktlYfZQFE6KzBnW5MwH3eVqjWSvBEUOKrp/4w94gPSdWAWxhHJ3V1wM JHocPFEFyKktLVXuAuzwFOWOp/KNeXMoG9xD4e0pSSw5guUU6iX3zwS+9iJaXvGVtoak9cQUiKXdk aaTRO8gzVbVR2DUv+LCZp6q/nOcMAZFn5oDnxPol2/x260iyr/gFYohOT8wUIn7bWOGSaBBFsHhXM 5W9vjiPOxO3G/F43MluX4VccPO0R+IdphdHCQCiZ5xy5MJJ3Wg5a8xTujshBLU4gCmsDllD60Lvyz 4nI6ItgA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lNEDU-004Ogd-1x; Fri, 19 Mar 2021 12:27:01 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8E33C307975; Fri, 19 Mar 2021 13:26:59 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7709D21244621; Fri, 19 Mar 2021 13:26:59 +0100 (CET) Date: Fri, 19 Mar 2021 13:26:59 +0100 From: Peter Zijlstra To: Sami Tolvanen Cc: Kees Cook , Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , bpf , linux-hardening@vger.kernel.org, linux-arch , linux-arm-kernel , linux-kbuild , PCI , LKML Subject: Re: [PATCH v2 01/17] add support for Clang CFI Message-ID: References: <20210318171111.706303-1-samitolvanen@google.com> <20210318171111.706303-2-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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 18, 2021 at 04:48:43PM -0700, Sami Tolvanen wrote: > On Thu, Mar 18, 2021 at 3:29 PM Peter Zijlstra wrote: > > > > On Thu, Mar 18, 2021 at 10:10:55AM -0700, Sami Tolvanen wrote: > > > +static void update_shadow(struct module *mod, unsigned long base_addr, > > > + update_shadow_fn fn) > > > +{ > > > + struct cfi_shadow *prev; > > > + struct cfi_shadow *next; > > > + unsigned long min_addr, max_addr; > > > + > > > + next = vmalloc(SHADOW_SIZE); > > > + > > > + mutex_lock(&shadow_update_lock); > > > + prev = rcu_dereference_protected(cfi_shadow, > > > + mutex_is_locked(&shadow_update_lock)); > > > + > > > + if (next) { > > > + next->base = base_addr >> PAGE_SHIFT; > > > + prepare_next_shadow(prev, next); > > > + > > > + min_addr = (unsigned long)mod->core_layout.base; > > > + max_addr = min_addr + mod->core_layout.text_size; > > > + fn(next, mod, min_addr & PAGE_MASK, max_addr & PAGE_MASK); > > > + > > > + set_memory_ro((unsigned long)next, SHADOW_PAGES); > > > + } > > > + > > > + rcu_assign_pointer(cfi_shadow, next); > > > + mutex_unlock(&shadow_update_lock); > > > + synchronize_rcu_expedited(); > > > > expedited is BAD(tm), why is it required and why doesn't it have a > > comment? > > Ah, this uses synchronize_rcu_expedited() because we have a case where > synchronize_rcu() hangs here with a specific SoC family after the > vendor's cpu_pm driver powers down CPU cores. Broken vendor drivers seem like an exceedingly poor reason for this. > Would you say expedited is bad enough that we should avoid it here? > The function is called only when kernel modules are loaded or > unloaded, so not very frequently. Module unload is pretty crap (it has stop_machine), so an expedited would not really be noticable, but module load isn't nearly as bad. Also, getting the vendor to fix their driver seems like a good thing :-) So please consider using regular synchronize_rcu() here. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel