Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1371158pxf; Fri, 19 Mar 2021 06:00:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfmyxcnLkntfWUniHU14ry6wRk9w21wS604uQht3pK6h2Bi9PwNQ8j/BpmqiVzAO6YLiSh X-Received: by 2002:a17:906:1a44:: with SMTP id j4mr4210977ejf.401.1616158826365; Fri, 19 Mar 2021 06:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616158826; cv=none; d=google.com; s=arc-20160816; b=SCS85Y1gKlaVmu5sQMn/WFeD6v3sHmSw3zXJLi1SOjAp6UHDyDNZ6kLqU3ERxFrn1r uzXgCxoPv4+3vsXWY/0Qh+KkhcF5BXXkx4vL4vOuEo8NnWV0oE8uJNxYfrKf8YyydUeg Kuojkb/RizHbYVuAjWBWoQYUDL6uV6B9Ry9iMU9Y7gtTR9arTi5gwkSEBKsFBSBU6Rb8 LDNSkMU82R79K+DI3PjSiTrxFVfbBwocYDR6mW/3DjpNJbfz6u9kPwbH6VZElGtDzhbj tkhMduaUZmrNQ132W0sW9c1gAxOQpHjmPPMiQ1bPpgRn2uHBvVepQ2aOaAi687cD5klP 8MTQ== 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=uKLSFVK4/FVoE33LX9TEzOYj6GuTaONNt/jzVlHJ8zQ=; b=YgPIIHLcZOOKAw6SBkiOTzhY8tfAfzaW8C2ou4SHfEjme8REgQ9+Yjwdlhd1/ze4HF xWaxT5j43mXJJYHOWZPj0WGioofjtFnu4+CR2WVBoP2P3tpFjagYrDSEVlDpza2mU7QL owfiisVzid1wCyE4Gv04VucayMdWc37ZiGvxjNTS0VEVZCIZ0A9zccxSXaqfbSk48CeI w56XOWso81Sps9rzxTCzCAPkOYbhyCBl8zHNMaKCF9a5mskJYItLbvb2aVhKYZs+UKfc kKZEkBSjUkzaOE8EDydeJz1mefAGDHDMVashouaU/hRL82R/0wFVAS+MuwJdcRLZsCCp Ldew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rnEBj6oI; 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 s16si4350170ejz.72.2021.03.19.06.00.02; Fri, 19 Mar 2021 06:00:26 -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=rnEBj6oI; 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 S229956AbhCSM6y (ORCPT + 99 others); Fri, 19 Mar 2021 08:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230039AbhCSM6u (ORCPT ); Fri, 19 Mar 2021 08:58:50 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81BF7C06174A for ; Fri, 19 Mar 2021 05:58:49 -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=uKLSFVK4/FVoE33LX9TEzOYj6GuTaONNt/jzVlHJ8zQ=; b=rnEBj6oIHWoBHTxeDus3fJueSL 6LaBATWqTjP8FVl5w83nTFsAtg8JkHDvR0pdRSmhyv4qycjZ8BUa51CcUaV1Tf38HFfGv+JF9ojob C9yATU1BZZW8Qqhwuc3eIWUvPD2ftIhXUKnYNU2+i8B40liaZ6I2UhU+RNjK1k/2xsgQQJ4K7UvZM BOaHZ4qcGxY4LeeCe3eWmg2Vn07RBU3sQ0ptw07w93gqnTUsPCD9oCczHeKAbWphCgghyP0/EbXPR YLpfpH9bftPwZAEszP76STYY+UBH9dBwnTbW6E+a8vVoClQRPCzx5DGL9CaXtp+BQ7Sethy7VP1Dy Vpi21zMQ==; 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 1lNEhA-004QG5-6D; Fri, 19 Mar 2021 12:57:41 +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 216D83006E0; Fri, 19 Mar 2021 13:57:39 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F416721244620; Fri, 19 Mar 2021 13:57:38 +0100 (CET) Date: Fri, 19 Mar 2021 13:57: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, jeyu@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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 18, 2021 at 05:58:38PM +0100, Peter Zijlstra wrote: > > 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 !MODULE_UNLOAD (obv) > 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. Jessica, can you explain how !MODULE_UNLOAD is supposed to work? Alternatives, jump_labels and static_call all can have relocations into __exit code. Not loading it at all would be BAD. For alternatives all we really need it to discard it after init, for jump_label and static_call we additinoally need to the code to identify as init (ie, within_module_init() must return true for it).