Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3399818pxf; Mon, 22 Mar 2021 05:41:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz62qDnPNP1zle++qW47dgpDpDnBKH9JzA/pJ5HWUF8Za/pCF72Sx6s1VnUgkf+8TfxPXmp X-Received: by 2002:a17:906:1e4f:: with SMTP id i15mr18696283ejj.349.1616416888978; Mon, 22 Mar 2021 05:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616416888; cv=none; d=google.com; s=arc-20160816; b=i4n9FvFiFS8X+1172bzbIqZeMN4YsAwdFzCbtks5KD7RmB9WwZamGSrrlyB4NJTYq0 kE12lh2sNubZnOK5/2eynqjjr1N1G4cgN2XbHl4DBzdhU3Vu5DNpBLBqVSgiJd9PbL1U wsdB74RoqR1vlvhG2KCRh+qh4vboe90iSGyzO5QJ40olYlJIks/w6coP8TfCjSmMczb+ 70WBpTHfgUbX6o36ShbsX03TAjfxiFir0sD2tKbxVVvpInnBOKVaWtN1p5wa+S0RW2PC g1vEFckjOxjqrijDC1PfD7A2tiYLLBDxKqmNCbwtx94VHztffZVUPFiyFxGG42jNvoEm ke5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HHg1gbSeZagWiJDcU+XLA3he8X5IrKDa3ShOfx4O/mA=; b=zWaAeh/+Yev1+1S4CkGhV5mDqJsLpsUjXGh//0pNUpynT8u6sbk4CzmojUNKzg9oGP 7Y2OkjWCni23kTPckWqiU4Q2LeEIBHdvuNqx/xa4ipOIUl8OtnLIkvWiUwjYwtMtb515 +Ev2B7VF341QNXF15MiHQX/0uM8QU/PmLITiFMf/JFdG5i+TOxNpl+DgKK5xmeJkJEH8 CSnbQM484dsLYcp7OrESGdup5I2Yk7SA6TBzeLuJMppUhb5wj8uQyWtkBGoIp/Xpqnp1 Ry4C5rGelagD97gZBDbh3LPxKwA9cr852SY16SKJJEVXM/U2Janz36GoIGdKbU5c6R+e j/IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="neBu/Xds"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si11276578edq.584.2021.03.22.05.41.06; Mon, 22 Mar 2021 05:41: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=@linuxfoundation.org header.s=korg header.b="neBu/Xds"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232083AbhCVMkF (ORCPT + 99 others); Mon, 22 Mar 2021 08:40:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:56988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231748AbhCVMfA (ORCPT ); Mon, 22 Mar 2021 08:35:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21B29619B3; Mon, 22 Mar 2021 12:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416492; bh=1bawS5OTku2R6D5ze2GbkygzAGmlVC9GfgjGVO+5eIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neBu/XdsMH5HX0WqJr6cw+WiEf9u2WWgNSrwNsVqmgD/3+Sd5vYirP+4dvA/8kAru k1nWgU3K4vEqeY9snVGvOC57K7MqqLsjKD+lrebqxuiF9i8IhshJNkjW/Ffj6NKSz5 j2Ey348YHHkFAdBK3k3dJ9Mpb9RrKX91CMjxdy6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , "Peter Zijlstra (Intel)" , Jarkko Sakkinen Subject: [PATCH 5.11 116/120] static_call: Fix static_call_update() sanity check Date: Mon, 22 Mar 2021 13:28:19 +0100 Message-Id: <20210322121933.533656699@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121929.669628946@linuxfoundation.org> References: <20210322121929.669628946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra commit 38c93587375053c5b9ef093f4a5ea754538cba32 upstream. Sites that match init_section_contains() get marked as INIT. For built-in code init_sections contains both __init and __exit text. OTOH kernel_text_address() only explicitly includes __init text (and there are no __exit text markers). Match what jump_label already does and ignore the warning for INIT sites. Also see the excellent changelog for commit: 8f35eaa5f2de ("jump_label: Don't warn on __exit jump entries") Fixes: 9183c3f9ed710 ("static_call: Add inline static call infrastructure") Reported-by: Sumit Garg Signed-off-by: Peter Zijlstra (Intel) Acked-by: Jarkko Sakkinen Tested-by: Sumit Garg Link: https://lkml.kernel.org/r/20210318113610.739542434@infradead.org Signed-off-by: Greg Kroah-Hartman --- kernel/jump_label.c | 8 ++++++++ kernel/static_call.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -407,6 +407,14 @@ static bool jump_label_can_update(struct return false; if (!kernel_text_address(jump_entry_code(entry))) { + /* + * This skips patching built-in __exit, which + * is part of init_section_contains() but is + * not part of kernel_text_address(). + * + * Skipping built-in __exit is fine since it + * will never be executed. + */ WARN_ONCE(!jump_entry_is_init(entry), "can't patch jump_label at %pS", (void *)jump_entry_code(entry)); --- a/kernel/static_call.c +++ b/kernel/static_call.c @@ -182,7 +182,16 @@ void __static_call_update(struct static_ } if (!kernel_text_address((unsigned long)site_addr)) { - WARN_ONCE(1, "can't patch static call site at %pS", + /* + * This skips patching built-in __exit, which + * is part of init_section_contains() but is + * not part of kernel_text_address(). + * + * Skipping built-in __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; }