From nobody Mon Dec 1 22:36:18 2025 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 5C5F39475 for ; Sat, 29 Nov 2025 13:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764424635; cv=none; b=FMPhgIjw5UVHs5j8cG1FPu2zpp4bCb72IHzpcFwfImuf0iJufiijDEPIjRyX0yEgG5Zy9Fb8470zIrqmfxkDyCIZuCFmDHAEfeBLEhVauwNX+S8souM1AucDrHARwGZEu95Yunu+3IXri8+jwd3RfKtcOSmud7LAqymyYn+74u0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764424635; c=relaxed/simple; bh=CM7jNN4TePOQPMBsMAlNFl4ZOltHTX1DPBovd4Yvy+4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EWQipe9prtOs9IWi1ubL0qz4qIl9Y0+7ILOIvpVdlczyOMB1nmvpQZPgwrXS33IeWYUENlZ+Y81aTwqtMTwoICRch9hVjgoMdc6MpXFKngz+ToCo4yfgmuj10vskJixwGXCMRAbyhDCxX5isvIoxTakhx/q89wSzxAXm/Ti3gds= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VMtK4W1A; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VMtK4W1A" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-298287a26c3so32945845ad.0 for ; Sat, 29 Nov 2025 05:57:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764424633; x=1765029433; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=eAqwBtl2E/J/hHI5JWJWSFXxbwpu71L6FPfsnW170Bw=; b=VMtK4W1AcwPqtSAqAMfn8RTeLMTNOLb1hTt8Ey15z/2KpFWMvhYe5pLj08XXdl6PDJ WsZw0rC70iQoasNIWLCSPxPfBfDkQPHFyMcFJXShdIXW4Ecxfhk9OXphlVDlWU+xmqAP nsdjEJNBhwn+vEu33hTzqRP1fuEi7rTByUkabLCSes7Vs6X0VTrjBNVp1r/woviogSvh CFLRIhhIhdC9EY7pYBHTkRuavCsVQFQlw6+FYzG+/N6f0vn58qTmynfbE2TYnfZmI/rn OM5hWkN5f/MjOfgv7pZhaE2mvAAYhMzSPZsMLf+bTpsz/wmZowWdbPp7tlu3lzo1P29T Euyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764424633; x=1765029433; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eAqwBtl2E/J/hHI5JWJWSFXxbwpu71L6FPfsnW170Bw=; b=ZI1XfgZw2jtXmA/ILm0lDVaPW6RNDbKCfZneFRFGiBnlrYq8cihz+QJm0RBLmHTwew /v2HuUlQO9o2Eg4gc2c+KAUMVZgHW0IetEmDbNQKSJV735SzuSZFmabbMLDgR9vHEofR hKqMMNRo+RW8s/1H4aA+PSW4+ajIx2PeLjjA3u804OX/AfR90FqTr63QoO5p07oKA9J2 FPirHnrowfelEnfGOtgsAur3tjT/3vcHcJVeQwNy1D/lkFDKYG+4LwYbVhf4+Ne/y0P+ XiLYFvFTqJ2bEBIq6CVnH95UYJqNv0jc+SKZryHx4hr9v5NTlb3Ye2OG5PinegvDpL73 zrbg== X-Forwarded-Encrypted: i=1; AJvYcCXXbxfSsLWGJ18MKrIHy4CfBARnVdoeS97BGJBiijXowFdY8GHlTEaKCbIS5OCHD2VOCZrs2oCD9WDusr0=@vger.kernel.org X-Gm-Message-State: AOJu0YzQ0NiwdJ8oxMG42XfiWC+LBNaDAAhc4xiYjx7GG2AqYjfuG2c2 4JcWL6SkFQlKYb8IAE2uTTHUglkJeMcOt8ZifWYFEyJCa4/JZ6An1ujJ X-Gm-Gg: ASbGncufu6vvTWnojo/GRl+tWMchON/B6JMoeoEe+UAqMmr8ameDB9sddHrK0Xy2ySs LhEVWVYB/eW4tr5duApXd1tkLVs6xVkp401DC+qhNo61c319Ddcc8euSbWC1bo8gjX9Ez0/xb+i HzlbO44eyCvPnESJaSC9lyLT19kXwn1g0DwoNitcWIMU542XrjkSOlS7RuhqOrlcT2xbbohnmSq GyjfAculison0CWf9nRHLibX2RltsRezXr+uSQVytqVRVrPfvPLlx5OaIOhp02KYjqSYE64CKU0 e+S8wGRO4P3p6C9UdJh7K8B4loNXRy5MDKyRfn/7OVoFA9VL5HyHGLbN5+haLFYbW50p3GT41uy cHM0zKvmaXf7d2PkNKBzKcBv3Oa4oTLWj8RtfSsRHdWKvp5Uca+JUQ79KZLNqeKjRNWt+OYDvag I07I5kEGBfEoDXdR6i4af0aGrt7f65O9iyQipwXR2JfePA6HEToQ1Lmw/Cp8KfscWy X-Google-Smtp-Source: AGHT+IEXDwvB6Es576qZrqunEvinwqTauJDMMQVrykWfuq2wMdK5X2oejN3gpeUs4GU/2Ild1wmekg== X-Received: by 2002:a17:903:1b10:b0:298:485d:5576 with SMTP id d9443c01a7336-29b6be91657mr294336935ad.8.1764424633514; Sat, 29 Nov 2025 05:57:13 -0800 (PST) Received: from atharv-HP-Pavilion-x360-2-in-1-Laptop-14-ek1xxx.. ([103.216.213.160]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29bce46ca9bsm75400025ad.38.2025.11.29.05.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Nov 2025 05:57:13 -0800 (PST) From: Atharv Dubey To: paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, ojeda@kernel.org, alex.gaynor@gmail.com Cc: boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org, linux-security-module@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Atharv Dubey Subject: [PATCH] rust: security: use `pin_init::zeroed()` for LSM context initialization Date: Sat, 29 Nov 2025 19:26:57 +0530 Message-ID: <20251129135657.36144-1-atharvd440@gmail.com> X-Mailer: git-send-email 2.43.0 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" Replace the previous `unsafe { core::mem::zeroed() }` initialization of `bindings::lsm_context` with `pin_init::zeroed()`. Link: https://github.com/Rust-for-Linux/linux/issues/1189 Signed-off-by: Atharv Dubey Reviewed-by: Alexandre Courbot --- rust/kernel/security.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rust/kernel/security.rs b/rust/kernel/security.rs index 9d271695265f..4dc3eba6ce84 100644 --- a/rust/kernel/security.rs +++ b/rust/kernel/security.rs @@ -62,8 +62,7 @@ impl SecurityCtx { /// Get the security context given its id. #[inline] pub fn from_secid(secid: u32) -> Result { - // SAFETY: `struct lsm_context` can be initialized to all zeros. - let mut ctx: bindings::lsm_context =3D unsafe { core::mem::zeroed(= ) }; + let mut ctx: bindings::lsm_context =3D pin_init::zeroed(); =20 // SAFETY: Just a C FFI call. The pointer is valid for writes. to_result(unsafe { bindings::security_secid_to_secctx(secid, &mut = ctx) })?; --=20 2.43.0