From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 DFB483EF657 for ; Tue, 5 May 2026 08:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777969562; cv=none; b=SLD0RcpeouS6Qb0cg865i7AGVGLeJfHvrcAcgnNd3eeebCHr8kP7MPTAl6KAXea5n0Y1/fpsMXdkgQihNdqn5V8898FBLMscQ3Ifr4qqGXjK0t54IAKD/jeWYEV/llgKtuqG1vAsU2u/ueY2DUUKHjbNTU88q+K5gJGBtB2WoEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777969562; c=relaxed/simple; bh=6iwokohqct5jOJXocIayIe9Xtpf9bQT4/K6xYRd41fE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F+gnMAzcOiwudeN2VZG2Q7RS5Qr/K0pknxq0Rgnfe7SbLJHuSz450kpNScNRLXLvcJ0vDnNkxP5598SonjQnPdZsU/aZO0AMelSc0MtLStIb27l311y/Si3GQQDN7om58JNYN0kzfmoeqg/RAtt3i/Un/syNaSSHMGE8sNRbSDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NEEN2lEL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NEEN2lEL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1777969560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7gsMdRwe6f8nfnzql67PXdPtXLWn8XHtAqrkCOyrxHE=; b=NEEN2lELQXWgfQWW93/CtA6yzbpRoVqc00unYwrImbGsuzYXd/ZnpMgPYZ/bHJGTjBr2ce PM3If02BbKeV1CvMPaaxZsZ25Z5luTfn1LZ2sNACJopKS6NBxVik7tYbwNGM8LFMPTs1z8 /qmWe4fv4EI5sLJ1XmbS0cBzAKa/+AQ= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-vNbTdYtOPay9rcVFW-zwGg-1; Tue, 05 May 2026 04:25:56 -0400 X-MC-Unique: vNbTdYtOPay9rcVFW-zwGg-1 X-Mimecast-MFC-AGG-ID: vNbTdYtOPay9rcVFW-zwGg_1777969552 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C0D5180049F; Tue, 5 May 2026 08:25:52 +0000 (UTC) Received: from vschneid-thinkpadt14sgen2i.remote.csb (unknown [10.44.48.109]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 45D6C30001BE; Tue, 5 May 2026 08:25:39 +0000 (UTC) From: Valentin Schneider To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Cc: Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Arnaldo Carvalho de Melo , Paolo Bonzini , Arnd Bergmann , Frederic Weisbecker , "Paul E. McKenney" , Jason Baron , Steven Rostedt , Ard Biesheuvel , Sami Tolvanen , "David S. Miller" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Mathieu Desnoyers , Mel Gorman , Andrew Morton , Masahiro Yamada , Han Shen , Rik van Riel , Jann Horn , Dan Carpenter , Oleg Nesterov , Juri Lelli , Clark Williams , Tomas Glozar , Yair Podemsky , Marcelo Tosatti , Daniel Wagner , Petr Tesarik , Shrikanth Hegde Subject: [PATCH v9 05/10] jump_label: Add annotations for validating .entry.text key usage Date: Tue, 5 May 2026 10:23:50 +0200 Message-ID: <20260505082355.1982003-6-vschneid@redhat.com> In-Reply-To: <20260505082355.1982003-1-vschneid@redhat.com> References: <20260505082355.1982003-1-vschneid@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 From: Josh Poimboeuf Adding static keys to entry text needs to be done with care, as they may be executed before a context serialization operation has been run. Add DEFINE_STATIC_KEY_*_ENTRY() variants for those. They don't do anything special yet; that will come later. Signed-off-by: Josh Poimboeuf [Reduced from .noinstr to .entry.text] Signed-off-by: Valentin Schneider --- include/linux/jump_label.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h index b9c7b0ebf7b9d..e05b4a52ba1b4 100644 --- a/include/linux/jump_label.h +++ b/include/linux/jump_label.h @@ -374,6 +374,20 @@ struct static_key_false { #define DEFINE_STATIC_KEY_FALSE_RO(name) \ struct static_key_false name __ro_after_init = STATIC_KEY_FALSE_INIT +/* + * Objtool will warn about static keys used in early entry code, as they may + * be unsafe if executed before any serializing operation. + * + * The _ENTRY variants are used to tell objtool the static key is safe to be + * used. If using one of these _ENTRY variants, please add a comment above the + * definition with the rationale. + */ +#define DEFINE_STATIC_KEY_TRUE_ENTRY(name) \ + DEFINE_STATIC_KEY_TRUE(name) + +#define DEFINE_STATIC_KEY_FALSE_ENTRY(name) \ + DEFINE_STATIC_KEY_FALSE(name) + #define DECLARE_STATIC_KEY_FALSE(name) \ extern struct static_key_false name -- 2.52.0