Date: Tue, 11 Jun 2019 02:16:51 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Ian Lepore <ian@freebsd.org> Cc: Warner Losh <imp@bsdimp.com>, "Conrad E. Meyer" <cem@freebsd.org>, Tijl Coosemans <tijl@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>, svn-src-head <svn-src-head@freebsd.org> Subject: Re: svn commit: r348847 - head/sys/sys Message-ID: <20190611013853.E3415@besplex.bde.org> In-Reply-To: <f96e29b7fdbb0568a3f0b04878d514aa4ff436fe.camel@freebsd.org> References: <201906100528.x5A5S4gm072561@repo.freebsd.org> <20190610110909.3e6fbc13@kalimero.tijl.coosemans.org> <CAG6CVpViTYjjcqT6v_4m9RFk%2BGCr7kRNGeq63%2Bv4L_QgM3DEjQ@mail.gmail.com> <CANCZdfoJsHRL_0Jom6bsSC9J3EZn1d-WGA41hCsvWRTBhCVzhw@mail.gmail.com> <f96e29b7fdbb0568a3f0b04878d514aa4ff436fe.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 10 Jun 2019, Ian Lepore wrote: > On Mon, 2019-06-10 at 07:49 -0600, Warner Losh wrote: >> On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer <cem@freebsd.org> wrote: >> >>> On Mon, Jun 10, 2019 at 2:10 AM T=C4=B3l Coosemans <tijl@freebsd.org> >>> wrote: >>>> On Mon, 10 Jun 2019 05:28:04 +0000 (UTC) Dmitry Chagin >>>> <dchagin@FreeBSD.org> wrote: >>>>> ... >>>>> URL: https://svnweb.freebsd.org/changeset/base/348847 >>>>> Log: >>>>> Use C11 anonymous unions. >>>>> >>>>> Modified: head/sys/sys/ucred.h >>>> >>>> ... >>>> >>>> Isn't this a userland header that should work with non-C11 >>>> compilers? >>> ... >>> Why would one expect userland headers to work with non-C11 (gnu89) >>> compilers? >> ... >> Because those compilers can choose non c11 variants of the language? > > Do we promise that userland will compile with -std=3Dc89? I hope not. Only headers and libraries should support -std=3Dc89. <sys/cdefs.h> has lots of support for compilers and POSIX versions going back to K&R C, and only the K&R parts are completely broken. FreeBSD also has the c89 and c99 utilities. These require c89 and c99 headers to work under FreeBSD. c89 uses CFLAGS -std=3Diso9899:199409 -pedantic. I don't see how a 1994 standard can be correct for c89, but -pedantic here might avoid the bug that -std=3Dcxx doesn't actually gives standard cxx, especially for clang. c99 uses -std=3Diso9899:1999 -pedantic. So anonymous unions are correctly disallowed by both c89 and c99. At least the following headers still compile with c89: sys/types.h, stdio.h, stdlib.h, the old version of sys/ucred.h. > Anonymous unions may be a c11 feature, but they're also available with > -std=3Dgnu99, which I think is how we compile userland. That is only the default, only for for parts of userland controlled by us. Non-FreeBSD makefiles get at most the POSIX CFLAGS (something like -O) from sys.mk if they use FreeBSD make, and something similar using gmake. > I think -std=3Dgnu99 is how we should also compile the kernel, and I > think Bruce has been trying to say that for several years (but I'm not > sure, because the emails that seem to say so are always so full of > semi-related extraneous material that it's hard to be sure what they're > saying). -std can be forced for kernel builds and other pure FreeBSD builds, but then it should be the correct one. bsd.sys.mk only directly supports the user selecting the following standard= s: - c89 or c90 - c94 or c95 (the c89 utility gives -std=3Dc94, not -std=3Dc89) - c99 - gnu99 (default) Newer and more useful old standards like gnu89 are hard to select. The user must set the undocumented variable CSTD even to change the default to c89/90/94/95. Adding -std=3Dwhatever to CFLAGS only works if it happens to be added after -std=3D${CSTD}. Bruce From owner-svn-src-all@freebsd.org Mon Jun 10 16:36:32 2019 Return-Path: <owner-svn-src-all@freebsd.org> Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EACD15C3AE5; Mon, 10 Jun 2019 16:36:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0232282C86; Mon, 10 Jun 2019 16:36:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8D961CD58; Mon, 10 Jun 2019 16:36:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5AGaVoR024720; Mon, 10 Jun 2019 16:36:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5AGaVJx024719; Mon, 10 Jun 2019 16:36:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201906101636.x5AGaVJx024719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans <kevans@FreeBSD.org> Date: Mon, 10 Jun 2019 16:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348867 - stable/11/sys/cddl/boot/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/cddl/boot/zfs X-SVN-Commit-Revision: 348867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0232282C86 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 10 Jun 2019 16:36:32 -0000 Author: kevans Date: Mon Jun 10 16:36:31 2019 New Revision: 348867 URL: https://svnweb.freebsd.org/changeset/base/348867 Log: MFC r342747 (mmacy): zfsboot: support newer ZFS versions declare v3 objset size/layout to fix userboot and possibly other loader issues - fix for userboot assertion failure in zfs_dev_close in free due to out of bounds write - fix for zfs_alloc / zfs_free mismatch assertion failure when booting GPT on BIOS Approved by: re (gjb) Modified: stable/11/sys/cddl/boot/zfs/zfsimpl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/boot/zfs/zfsimpl.h ============================================================================== --- stable/11/sys/cddl/boot/zfs/zfsimpl.h Mon Jun 10 15:55:38 2019 (r348866) +++ stable/11/sys/cddl/boot/zfs/zfsimpl.h Mon Jun 10 16:36:31 2019 (r348867) @@ -1121,6 +1121,8 @@ typedef struct sa_hdr_phys { #define SA_PARENT_OFFSET 40 #define SA_SYMLINK_OFFSET 160 +#define ZIO_OBJSET_MAC_LEN 32 + /* * Intent log header - this on disk structure holds fields to manage * the log. All fields are 64 bit to easily handle cross architectures. @@ -1133,17 +1135,24 @@ typedef struct zil_header { uint64_t zh_pad[5]; } zil_header_t; -#define OBJSET_PHYS_SIZE 2048 +#define OBJSET_PHYS_SIZE_V2 2048 +#define OBJSET_PHYS_SIZE_V3 4096 typedef struct objset_phys { dnode_phys_t os_meta_dnode; zil_header_t os_zil_header; uint64_t os_type; uint64_t os_flags; - char os_pad[OBJSET_PHYS_SIZE - sizeof (dnode_phys_t)*3 - - sizeof (zil_header_t) - sizeof (uint64_t)*2]; + uint8_t os_portable_mac[ZIO_OBJSET_MAC_LEN]; + uint8_t os_local_mac[ZIO_OBJSET_MAC_LEN]; + char os_pad0[OBJSET_PHYS_SIZE_V2 - sizeof (dnode_phys_t)*3 - + sizeof (zil_header_t) - sizeof (uint64_t)*2 - + 2*ZIO_OBJSET_MAC_LEN]; dnode_phys_t os_userused_dnode; dnode_phys_t os_groupused_dnode; + dnode_phys_t os_projectused_dnode; + char os_pad1[OBJSET_PHYS_SIZE_V3 - OBJSET_PHYS_SIZE_V2 - + sizeof (dnode_phys_t)]; } objset_phys_t; typedef struct dsl_dir_phys {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190611013853.E3415>