From nobody Tue Mar 14 16:30:59 2023 X-Original-To: dev-commits-src-all@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 4PbfD068D1z3ySTt for ; Tue, 14 Mar 2023 16:31:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (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 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PbfD04Qwnz4KRK for ; Tue, 14 Mar 2023 16:31:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52a.google.com with SMTP id eh3so8493427edb.11 for ; Tue, 14 Mar 2023 09:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1678811470; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EZT1RgtA57NlM36rt1x1wg/Ls9ASMeaCS6YIA3jHQME=; b=qK6sIs5gJpId2xctgucltFXpnGumGouMu8QuOyx8uQK1U0auRqPs298BZdqLCj/Cbr IrG9/ouVjzue/6gdjU94FZCkCwqGyR874x6z0OqSHwgrgmSnN8Oh80unl3+Pa8cYfP/g 5EtcdN9k266cYmhb7OWTVwgWW5HXwi6dyoFOb4CqUvZYzqNcYpGM1pWH0YPJXnSn568Q 6A/AeXNUAk1GVAF1sads87r8q4op6Pjun94mzqlco0SZjRlCGCvzDsrD11ml1T4LnNkd AxxwuOg8jXBfGpMWpbZQynifEoqLY7jZ6tiD2sShXC2XdOMUt9v7NE+OHKlTJ+Bq+W9F E6zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678811470; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EZT1RgtA57NlM36rt1x1wg/Ls9ASMeaCS6YIA3jHQME=; b=YTPchtg7fGZNzLtz9FY52077dNE8DQQPtU2zce1GIFLTY8ragnjs63f6WXBv1rVzdz xmp8jA9WstdZaRO7CgLZSFPehk/jaOFFKGXIGFNjLzEGx8OnVxQpzmHwVBq+pG/t/xJ2 hr05cOUzFi5QGTmtP99wT9SDxW0U7/OqEjx4p4GuU9Hvfx3VOvWlpBdxM5Ryc3HA9cKP BrLdYBg7mqmoSm5DNBCxCf39dhBfmSl0pNRjS7BCegrFesDDTiiW4Bh1+dG0nOw+uuzA Bss3zTR5jwac3SST22NaPRKJdYCKjJjBwkMUPh23bzAu0Pvuw/uzaTs+FcmmNz03Xt/L fpYA== X-Gm-Message-State: AO0yUKUnGTSCoA4jyBbMtFw6jYqxu5U+uMvJaTt2vydzOu0cXL8pJyZk gjIexClQ9NP+I/qfDus5y5VHf2um3dn3iJHfYrOSQw== X-Google-Smtp-Source: AK7set8w1Ec4o6gmF0RA/R37VS57DQLIXyqLEocHEeRPdRCyr10mgTj2BKMqSJC1e7wrQk3RpDT82uWxrDi8IwW85k0= X-Received: by 2002:a17:907:72c1:b0:8e5:1a7b:8ab2 with SMTP id du1-20020a17090772c100b008e51a7b8ab2mr1820250ejc.4.1678811470422; Tue, 14 Mar 2023 09:31:10 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202303140419.32E4Jtsd058392@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Tue, 14 Mar 2023 10:30:59 -0600 Message-ID: Subject: Re: git: adeca21464d2 - main - Add GNU glibc compatible secure_getenv To: Konstantin Belousov Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="00000000000056f71d05f6dec12e" X-Rspamd-Queue-Id: 4PbfD04Qwnz4KRK X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --00000000000056f71d05f6dec12e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 14, 2023 at 3:11=E2=80=AFAM Konstantin Belousov wrote: > On Tue, Mar 14, 2023 at 04:19:55AM +0000, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Dadeca21464d25bc61f98968a5c1e76a= b3c808ae4 > > > > commit adeca21464d25bc61f98968a5c1e76ab3c808ae4 > > Author: lucy > > AuthorDate: 2023-03-13 22:01:12 +0000 > > Commit: Warner Losh > > CommitDate: 2023-03-14 04:19:24 +0000 > > > > Add GNU glibc compatible secure_getenv > > > > Add mostly glibc and msl compatible secure_getenv. Return NULL if > > issetugid() indicates the process is tainted, otherwise getenv(x). > The > > rational behind this is the fact that many Linux applications use > this > > function instead of getenv() as it's widely consider a, "best > > practice". > > > > Reviewed by: imp, mjg (feedback) > > Pull Request: https://github.com/freebsd/freebsd-src/pull/686 > > Signed-off-by: Lucy Marsh > > --- > > include/stdlib.h | 1 + > > lib/libc/stdlib/Makefile.inc | 4 ++-- > > lib/libc/stdlib/Symbol.map | 1 + > > lib/libc/stdlib/getenv.3 | 26 +++++++++++++++++++++++++- > > lib/libc/stdlib/getenv.c | 12 ++++++++++++ > > 5 files changed, 41 insertions(+), 3 deletions(-) > > > > diff --git a/include/stdlib.h b/include/stdlib.h > > index 01629ed84a11..c41e8704e810 100644 > > --- a/include/stdlib.h > > +++ b/include/stdlib.h > > @@ -111,6 +111,7 @@ void qsort(void *, size_t, size_t, > > int (* _Nonnull)(const void *, const void *)); > > int rand(void); > > void *realloc(void *, size_t) __result_use_check __alloc_size(2); > > +char *secure_getenv(const char *); > The declaration must be put under BSD_VISIBLE. > Thanks. https://reviews.freebsd.org/D39076 > > void srand(unsigned); > > double strtod(const char * __restrict, char ** __restrict); > > float strtof(const char * __restrict, char ** __restrict); > --00000000000056f71d05f6dec12e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Mar 14, 2023 at 3:11=E2=80=AF= AM Konstantin Belousov <kostikbel= @gmail.com> wrote:
On Tue, Mar 14, 2023 at 04:19:55AM +0000, Warner Losh wrote:
> The branch main has been updated by imp:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3Dadeca21464d25bc61f98968a5c1e76ab3c808ae4<= /a>
>
> commit adeca21464d25bc61f98968a5c1e76ab3c808ae4
> Author:=C2=A0 =C2=A0 =C2=A0lucy <
seafork@disroot.org>
> AuthorDate: 2023-03-13 22:01:12 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2023-03-14 04:19:24 +0000
>
>=C2=A0 =C2=A0 =C2=A0Add GNU glibc compatible secure_getenv
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Add mostly glibc and msl compatible secure_getenv. = Return NULL if
>=C2=A0 =C2=A0 =C2=A0issetugid() indicates the process is tainted, other= wise getenv(x).=C2=A0 The
>=C2=A0 =C2=A0 =C2=A0rational behind this is the fact that many Linux ap= plications use this
>=C2=A0 =C2=A0 =C2=A0function instead of getenv() as it's widely con= sider a, "best
>=C2=A0 =C2=A0 =C2=A0practice".
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Reviewed by: imp, mjg (feedback)
>=C2=A0 =C2=A0 =C2=A0Pull Request: https://github.= com/freebsd/freebsd-src/pull/686
>=C2=A0 =C2=A0 =C2=A0Signed-off-by: Lucy Marsh <seafork@disroot.org>
> ---
>=C2=A0 include/stdlib.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 1 +
>=C2=A0 lib/libc/stdlib/Makefile.inc |=C2=A0 4 ++--
>=C2=A0 lib/libc/stdlib/Symbol.map=C2=A0 =C2=A0|=C2=A0 1 +
>=C2=A0 lib/libc/stdlib/getenv.3=C2=A0 =C2=A0 =C2=A0| 26 +++++++++++++++= ++++++++++-
>=C2=A0 lib/libc/stdlib/getenv.c=C2=A0 =C2=A0 =C2=A0| 12 ++++++++++++ >=C2=A0 5 files changed, 41 insertions(+), 3 deletions(-)
>
> diff --git a/include/stdlib.h b/include/stdlib.h
> index 01629ed84a11..c41e8704e810 100644
> --- a/include/stdlib.h
> +++ b/include/stdlib.h
> @@ -111,6 +111,7 @@ void=C2=A0 =C2=A0 =C2=A0 =C2=A0qsort(void *, size_= t, size_t,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int (* _Nonnull)(const void *,= const void *));
>=C2=A0 int=C2=A0 =C2=A0rand(void);
>=C2=A0 void *realloc(void *, size_t) __result_use_check __alloc_size(2)= ;
> +char *secure_getenv(const char *);
The declaration must be put under BSD_VISIBLE.

=C2=A0
>=C2=A0 void=C2=A0 srand(unsigned);
>=C2=A0 double=C2=A0 =C2=A0 =C2=A0 =C2=A0 strtod(const char * __restrict= , char ** __restrict);
>=C2=A0 float=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0strtof(const char * __res= trict, char ** __restrict);
--00000000000056f71d05f6dec12e--