Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp683556pxf; Thu, 18 Mar 2021 09:15:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr/QpKPTmYwLwB4MKcweb5GhWuwLZjiCxWChdKE6rM5AIGXD7mWw9+cuYbED+sKkW4IDGV X-Received: by 2002:a17:906:b884:: with SMTP id hb4mr41387991ejb.536.1616084128514; Thu, 18 Mar 2021 09:15:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616084128; cv=none; d=google.com; s=arc-20160816; b=D/FJcwm4HkhtUvko9A47g+IYqhBPovpr9rpNDZcoEZbapRGIoTndLQgaNujdC9chYN nb8XJfXD3eaYwHbBjyvxbh4l7HbAb7b4jlT3ETs0oOYKujXVcyWi8bWepBdmGtZFa8PA MBc1ZYYS2oPZ8bZQP/9Ffy6j1rDhEKzeGQZFXh5kKPBLYyQVsZ35e4LSWjUmIl72ubF/ FtjC39AQ6gPB3f3VcaPA4fxiZiIBitSxShEzJXdtZIEinS3i//AsHLVygl5UTe00A6vT QtV7A2yn2CmzHZVgtQM9SgjhmfzhRIvmri4tQVO7tLVZl1VwcPlfj+BQEaJKLELj2C++ GEDA== 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=kMSvyN97t/FS7XtBv6QH+5q8tp+bklDt3LCkE++41RA=; b=KEeR8tX4k/T0C8YVes64QxRyDkB/F8qCdmbo8dlILcBqXMzbDeeY8UckyjGDsp4Kcg HIhTK+8gNQwZOvM/O1oyb4+EF4TleDgUxFMVhhnnFjtZHJCe6f1ck+TPfD3VRF0Qz5v+ qrT+kIEiE1P3dULXBchEGAPAp1XZC2zVVyNzVuOjUu8W1/P02/xLJXuxgq+ikCWJCvDG Vt/oN/BaNeesWF5d7/G6LDO7k7nX8ad3NCafztkZMp/NGz2GRufZ+qbKZPM+sJ9ToDLf Aes6Kayo2FWPorp/NfrVTUv5+q1+JJTiy6GOrE7nN5bNs/xyrfDeRtEjKkElKC/wZXEa L1fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MnXePYUv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si2049863edm.44.2021.03.18.09.15.04; Thu, 18 Mar 2021 09:15:28 -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=@redhat.com header.s=mimecast20190719 header.b=MnXePYUv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231907AbhCRQNZ (ORCPT + 99 others); Thu, 18 Mar 2021 12:13:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41068 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230425AbhCRQNU (ORCPT ); Thu, 18 Mar 2021 12:13:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616084000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kMSvyN97t/FS7XtBv6QH+5q8tp+bklDt3LCkE++41RA=; b=MnXePYUvn+iP0DlwPYzkiZdARlKEZXYdP+1IjXELltrCXD76y5Q0MLLIM6h+/hw0RT/gOH DJzPObmV9/oGURQrRxd9DsP2WSTYqOon1mU+KcCBpb+WLEdB2CWHZN1oN0d+svQzCEVqmb O8G0VXwP0iggljHwbxyRSCurYdhgvV0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-597-cskwBhpdM0CF8lw15OFqhA-1; Thu, 18 Mar 2021 12:13:16 -0400 X-MC-Unique: cskwBhpdM0CF8lw15OFqhA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E5CD81620; Thu, 18 Mar 2021 16:13:13 +0000 (UTC) Received: from treble (ovpn-120-92.rdu2.redhat.com [10.10.120.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E0CF5D9CA; Thu, 18 Mar 2021 16:13:10 +0000 (UTC) Date: Thu, 18 Mar 2021 11:13:08 -0500 From: Josh Poimboeuf To: Peter Zijlstra 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: <20210318161308.vu3dhezp2lczch6f@treble> References: <20210318113156.407406787@infradead.org> <20210318113610.739542434@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210318113610.739542434@infradead.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > + * init_section_contains() but is not part of > + * kernel_text_address(). > + * > + * Skipping __exit is fine since it will never > + * 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. 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? -- Josh