Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp193912lqe; Thu, 4 Apr 2024 04:09:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmFoeHe5LLaXZDo0v7WvBA6UoxilMuQ0Q9S1Fe9pbrf9BEPNMmwQITz9qV8Aia3o9nqCHOEXBr9F5altUl+0WOoqzSgwAnTq5kZ64ybQ== X-Google-Smtp-Source: AGHT+IEaRNcgX630oQlXNuNsgv9CeJHM0zYCKLDthCbGa+lJs40iP2jnuILeYuIyZFKmfG6N3onU X-Received: by 2002:a05:6e02:3f05:b0:369:f74f:bbe8 with SMTP id dr5-20020a056e023f0500b00369f74fbbe8mr2614639ilb.14.1712228941127; Thu, 04 Apr 2024 04:09:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712228941; cv=pass; d=google.com; s=arc-20160816; b=XuBAoa2Kp8LSb2+dPUfK/g7j0oLHn+PcrPzjZwS88itHZDezYuA6kaPTQGAZYulOuG PxnBE+vBlzmeZgEMh3BQ92EqkKTBAyiVnWJ5IjXKLhtHo92FndIIEtSiPvdr+mSpLTTu Z8RfPPPFOp9QMr6zsXGHPk8UoSq8nMww82p5uEwvs+x9pwQeyq1vaxkFwU7X9ZI6NfIr aeQNNgbuF0QLabuv8cwbHZxHBL470wUZoUJAIcKvM8Vhpvap+J7BctolqRpqLSW992ZZ 8sie7W8KZioowOVSEvt+C4n4toCzw8+7tN0bPagNCGjeBT3fKkAtaJCnWLXuEn40woyo 50gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ogzEmHcsMc/gb2xe+XOOLIlBT5FMyLswBi0I3OYWLQI=; fh=sc7tdpbQy+llCbQmOwTRhcmeUnLuULCY7Z6DY/ZDePc=; b=mH3hoImnFvU7g2ezpOOYazCcvHWSyHms2YEfihxChM+Nfo61PqgBGOB3oO9OgDOF0a 4d8mrtCkisQwcqDxZA80FB3m0q/AsqBnXG3f/OWLqW7MAkzX2tJqln0s1DGc61XRTyJt vET9CT8U/JLAUKQqACIe6LyRYbVM++ZiHa6fUe9pAw4Z+xP2rcMnoyJRMjsJMBuVdaoc oO83MSelHg7a/gsevoeCjvYKGKdJGKlyE0njeUKWnet2EHqx5HHSuzH06rNLP59ZBbSm RuWndaXdFRaVEtUugliLEeZiqyqL6J1KK/7kuMVS+ACdNCjwJXPwzytmp6HyEleJC8Yy u4vQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dgFdV8Fb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131291-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx10-20020a056a02050a00b005e683d7391asi16449609pgb.470.2024.04.04.04.09.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 04:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=dgFdV8Fb; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131291-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131291-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1F653288F21 for ; Thu, 4 Apr 2024 11:08:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72F0F81ACB; Thu, 4 Apr 2024 11:07:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dgFdV8Fb" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 4F94B745D6; Thu, 4 Apr 2024 11:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228872; cv=none; b=ZWZlOEZfyqOSpk8UefPGxcn0gBOvzehnlHh6FjAzUTHkdLMa6M0tU65pwUHSWmzVR28t0mc1x2ZGodEnrtEg2xumDXc+GiIaNQslf0RxqMAGGxk3sgyyByGasOJcJqh2PcX+WGIFiuuiBYllieaUBKC4dMB5bQvJdcTccNS3fY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712228872; c=relaxed/simple; bh=Jz9p+DbQLxCMAFIchnPWt9cu3a/3wToOtgTzitOYqPU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jLmOU9dNzJzGotwuNZHzrCaClzPqpfXXdxsfszov6ry6srprAAaEfInPgH4o7/xcNh6m1NwXQJKyILwGoLH1cIacuO1UShaAU7R6dEJMAxF4ertFGoYc3xz2MIwm12K5zT6bZVBL5XGE4amamd1c6tzbnvdVEZPo1d6Ci/MYm1A= 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=dgFdV8Fb; arc=none smtp.client-ip=209.85.210.177 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 Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6eaf9565e6bso576819b3a.2; Thu, 04 Apr 2024 04:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712228870; x=1712833670; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ogzEmHcsMc/gb2xe+XOOLIlBT5FMyLswBi0I3OYWLQI=; b=dgFdV8FbU2y5rdqCrCaCcMMgFEQwIkgmGtJFwpFZQhMJMN2Aa+5O7J4MDUpyPNmFOg 0oxIzmHNcBuvnm4D11zsH27SH1amAOZYaPb1fRFrPoXmTI+hagDl5COu1ajcO/+70s5Y Gc3o5wd5lbnXhGBhuk/OPUqaPRuXmNX6cXfpe+Iqkz5sZ3Tpd3099WUw5dlltXM9k3nQ iPQ1kfZUUtoTFneBsCp94k5zm4cSTRq41fDdMrMEuxO2xuOlD0+3yrI5VegurcxdPa2u O3nU8XzkiEDlLLmn6E0TrmOAnGwCAR+FsrAU8iSN7w4HXu087CEW3UdPv7BRqQhll3rO +qmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712228870; x=1712833670; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ogzEmHcsMc/gb2xe+XOOLIlBT5FMyLswBi0I3OYWLQI=; b=XjCIqW7c50GIqbqnAqf5dEzIVwdBLZNhj7uIoPol5Iuwa8lmc9nctHTNMQAAHriGJi SaCRVdHMpguOBRUvrQ6M4UEyzOGgmq8/lShMgXl38QfH+aGSCZOoqv1Jml1eYTSpPuWp FmfKzMUimdN5Z1vWQ6Yu8Ntomseol5uid5wq+i4o200tgQ0fR0Sd7kjDs+Bf7nowM0yK AkQCFfuixPWHZagQVfmQus3C5DcOjHU0jV36yStqGVcwOyPA2v/O2yYfWnJyd7D8JO0j SIV1bO20SfHih8iG48tbYoZoRMj7kAwKxpTyHMZYS/IhBTtHcmBV1btOPJiKQ+9t6vTI aDvQ== X-Forwarded-Encrypted: i=1; AJvYcCVkaKQ3mN/L8deucN1tQhBpKrL0KXyDSFXK9axSwBXPFDPNnRqDHq0piXrPXEt8EC7c90EC7Gw44I97Z/8Cy7Q/OVZv5/p7A0wJ0Y2K1BB1oodnn2jpBxg1/RLe9Oer6xxgJXkHwvWMKyUq01Tm4LbI6xasjLv7tEgXLVeEX61/QNZgXuc= X-Gm-Message-State: AOJu0YyVm+3Pju7REe+aWwkMQ/wqEUjcd2Y2Kx42vokxa8e6ckPIkZNi bgaeJGr60mtVHwqBRs3rgrs6PblmzCK10kYHM0jRoH6ZGx22QZFHxaMZLsM+DUrLbL4j+hl5d2G u3Y8cuswutymOQJlDx79Resnldv8= X-Received: by 2002:a05:6a20:5486:b0:1a3:c4f4:5bb3 with SMTP id i6-20020a056a20548600b001a3c4f45bb3mr2454966pzk.4.1712228870571; Thu, 04 Apr 2024 04:07:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Miguel Ojeda Date: Thu, 4 Apr 2024 13:07:15 +0200 Message-ID: Subject: Re: [PATCH v4] rust: init: remove impl Zeroable for Infallible To: Laine Taffin Altman Cc: Miguel Ojeda , Alex Gaynor , Benno Lossin , rust-for-linux@vger.kernel.org, Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Martin Rodriguez Reboredo , lkml , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 3, 2024 at 11:07=E2=80=AFPM Laine Taffin Altman wrote: > > In Rust, producing an invalid value of any type is immediate undefined > behavior (UB); this includes via zeroing memory. Therefore, since an > uninhabited type has no valid values, producing any values at all for it = is > UB. > > The Rust standard library type `core::convert::Infallible` is uninhabited= , > by virtue of having been declared as an enum with no cases, which always > produces uninhabited types in Rust. > > The current kernel code allows this UB to be triggered, for example by co= de > like `Box::::init(kernel::init::zeroed())`. > > Thus, remove the implementation of `Zeroable` for `Infallible`, thereby > avoiding the unsoundness (potential for future UB). > > Cc: stable@vger.kernel.org > Fixes: 38cde0bd7b67 ("rust: init: add `Zeroable` trait and `init::zeroed`= function") > Closes: https://github.com/Rust-for-Linux/pinned-init/pull/13 > Signed-off-by: Laine Taffin Altman > Reviewed-by: Alice Ryhl > Reviewed-by: Boqun Feng [ Reformatted the comment slightly. ] Applied to `rust-fixes` -- thanks everyone! Please feel free to still send = tags. Cheers, Miguel