From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 777F924B28; Wed, 20 Nov 2024 17:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732122808; cv=none; b=kim9MTD8L4XTKsagwPeTFRXLT6254tnQvBapFHAby5cNfmH5zOUaksS+c6o9FW7yMvtU2duBqoVBXRMr6r/IqGi2ZAuNmQNE5k/5sEiIvTya/BVacXvcGhp31XLg+nvbRzDc0Uf4GP0NfNx4lE8UjJR7cQdK9U6XTxv81/pr4EE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732122808; c=relaxed/simple; bh=jz3HdoluyP/zpxZDP2VMKKAfsXgettCvfGsGqVKKJpA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lpMZSqjeZFuVU87Qxz4a5ZY7GhzH8++b7o0zsZBxmfc++moNGH3zg7P38sT0Hmb6AekR3VJfoh3REVHJH8cDcQQd2EO2SbZclrJ/2WaXLPMJREdVPMuwk8r2jToR0yXg7qcr+bHukADxrKKRNEfRaXRPlK1E25CLRe7ceQAgnZw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFEAEC4CECD; Wed, 20 Nov 2024 17:13:25 +0000 (UTC) Date: Wed, 20 Nov 2024 09:13:24 -0800 From: Josh Poimboeuf To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Juri Lelli , Marcelo Tosatti , Yair Podemsky , Daniel Wagner , Petr Tesarik Subject: Re: [RFC PATCH v3 09/15] objtool: Warn about non __ro_after_init static key usage in .noinstr Message-ID: <20241120171324.a4yteg2mhkdeyymf@jpoimboe> References: <20241119153502.41361-1-vschneid@redhat.com> <20241119153502.41361-10-vschneid@redhat.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20241119153502.41361-10-vschneid@redhat.com> On Tue, Nov 19, 2024 at 04:34:56PM +0100, Valentin Schneider wrote: > Later commits will disallow runtime-mutable text in .noinstr sections in > order to safely defer instruction patching IPIs. > > All static keys used in .noinstr sections have now been checked as being > either flagged as __ro_after_init, or as forceful static keys. Any > occurrence of this new warning would be the result of a code change that > will need looking at. > > Suggested-by: Josh Poimboeuf > Signed-off-by: Valentin Schneider > --- > offset_of(static_key.type) and JUMP_TYPE_FORCEFUL would need to be shoved > into a somewhat standalone header file that could be included by objtool > itself. static_key and JUMP_TYPE_* can be moved to jump_label_types.h which can be included by jump_label.h and also synced to tools/include/linux for objtool to access. I guess objtool would have to "#define CONFIG_JUMP_LABEL" before including it to get the full definition. > @@ -3605,6 +3608,41 @@ static int validate_return(struct symbol *func, struct instruction *insn, struct > return 0; > } > > +static bool static_key_is_forceful(struct symbol *key) > +{ > + if (!strcmp(key->sec->name, ".data")) { There are some configs (and more coming in the future) which compile with the kernel with -fdata-sections. So this may need to be something like if (strstarts(key->sec->name, ".data")) -- Josh