From owner-svn-src-all@freebsd.org Sun Nov 1 12:53:16 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E05344CC97; Sun, 1 Nov 2020 12:53:16 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CPGDr0FsMz45rV; Sun, 1 Nov 2020 12:53:15 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yb1-xb2d.google.com with SMTP id i186so9300833ybc.11; Sun, 01 Nov 2020 04:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xT9Hj7vvCtNHPLnfGeGh4f1ENRu9DOOEehwiZ/RixDk=; b=HDeKKv3lAACKlWxBK/ZVKYUFoMrAr/0W+4dKubBDIQrgOfX/2qbNKbxiGWf1ZNZsdD RtatHEMNfoDz2eQB2mXqEn9NzzVjfAddlEnYTJCcLwMyMZd/cRioWP5qpmP4kPPNp0va pIVRb4gws2A9v1+/FYDrI1wbhV8ScJVArhSJp0BWSykNWJ/g571nzjHciTzyE2egIyag DBEbWYOc5WmuALjnlJnJwO0xtDWdg56+/9a9w+wK9Gf6vQHPjin1Is5YVJXSxqQpjawy CpSxG7Pg6U+V0YCAQzQqn4aigKl3DwQGkJ/brRMHXXFcG9/cuUh+Asf7DEPmCinNgK7V rkpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xT9Hj7vvCtNHPLnfGeGh4f1ENRu9DOOEehwiZ/RixDk=; b=SAxJQDzxrdMITb6wxldSsl+/U2auYu0fcs8fNIoC0bjpyPmAP7Odl2030XW9IFy23A c3R7CzFsTNkM43ARAhqTzXx/NIQu7q/IA7UI4IUHiGryTbo56h0bnIFLb36imTVtd6qR XeoFd9awrpTlgJvdIdoOFuihGBeOuVN/WvuSuNEG2hrzmjj/H78FD+FowB3eQwu2dCYs MKpQVDk6bG+S7FZgbwrD6Z5oeWwpVsNNvEEnFyu4GmjqzGPXn+QMunCphym0XFnpJqGh 6cTjpCyVaBv0AplbKPMCKQCtICnvc5g/L20GQlJIltERtR1LCRDnLEuSnxhU3AByGQn2 kMqw== X-Gm-Message-State: AOAM533m9oaz1rXX1IGIiCk5gxvnDzSf8SHqm9r0Ae9NLOFmso49X14Z fJiXYmIPt2O/STX4//oaz6Em2qGf15TDdLBDFBw44iJ+ X-Google-Smtp-Source: ABdhPJxskoot1GQo32B5Q4VopHGPZVtLSf6GQK3Ex4SkxVp1bX1R8q5pA6C/PbYWAItCrBE1DtdXJGA6OoCwFtN5woo= X-Received: by 2002:a25:d248:: with SMTP id j69mr14511390ybg.278.1604235194833; Sun, 01 Nov 2020 04:53:14 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:d8d2:0:0:0:0:0 with HTTP; Sun, 1 Nov 2020 04:53:14 -0800 (PST) In-Reply-To: <202010312348.09VNmfWN009773@repo.freebsd.org> References: <202010312348.09VNmfWN009773@repo.freebsd.org> From: Oliver Pinter Date: Sun, 1 Nov 2020 13:53:14 +0100 Message-ID: Subject: Re: svn commit: r367243 - in head: lib/libc/gen sys/kern To: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CPGDr0FsMz45rV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 01 Nov 2020 12:53:16 -0000 On Sunday, November 1, 2020, Stefan E=C3=9Fer wrote: > Author: se > Date: Sat Oct 31 23:48:41 2020 > New Revision: 367243 > URL: https://svnweb.freebsd.org/changeset/base/367243 > > Log: > Make sysctl user.local a tunable that can be written at run-time > > This sysctl value had been provided as a read-only variable that is > compiled into the C library based on the value of _PATH_LOCALBASE in > paths.h. > > After this change, the value is compiled into the kernel as an empty > string, which is translated to _PATH_LOCALBASE by the C library. > > This empty string can be overridden at boot time or by a privileged > user at run time and will then be returned by sysctl. > > When set to an empty string, the value returned by sysctl reverts to > _PATH_LOCALBASE. > > This update does not change the behavior on any system that does > not modify the default value of user.localbase. > > I consider this change as experimental and would prefer if the run-time > write permission was reconsidered and the sysctl variable defined with > CLFLAG_RDTUN instead to restrict it to be set at boot time. > > MFC after: 1 month Wouldn't be better to make this variable a per-jail variable? > > Modified: > head/lib/libc/gen/sysctl.c > head/sys/kern/kern_mib.c > > Modified: head/lib/libc/gen/sysctl.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/lib/libc/gen/sysctl.c Sat Oct 31 23:19:59 2020 (r367242) > +++ head/lib/libc/gen/sysctl.c Sat Oct 31 23:48:41 2020 (r367243) > @@ -68,14 +68,14 @@ sysctl(const int *name, u_int namelen, void *oldp, si= z > if (retval || name[0] !=3D CTL_USER) > return (retval); > > - if (newp !=3D NULL) { > - errno =3D EPERM; > - return (-1); > - } > if (namelen !=3D 2) { > errno =3D EINVAL; > return (-1); > } > + if (newp !=3D NULL && name[1] !=3D USER_LOCALBASE) { > + errno =3D EPERM; > + return (-1); > + } > > switch (name[1]) { > case USER_CS_PATH: > @@ -88,13 +88,21 @@ sysctl(const int *name, u_int namelen, void *oldp, si= z > memmove(oldp, _PATH_STDPATH, > sizeof(_PATH_STDPATH)); > return (0); > case USER_LOCALBASE: > - if (oldp !=3D NULL && orig_oldlen < sizeof(_PATH_LOCALBAS= E)) > { > - errno =3D ENOMEM; > - return (-1); > + if (oldlenp !=3D NULL) { > + if (oldp =3D=3D NULL) { > + if (*oldlenp =3D=3D 1) > + *oldlenp =3D sizeof(_PATH_LOCALBA= SE); > + } else { > + if (*oldlenp !=3D 1) > + return (retval); > + if (orig_oldlen < sizeof(_PATH_LOCALBASE)= ) > { > + errno =3D ENOMEM; > + return (-1); > + } > + *oldlenp =3D sizeof(_PATH_LOCALBASE); > + memmove(oldp, _PATH_LOCALBASE, > sizeof(_PATH_LOCALBASE)); > + } > } > - *oldlenp =3D sizeof(_PATH_LOCALBASE); > - if (oldp !=3D NULL) > - memmove(oldp, _PATH_LOCALBASE, > sizeof(_PATH_LOCALBASE)); > return (0); > } > > > Modified: head/sys/kern/kern_mib.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- head/sys/kern/kern_mib.c Sat Oct 31 23:19:59 2020 (r367242) > +++ head/sys/kern/kern_mib.c Sat Oct 31 23:48:41 2020 (r367243) > @@ -652,8 +652,11 @@ SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFL= AG > SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of streams a process may > have open at one time"); > SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD, > SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of types supported for > timezone names"); > -SYSCTL_STRING(_user, USER_LOCALBASE, localbase, CTLFLAG_RD, > - "", 0, "Prefix used to install and locate add-on packages"); > + > +static char localbase[MAXPATHLEN] =3D ""; > + > +SYSCTL_STRING(_user, USER_LOCALBASE, localbase, CTLFLAG_RWTUN, > + localbase, sizeof(localbase), "Prefix used to install and locate > add-on packages"); > > #include > SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD, > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >