From owner-svn-src-all@freebsd.org Mon Jun 10 16:17:04 2019 Return-Path: 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 3EE0115C3380; Mon, 10 Jun 2019 16:17:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 73B0581EE1; Mon, 10 Jun 2019 16:17:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 5D1102ADE14; Tue, 11 Jun 2019 02:16:53 +1000 (AEST) Date: Tue, 11 Jun 2019 02:16:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: Warner Losh , "Conrad E. Meyer" , Tijl Coosemans , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r348847 - head/sys/sys In-Reply-To: Message-ID: <20190611013853.E3415@besplex.bde.org> References: <201906100528.x5A5S4gm072561@repo.freebsd.org> <20190610110909.3e6fbc13@kalimero.tijl.coosemans.org> MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=nlC_4_pT8q9DhB4Ho9EA:9 a=6I5d2MoRAAAA:8 a=8f2riifyOPmppVszzmMA:9 a=45ClL6m2LaAA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 73B0581EE1 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jun 2019 16:17:04 -0000 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 wrote: >> >>> On Mon, Jun 10, 2019 at 2:10 AM T=C4=B3l Coosemans >>> wrote: >>>> On Mon, 10 Jun 2019 05:28:04 +0000 (UTC) Dmitry Chagin >>>> 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. 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: 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 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" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 {