From nobody Mon Feb 9 10:28:27 2026 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 207831925BA for ; Mon, 23 Dec 2024 09:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734946752; cv=none; b=UQWSt/3T6XCGyu896vkgs0C4Mlwgh6996XzNctYcht4E2DCP0/bTwqAsVuqH9zQNLnpt4RDc3HxFGn7I7zZpAWwul75z3hlidEQS3ozgLyvESrTz/MlVHUcDUkOdCl8L0S0ZfHARf7ULq6lhYRp6u7hTPzQ+OTj/sJJIuSAIRwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734946752; c=relaxed/simple; bh=UH4xbEe0zmFXOwPUKrl24/lhmUI7cbLTQl/c73IEBaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GhXIvictY7lXLAIKgDBX1R6tFDiU4QQNynM3PAgJ4SOuQxsgFfQ6zdR6n6U8XH+KVM/BQ7NPX/1BWyDDY09fJrdgEeOFPCiJjrxpyvmaTFJ5madHMXMISQC/ZpNpQJLPbj52/PGSXigzumzHILsJqAyjh6Zla1JCvyu4V6TjSHo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=fxR+k1WO; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="fxR+k1WO" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-38632b8ae71so2987435f8f.0 for ; Mon, 23 Dec 2024 01:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1734946748; x=1735551548; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HLu09/IZb76vH1AepGLoCNTFGrmu/5Ir8RKortKBDcM=; b=fxR+k1WOP+yrLzNAlMDe3uKprLZKgG/wgPAJpEQFWc4omwMB4MGvtsscFZBbKd4K6Z FGpqC8dSg1Q1uzWEbcNxnx46ameWzFpk2lLG9I9S943XqtOdl3wxBVDqlva9Ilecx0hK m84uPkygCY3v+85a3XFdPy0Kg/UYj5Qe43Z1gHB+myP8tby2XR2dlcx2XbOm/XLtI6Cc qbzMGBKLHMi+WQN0Lu4BZ/I/8wo013G1mG9njLAbf2rfdSfYVbTo7XIAMXLE3RaW43Gh ivMYeu01k9kYROg2TQ3YJByYotYao0ISMkRrEJTeDe29dAmfe1yVmVyBoaouy11QFhjp gAiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734946748; x=1735551548; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HLu09/IZb76vH1AepGLoCNTFGrmu/5Ir8RKortKBDcM=; b=hJ1cLoucEmZroT49fjMSD0oALzKHDcLCvHyncj171oP9oIy4fC8RYInTCnyqyz3Oj4 6yZ3KBp1tpIWCgneQBeE2DxVb7aivyhO1bHcLL1Noqd3rKgLvCOfysxZY/4R1ndOzWqp eRukjx6U3jz+SGxmAs+g9l68nPq4C7/5is+BiC3a2hMV+mBjZ7mjYdzxhOmm//r8lFXU kj9n+kABfoM9SqGthOYrEqKCSbZlqp3lml3CfKWCNemPEq+YeiKl4HFoE6bLjT6w7Yeb J/0D3VVwZQs9B1fxlVgc8areQ+HlwYNNS4cbUrt7ZRRmHZA+pFQTV8hZAQMDRhP3WGht iTDg== X-Forwarded-Encrypted: i=1; AJvYcCUr3l2wiM1c9D8ALfc9qHrLuaXiB8UpWPl8/jL+m1Ps20eiKr4S8lunzz63ZdWNXDia+HRvmrefRHhaXhk=@vger.kernel.org X-Gm-Message-State: AOJu0Yyk1knfKjs8JWfahqHJZpbigqwt3dd4jYCSkwoNlMswNxYf3y66 s0C5O2TbHrTSA+2/7KUMCI+JQ9fgM6gxG4NPytyNTFUq7d8L9ZM1lEGlLjAkv6o= X-Gm-Gg: ASbGnctBchWbdQR0c82kbiShjNYj+DVZXssQcb5yOMb9V2A2tinW7HQ6X2Y0NoXh8su qYzxDaLP3BkJySCoZ1haXfDFIJ9c7vRo2S2lNG5KMcyHSHPzRymB0IeXr5S45VhDzutHWW/Sz2M 96ZDSgSz3Y64GjCsJVhVHZKJJ97N+PnOqTz9yHZ7KqhMNbwaeTQ1Jj+1rvuuvIoZ/tZGxyiHdCx 3HZdUl/NOmDK/+j0aGLlITovVvybkyErbKYab2r+mlUrzwPrG0sJH+k8xwy X-Google-Smtp-Source: AGHT+IH/O/K2z2kiA821Hde63hWbwa0B+QD6rT/zP3IoMk1MAKsl29HlJV0aQSy+OLPVN88I+iGbAg== X-Received: by 2002:a5d:5f48:0:b0:385:faaa:9d1d with SMTP id ffacd0b85a97d-38a221fae50mr11914975f8f.35.1734946748435; Mon, 23 Dec 2024 01:39:08 -0800 (PST) Received: from dhcp161.suse.cz ([193.86.92.181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c829235sm10773868f8f.15.2024.12.23.01.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 01:39:08 -0800 (PST) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Sami Tolvanen , Daniel Gomez , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel Cc: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] module: Make .static_call_sites read-only after init Date: Mon, 23 Dec 2024 10:37:49 +0100 Message-ID: <20241223093840.29417-4-petr.pavlu@suse.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241223093840.29417-1-petr.pavlu@suse.com> References: <20241223093840.29417-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Section .static_call_sites holds data structures that need to be sorted and processed only at module load time. This initial processing happens in static_call_add_module(), which is invoked as a callback to the MODULE_STATE_COMING notification from prepare_coming_module(). The section is never modified afterwards. Make it therefore read-only after module initialization to avoid any (non-)accidental modifications. Signed-off-by: Petr Pavlu --- kernel/module/strict_rwx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/module/strict_rwx.c b/kernel/module/strict_rwx.c index 598f89195336..4ae5facab569 100644 --- a/kernel/module/strict_rwx.c +++ b/kernel/module/strict_rwx.c @@ -115,6 +115,15 @@ static const char *const ro_after_init[] =3D { * section, which are marked as such at module load time. */ "__jump_table", + +#ifdef CONFIG_HAVE_STATIC_CALL_INLINE + /* + * Section .static_call_sites holds data structures that need to be + * sorted and processed at module load time but are never modified + * afterwards. + */ + ".static_call_sites", +#endif }; =20 void module_mark_ro_after_init(const Elf_Ehdr *hdr, Elf_Shdr *sechdrs, --=20 2.43.0