Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3408374pxf; Mon, 22 Mar 2021 05:55:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/Rj8irB2EMjed5LeasYRqTUUEYvBLG6N9/zGEYPQvPtH/0O+6KyNHIMw1CcAQBE9fYsaW X-Received: by 2002:a17:906:94ca:: with SMTP id d10mr18971152ejy.107.1616417706409; Mon, 22 Mar 2021 05:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616417706; cv=none; d=google.com; s=arc-20160816; b=tFWaOlbBL2mQLy/exUE5k1w5AaD2223LhHgXZK7iY2nJ/9yFXvbElmUSsJ04quYddW 4fUVCyjCmJuuj9x9zwLO4kSStgqOC2xqaPJdkhV6R8CcNrHq4lCjzPYyf7aFd5PS7Uet JAkrE0s079b0dgVhQXtM3VCwDlLJDkFwV8yTtxdTZUAf54zZV73c8rmaRcfpdkx+s4pd b00AjpVawLDIkXEyBfsRb8AnbE9W9hx8/r5638QyrisFezoEg0UgguppYVODSqmUoHOd jDdBNhz7xEQYFxDCnhFg3p8xlS2AxxiU5PWp3Q/PM2JvybBgvVBB1r5iypx/2LzRQ4LW bz/w== 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=ONMDPK30hUBVdTWv3vVDbFevhikLIuJfSVomnKxN2Mgjre4F/mk6i5ZjxANw6vOFL0 ouSRm97SgYydkoU8Nd1uSPz5A7IIdxeqf+MHmjBVhaiWBb1OcWECyOst3Is7dCJ2KpZi AMnoBG8yFodKS28LSzzgq7LVlZKDvlKRu7wlHWFXHKKu9Jm7+A2TyZqiRYV+hSHiR34T v5Aj4yXW+EzXT1GxZP0gR6A02dNeE6Gc4ZjhFw4ngwx2TbwpjK5lKqfim9WS5/G3txH+ JIxIR6Vz+GMhVIkGjMxTl5CXp9a8ZldO2g965s4SjMCWpAFFbZHmZJ7jORPsysB16oth MwLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g5b97X73; 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 h12si12762362edj.156.2021.03.22.05.54.44; Mon, 22 Mar 2021 05:55:06 -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=g5b97X73; 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 S230482AbhCVMxi (ORCPT + 99 others); Mon, 22 Mar 2021 08:53:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:35506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232679AbhCVMnK (ORCPT ); Mon, 22 Mar 2021 08:43:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C5B1619D5; Mon, 22 Mar 2021 12:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616416865; bh=1bawS5OTku2R6D5ze2GbkygzAGmlVC9GfgjGVO+5eIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g5b97X73FN8ntE83pnZ6zgu9y4/LlLRhL+SRtjdDjvjyfUIgH+Nrehde+lO/EXaO2 nzisWLuW9sBQjhPe+neo3uSZg0/Q3PZ1vrRwEX571IvOO50Pa6LdmrfLLegyqht3IT arXe1CwV19aczEEvRevJTVOrbb2psOk0vBUYAe7E= 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.10 153/157] static_call: Fix static_call_update() sanity check Date: Mon, 22 Mar 2021 13:28:30 +0100 Message-Id: <20210322121938.596306243@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210322121933.746237845@linuxfoundation.org> References: <20210322121933.746237845@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; }