From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 874C5C54798 for ; Tue, 27 Feb 2024 18:07:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3FcYBZfwpHsjiJH3EbNUmL0fh1+SFfG1xp44bdCwiuQ=; b=ONsMNqMBPikM8z ofsoZpRB0CDaLqN8OZEQJ+EYygquQeiAlOyD+lXYmgpp8on8JITtLMuJd96Wnyq+i0QOUSDmpqiAS yJgaLYHkO1a+guOLXfB6DZvCe0dk7x+Ffi3zEumuxNhmHWDcx40c9FRAJDLDXvxHcnY/MU8YEqPEF qeQx4x3HkbnxrLddzer4Ge0QX/z45pENegKGpt2uWMcL7FlgD0NzKUvyoh8OUGZ/JxltqHsUL6gLs DDhvLnpwPAKyvB9ASr0jV2n+RfNxKOoGjPwj0I3I2Ks+du+rv6HCoC9icI84Tshxjy7NydFE2c9X6 kR69Sl/V+F90CnlPl0RA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf1rg-00000006MHI-1FYl; Tue, 27 Feb 2024 18:07:40 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rf1rc-00000006MBl-0qEF for linux-arm-kernel@lists.infradead.org; Tue, 27 Feb 2024 18:07:37 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3650dcd38a0so10986195ab.1 for ; Tue, 27 Feb 2024 10:07:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709057248; x=1709662048; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=mgrI9FN30eAJ2XZAfY9sJBg3TkLiivRBpbDR17SPpEo=; b=feMHyykf4cTtY0rT0EygPG/jHlDAUJ9DFCtqcCx0h+yCQDHiRnXqDbY5bB93HGFGmi 14czncGGxCq4sleYepI0dmDDYf/N0xCE8hniES2VK73eG8ScpwGl2khhpINqtffLkTlq 3jQjLhK7uvsSpmYCrZRPrSSifsXN8SFLtaZpc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709057248; x=1709662048; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mgrI9FN30eAJ2XZAfY9sJBg3TkLiivRBpbDR17SPpEo=; b=wqq3fhIcGkLI6Aypx5haaOt236JLH9SPnddLmawb1W3iqeTdIa1Frhzkj0+ISiF3Sh FEXIOKjdZyonf2RGm19M4jwtf0pRTq9OHP5AUTYJOQB7n555vpvVX4YzBLqFmBTk5sRn myq1GWV+oQm8nabrpGOu2iH6hmkACi0yKAm3zhE8Jw/ukAEk8VXKxPDW3fQCEaULNNT1 ArnTwOguhQpn7lAyj+hnlrSxuf1eLh536S/LX0d9wBrXqRTEP9iQDVCnEGYVT+S4SWDN UiNmgFtZ4D0f/qkjPN6v5HEphT+VEgEus8tImlP62Alw0d0QKM9Whq5Lc9poyTfkpxUS jpgw== X-Forwarded-Encrypted: i=1; AJvYcCXu33+0+Oe+cTxaFV73Wnwi0jWG6Auj1TRBsPEAKgCaiFPKPu81OTDQ1oeG6eef2A2vFh3mAXpzfNikFRoHM2hg6nfPMR0peDemXEANARP3V3lY/Ow= X-Gm-Message-State: AOJu0Yz3F8CaeImp0rfQq7q8yvcRhiwM3r1c1NZE+hzPmniKB+nvPdvA oNY5e3tyiUuX+xY8yhOtqWPKpXyAsPoZXAY920uzNB4qF14Juw2kf+2shUPQig== X-Google-Smtp-Source: AGHT+IFpahrVJDe+RkqjDhxBgm48d+nhk6O3nvQnCIgFv/bhnbFyY12knPOFjwYUx9hP01B6x+R36g== X-Received: by 2002:a05:6e02:522:b0:363:bb5a:3329 with SMTP id h2-20020a056e02052200b00363bb5a3329mr11593022ils.1.1709057247927; Tue, 27 Feb 2024 10:07:27 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id fa42-20020a056a002d2a00b006e55b674e66sm10411pfb.171.2024.02.27.10.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:07:27 -0800 (PST) Date: Tue, 27 Feb 2024 10:07:26 -0800 From: Kees Cook To: Christophe Leroy Cc: Rick Edgecombe , "Liam.Howlett@oracle.com" , "akpm@linux-foundation.org" , "debug@rivosinc.com" , "broonie@kernel.org" , "kirill.shutemov@linux.intel.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "luto@kernel.org" , "peterz@infradead.org" , "hpa@zytor.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "linux-alpha@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" , "linux-arm-kernel@lists.infradead.org" , "linux-csky@vger.kernel.org" , "loongarch@lists.linux.dev" , "linux-mips@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-s390@vger.kernel.org" , "linux-sh@vger.kernel.org" , "sparclinux@vger.kernel.org" Subject: Re: [PATCH v2 5/9] mm: Initialize struct vm_unmapped_area_info Message-ID: <202402271004.7145FDB53F@keescook> References: <20240226190951.3240433-1-rick.p.edgecombe@intel.com> <20240226190951.3240433-6-rick.p.edgecombe@intel.com> <94a2b919-e03b-4ade-b13e-7774849dc02b@csgroup.eu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <94a2b919-e03b-4ade-b13e-7774849dc02b@csgroup.eu> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_100736_256524_32D785F2 X-CRM114-Status: GOOD ( 19.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 27, 2024 at 07:02:59AM +0000, Christophe Leroy wrote: > = > = > Le 26/02/2024 =E0 20:09, Rick Edgecombe a =E9crit=A0: > > Future changes will need to add a field to struct vm_unmapped_area_info. > > This would cause trouble for any archs that don't initialize the > > struct. Currently every user sets each field, so if new fields are > > added, the core code parsing the struct will see garbage in the new > > field. > > = > > It could be possible to initialize the new field for each arch to 0, but > > instead simply inialize the field with a C99 struct inializing syntax. > = > Why doing a full init of the struct when all fields are re-written a few = > lines after ? It's a nice change for robustness and makes future changes easier. It's not actually wasteful since the compiler will throw away all redundant stores. > If I take the exemple of powerpc function slice_find_area_bottomup(): > = > struct vm_unmapped_area_info info; > = > info.flags =3D 0; > info.length =3D len; > info.align_mask =3D PAGE_MASK & ((1ul << pshift) - 1); > info.align_offset =3D 0; But one cleanup that is possible from explicitly zero-initializing the whole structure would be dropping all the individual "=3D 0" assignments. :) -- = Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel