From nobody Sat Jul 01 23:13:16 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qtnzw16TTz4lMQq; Sat, 1 Jul 2023 23:13:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qtnzv54BRz3HWr; Sat, 1 Jul 2023 23:13:31 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.17.1/8.17.1) with ESMTPS id 361NDGFC088967 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 2 Jul 2023 02:13:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 361NDGFC088967 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 361NDGGw088966; Sun, 2 Jul 2023 02:13:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 2 Jul 2023 02:13:16 +0300 From: Konstantin Belousov To: Ka Ho Ng Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 005aa1743b42 - main - modules: bzero the modspecific_t Message-ID: References: <202307012259.361MxM4i017090@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202307012259.361MxM4i017090@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4Qtnzv54BRz3HWr X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Sat, Jul 01, 2023 at 10:59:22PM +0000, Ka Ho Ng wrote: > The branch main has been updated by khng: > > URL: https://cgit.FreeBSD.org/src/commit/?id=005aa1743b42b52fbd49b9d5ec44816902b6ee9f > > commit 005aa1743b42b52fbd49b9d5ec44816902b6ee9f > Author: Ka Ho Ng > AuthorDate: 2023-07-01 19:41:53 +0000 > Commit: Ka Ho Ng > CommitDate: 2023-07-01 22:58:46 +0000 > > modules: bzero the modspecific_t > > Per https://reviews.llvm.org/D68115, only the first field is > zero-initialized, meanwhile other fields are undef. This is not true. > > The pattern can be observed on clang as well, that when > -ftrivial-auto-var-init=pattern is specified 0xaa is filled for > non-active fields, otherwise they are zero-initialized. What are non-active fields? All fields with implicit initializers "shall be initialized implicitly the same as objects that have static storage duration." I do not think this is required for padding. > Technically both are acceptable when using clang. However it > would be good to simply bzero the modspecific_t in such case to > be strict to the standard. > > MFC with: 2cab2d43b83b > MFC after: 1 day Min MFC period is 3 days. > Sponsored by: Juniper Networks, Inc. > Reviewed by: delphij > Differential Revision: https://reviews.freebsd.org/D40830 > --- > sys/kern/kern_syscalls.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c > index 234e51cfd280..0b51edf5e985 100644 > --- a/sys/kern/kern_syscalls.c > +++ b/sys/kern/kern_syscalls.c > @@ -173,9 +173,10 @@ kern_syscall_module_handler(struct sysent *sysents, struct module *mod, > int what, void *arg) > { > struct syscall_module_data *data = arg; > - modspecific_t ms = { 0 }; > + modspecific_t ms; > int error; > > + bzero(&ms, sizeof(ms)); > switch (what) { > case MOD_LOAD: > error = kern_syscall_register(sysents, data->offset,