Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp720266pxf; Thu, 18 Mar 2021 10:01:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc/MiMtSwZXRv30jspefooTZRCh2Zy+gJqlmlH7B05G2PPAhR7nBmk+nHJBMpi0SdKCDbI X-Received: by 2002:a17:907:33c6:: with SMTP id zk6mr40739557ejb.228.1616086902237; Thu, 18 Mar 2021 10:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616086902; cv=none; d=google.com; s=arc-20160816; b=FB2L6DCAVytUo3IVfDXMYUJeRa3zCaVASLR6f06IVAnp5Z9M/ARfOGWAfmkiLuOvHo DIvO3yj2GTA7HpQE6sPm24VvBY7k4HCYpKlTxsJ+sSoCxCEQhPHCeCHkL3NcMDv4uFes 0Owt1NLd0b2/FdJoDYGdeOuuCEVlMlciInSrN3PXXXmGNElN6gNLJ+RuLSONWyXNlb6R D131wp+T1ESPgYC2g1hPS8dKdBSMH3M8AUoYubFgYQU/zI6ySnvW/9vYmZNKONYm+6az u0n0VA/T33ff06U4IB2GhTxRz8+z2vibGMhaYbKCRYgJP8w/X9zjOAR0lCzj1yC04r8x FYhw== 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=pBMCG5FN4Ujt4bhtCchnpc3UVNfel7XA97T/t//xc88=; b=vQqDXBdavOSr0+F6aPu0/+Nwnaa6Z44j/0yjIsAr9n7bUnDBcIeayJxsTnslCaN8JB FRLnMhR9+m7agYwE1+DC5pTborzBIPhR6RLB2bzeA0lk3mMKbvVWmLQpbTG18Ye0Et0k TElm1PPtRkAhi/eiT7uJYhIRkGtX49fmG/Ho0igGcFgfr9BwLXbR52qOHChWeWUk8h4M iFCTWJU0W8Qn9pk8P2RFSb1T9xB8ycyMPG8GKVLDHkDBt5JpsZHfsTI8NbTAtrto6Euz hYfUxMWrXM5g5H7sWETYaFFekhN4o0bj/+/3WMogKhFuGiiXWOu8slwPMSuq/rHnYFkJ jjsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CkaN3OxB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw21si1977418edb.344.2021.03.18.10.01.18; Thu, 18 Mar 2021 10:01:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CkaN3OxB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231998AbhCRQ7q (ORCPT + 99 others); Thu, 18 Mar 2021 12:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231853AbhCRQ7X (ORCPT ); Thu, 18 Mar 2021 12:59:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27206C06174A for ; Thu, 18 Mar 2021 09:59:23 -0700 (PDT) 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=pBMCG5FN4Ujt4bhtCchnpc3UVNfel7XA97T/t//xc88=; b=CkaN3OxB7tlQh5rjB6XsiU9y00 9wtcSuBCtpVqrCfjXaQVx8wEJ2/rO3rUS14xLdWa8DGseOxmEHsouD4s9Ll+4Zfri+yPH3lNl/sva CswI/ObrGCZQ7Mojh8A7VJ5cap1HmraveY8i6RJbxozjhZaK8mX8Iha8CR9i0GI7fkJo5M7LeYPsP ur5ngVNb7tx7URNccnwqmWvTncnFs/D43R/XYK9Vb7kQ3XfVFhjeWxUevniWfsAn/mjvqYB0Lkljb Fh+OHaZZmzJzdHOu0KiFhpD3SkpjmCsJXOt+YHsCm/DRT/FXjAtPmx9ux7bb1NvXVgJqDNnITu2js sp0zPVZA==; 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 1lMvyp-003Ffx-Pi; Thu, 18 Mar 2021 16:58:42 +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 C670E3003E1; Thu, 18 Mar 2021 17:58:38 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A98FB21244792; Thu, 18 Mar 2021 17:58:38 +0100 (CET) Date: Thu, 18 Mar 2021 17:58:38 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, linux-kernel@vger.kernel.org, sumit.garg@linaro.org, oliver.sang@intel.com, jarkko@kernel.org Subject: Re: [PATCH 3/3] static_call: Fix static_call_update() sanity check Message-ID: References: <20210318113156.407406787@infradead.org> <20210318113610.739542434@infradead.org> <20210318161308.vu3dhezp2lczch6f@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210318161308.vu3dhezp2lczch6f@treble> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 18, 2021 at 11:13:08AM -0500, Josh Poimboeuf wrote: > On Thu, Mar 18, 2021 at 12:31:59PM +0100, Peter Zijlstra wrote: > > if (!kernel_text_address((unsigned long)site_addr)) { > > - WARN_ONCE(1, "can't patch static call site at %pS", > > + /* > > + * This skips patching __exit, which is part of This skips patching built-in __exit, ... ? > > + * init_section_contains() but is not part of > > + * kernel_text_address(). > > + * > > + * Skipping __exit is fine since it will never + built-in, again > > + * be executed. > > + */ > > + WARN_ONCE(!static_call_is_init(site), > > + "can't patch static call site at %pS", > > site_addr); > > continue; > > } > > It might be good to clarify the situation for __exit in modules in the > comment and/or changelog, as they both seem to be implicitly talking > only about __exit in vmlinux. Correct. > For CONFIG_MODULE_UNLOAD, the code ends up in the normal text area, so > static_call_is_init() is false and kernel_text_address() is true. > > For !CONFIG_MODULE_UNLOAD, the code gets discarded during module load, > so static_call_is_init() and kernel_text_address() are both false. I > guess that will trigger a warning? Oh gawd, more variants. Afaict MODULE_UNLOAD, by virtue of that #ifdef in rewrite_section_headers() won't even load the .exit sections. Afaict that will break: alterative, jump_label and static_call patching all in one go.