From owner-freebsd-current@freebsd.org Wed Oct 3 07:07:55 2018 Return-Path: Delivered-To: freebsd-current@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 6303910BA485 for ; Wed, 3 Oct 2018 07:07:55 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC8BC8F1D2 for ; Wed, 3 Oct 2018 07:07:54 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wr1-x442.google.com with SMTP id g15-v6so2183073wru.9 for ; Wed, 03 Oct 2018 00:07:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=tGLgkLxVbzQML4Cm2eFLoLn8PLcaVRv0DisJEXChk4Q=; b=IGTLqrOYLN0kNFvi6gHgW2Xuq5qzUDKTLG7tnL16DXZ2kA76Z1JBSrPPNEsiF89ECZ Ba0eYZgrrk7s7ta4W67qTu9V8WVB4DRmfRy+GwqMotTlRuxka/LvqmUZTCmJIR8Xdkwz 2SDY4EdaGnW44PdtNSpA6WsjyCFm+u8bDdbXe6tII7fa0v9l3HyLIArPiKsbRMgv4xY2 ONVQ3u+H3OxbRbN29g8+KF6kZMbWiBYJg0Yvc5rk68+YtwTw9KuSMhJTmE/Obs+qZQi6 7tOo9ERufIt3G4nPRgkIgbnQ51x51Kfdtbh39vKlYBtXXXxvQDgVu+/9FgficE7wxxyx gGxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=tGLgkLxVbzQML4Cm2eFLoLn8PLcaVRv0DisJEXChk4Q=; b=qShTxCBBVwBr8iOLN2Y/i2IKRWwIM6kwOI8a3olhsNT6Hx23uMv8WRdjfp4SopUbhN fSnzG1SoEVAYOWsflnpf+BOD2PN8T3dzN2NjQyl/Q04kW8ONQLW6QYXKHCRNBr7uz7gm nRgWPO+05Y69qDqJTKPx70/vpqlEOBpgMCzwDGHY4h7nSYKaNKvDtkrW5t2LF0cwsM+Q zfnhGZA3lRAUlhz+RukDERM4ZMTyZoIZGawxgLe1/27KCB1M0N9S7Z8xFwj47mc7Wdpz BC/f18oyttXJQ9Xh+8b/c1VPQbZ+IohqzPuaZYWhhZrX43lrOU65ce3QixRmpyRQ2Dac 4vSA== X-Gm-Message-State: ABuFfoiV76hXkXZ0sF0U+1O+sElretHXbeS1Al3lqYk9HmuVFsuAyhfl S53ndoPTC/P1FPErgHnBUAyf50dH X-Google-Smtp-Source: ACcGV61tdGULLLsprbET5khK+1ggW06E7JFlFyPh8f7lCE0WcGbIPVCLWpk+vxtQgHG+p5n8+v1kUA== X-Received: by 2002:adf:f90b:: with SMTP id b11-v6mr112140wrr.307.1538550473626; Wed, 03 Oct 2018 00:07:53 -0700 (PDT) Received: from ernst.home (p5B02380D.dip0.t-ipconnect.de. [91.2.56.13]) by smtp.gmail.com with ESMTPSA id t22-v6sm521887wmi.30.2018.10.03.00.07.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Oct 2018 00:07:52 -0700 (PDT) Date: Wed, 3 Oct 2018 09:07:51 +0200 From: Gary Jennejohn To: Rick Macklem Cc: "freebsd-current@FreeBSD.org" , Josh Paetzel Subject: Re: which way to update export_args structure? Message-ID: <20181003090751.68d23005@ernst.home> In-Reply-To: References: Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2018 07:07:55 -0000 On Wed, 3 Oct 2018 00:40:27 +0000 Rick Macklem wrote: > Hi, > > I am working on updating "struct export_args" to fix/add a few things. > One of these is that "ex_flags" is an int, but the flags are defined in mount.h > as MNT_xx bits that now exceed 32bits (mnt_flag is now uint64_t). > For now, this doesn't break anything, since the flags used by ex_flags are > all defined in the low order 32bits but...it seems like this should be addressed > by a new version of "struct export_args". > > I have two versions of the updated structure: > A) > struct export_args { > uint64_t ex_flags; /* export related flags */ > uid_t ex_root; /* mapping for root uid */ > struct xucred ex_anon; /* mapping for anonymous user */ > struct sockaddr *ex_addr; /* net address to which exported */ > u_char ex_addrlen; /* and the net address length */ > struct sockaddr *ex_mask; /* mask of valid bits in saddr */ > u_char ex_masklen; /* and the smask length */ > char *ex_indexfile; /* index file for WebNFS URLs */ > int ex_numsecflavors; /* security flavor count */ > int ex_secflavors[MAXSECFLAVORS]; /* list of security flavors */ > int32_t ex_fsid; /* mnt_stat.f_fsid.val[0] if */ > /* MNT_EXPORTFSID set in ex_flags64 */ > gid_t *ex_suppgroups; /* Supplemental groups if */ > /* ex_anon.cr_ngroups > XU_NGROUPS */ > }; > B) > struct export_args { > int ex_flags; /* export related flags */ > uid_t ex_root; /* mapping for root uid */ > struct xucred ex_anon; /* mapping for anonymous user */ > struct sockaddr *ex_addr; /* net address to which exported */ > u_char ex_addrlen; /* and the net address length */ > struct sockaddr *ex_mask; /* mask of valid bits in saddr */ > u_char ex_masklen; /* and the smask length */ > char *ex_indexfile; /* index file for WebNFS URLs */ > int ex_numsecflavors; /* security flavor count */ > int ex_secflavors[MAXSECFLAVORS]; /* list of security flavors */ > uint64_t ex_flagshighbits; /* High order bits of mnt_flag */ > int32_t ex_fsid; /* mnt_stat.f_fsid.val[0] if */ > /* MNT_EXPORTFSID set in ex_flags64 */ > gid_t *ex_suppgroups; /* Supplemental groups if */ > /* ex_anon.cr_ngroups > XU_NGROUPS */ > }; > > A) does the obvious thing. Unfortunately, this changes the vfs KABI > (specifically the function vfs_oexport_conv()) such that a file system > module compiled with an unpatched mount.h could crash a patched system. > As such, I think it couldn't be MFC'd and would be stuck in head/current > until FreeBSD13 (or FreeBSD14 if 13 gets skipped over;-). > > B) doesn't change any fields, but adds a second ex_flagshighbits for the high > order bit. Since it only adds fields where none of those bits are used after > the exports are processed by vfs_export() and, as such, will not break > the VFS KABI, since vfs_domount_update() differentiates which version > of export_args is being used. > As such, I believe this version can be MFC'd. However, it does seem confusing > to have the two ex_flags fields for the low and high 32bits. > > So, which do you think it preferable? rick > ps: Josh Paetzel has volunteered to do the mountd.c changes and I have a kerne > patch that I'll put up on phabricator once Josh has been able to test it. > In B, shouldn't ex_flags become uint32_t if all 32 bits can contain flag bits? And why make ex_flagshighbits a uint64_t? You could make it uint32_t and simply shift the high bits around. -- Gary Jennejohn