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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 44524C5478C for ; Tue, 27 Feb 2024 18:08:21 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=R37LDvvc; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TklpW5Bmwz3dLQ for ; Wed, 28 Feb 2024 05:08:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=R37LDvvc; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::d2c; helo=mail-io1-xd2c.google.com; envelope-from=keescook@chromium.org; receiver=lists.ozlabs.org) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4Tklnf633cz3cnt for ; Wed, 28 Feb 2024 05:07:32 +1100 (AEDT) Received: by mail-io1-xd2c.google.com with SMTP id ca18e2360f4ac-7c48fc56752so147134039f.3 for ; Tue, 27 Feb 2024 10:07:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709057248; x=1709662048; darn=lists.ozlabs.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=R37LDvvct7Zin/I8So/le+vgh28M+YfOPZLP9gOBeY+/GB04BtWL5a4Vtjj9NY7bcr dhkAg4jmJUpisIXj+DPVpGlKrGYmypn9l5qIbRlss8374/Cme92g6tdC6XHMgjnNf2EQ pNbYbpZt+K3EMJoD4aOa15OnOjKioZaLYVk8E= 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=kG1RED9pWJJMsEIUpnqrEkK7/lYF2L5m6xSHe/0hmTLgUTxOw97CiwmzGQN5Hc1s3B 3Me0DO4sMBtyajV6feEtlFBDwsT6pRMkFD3dtZUS9xeqgsCO2WMRluBghediF4XxyxQ4 NCYYFxtCfx7SbeaZZUtWOGiEhegIHWQRiiuBeps7xQdaEOAYeYT7czDIjwRBggq8FgSu CKanWodRIhuzsfTgaA6cGhKcRKXz1zjjAlfTPRPes+OdaWL6tx25uJp3FDFeEK32rGVN AsYzhinrXqoSF1Igo2fYpbyy8g1bO4IiF9VVC2FLotZxyXR6/QmQzML/1X28g3Y6Vm0q O0QA== X-Forwarded-Encrypted: i=1; AJvYcCWZhawiaI/0TnekegJyTEaMKYVYEfWkFf6+nLwdTSvrzVGsQfb29y2Sq+vJFtD5IH3H0fUsRRQLx5TewKXF2DaPtYulhumHLqdbKB0Vng== X-Gm-Message-State: AOJu0Yw5j++r/EfD8Dv8LxKGQa/RN41n0uqRNK0+SOvcHAB9uR+nCgPO 98NNyHYWlyL6GOh3bpoZo63g/f4n83PvWt+GVJsifJcTawigWTWeVOLV/1Y7ww== 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 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-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <94a2b919-e03b-4ade-b13e-7774849dc02b@csgroup.eu> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "luto@kernel.org" , "linux-sh@vger.kernel.org" , "peterz@infradead.org" , "dave.hansen@linux.intel.com" , "linux-mips@vger.kernel.org" , "linux-mm@kvack.org" , "hpa@zytor.com" , "sparclinux@vger.kernel.org" , "linux-s390@vger.kernel.org" , "x86@kernel.org" , "linux-csky@vger.kernel.org" , "mingo@redhat.com" , "linux-snps-arc@lists.infradead.org" , "Liam.Howlett@oracle.com" , "broonie@kernel.org" , "bp@alien8.de" , "loongarch@lists.linux.dev" , "tglx@linutronix.de" , "linux-arm-kernel@lists.infradead.org" , "debug@rivosinc.com" , "linux-parisc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-alpha@vger.kernel.org" , "akpm@linux-foundation.org" , Rick Edgecombe , "linuxppc-dev@lists.ozlabs.org" , "kirill.shutemov@linux.intel.com" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Feb 27, 2024 at 07:02:59AM +0000, Christophe Leroy wrote: > > > Le 26/02/2024 à 20:09, Rick Edgecombe a écrit : > > 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 = 0; > info.length = len; > info.align_mask = PAGE_MASK & ((1ul << pshift) - 1); > info.align_offset = 0; But one cleanup that is possible from explicitly zero-initializing the whole structure would be dropping all the individual "= 0" assignments. :) -- Kees Cook