Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2023 10:30:59 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Warner Losh <imp@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: adeca21464d2 - main - Add GNU glibc compatible secure_getenv
Message-ID:  <CANCZdfpkEq5%2BPRaieR4wz4AK_NBtzw5deMZB7c%2B1TcG=0zjqgA@mail.gmail.com>
In-Reply-To: <ZBA6JXzO3dq0egDi@kib.kiev.ua>
References:  <202303140419.32E4Jtsd058392@gitrepo.freebsd.org> <ZBA6JXzO3dq0egDi@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Tue, Mar 14, 2023 at 3:11 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=adeca21464d25bc61f98968a5c1e76ab3c808ae4
> >
> > commit adeca21464d25bc61f98968a5c1e76ab3c808ae4
> > Author:     lucy <seafork@disroot.org>
> > AuthorDate: 2023-03-13 22:01:12 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > 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 <seafork@disroot.org>
> > ---
> >  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);
>

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 14, 2023 at 3:11 AM Konstantin Belousov &lt;<a href="mailto:kostikbel@gmail.com">kostikbel@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Mar 14, 2023 at 04:19:55AM +0000, Warner Losh wrote:<br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=adeca21464d25bc61f98968a5c1e76ab3c808ae4" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=adeca21464d25bc61f98968a5c1e76ab3c808ae4</a><br>;
&gt; <br>
&gt; commit adeca21464d25bc61f98968a5c1e76ab3c808ae4<br>
&gt; Author:     lucy &lt;<a href="mailto:seafork@disroot.org" target="_blank">seafork@disroot.org</a>&gt;<br>
&gt; AuthorDate: 2023-03-13 22:01:12 +0000<br>
&gt; Commit:     Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2023-03-14 04:19:24 +0000<br>
&gt; <br>
&gt;     Add GNU glibc compatible secure_getenv<br>
&gt;     <br>
&gt;     Add mostly glibc and msl compatible secure_getenv. Return NULL if<br>
&gt;     issetugid() indicates the process is tainted, otherwise getenv(x).  The<br>
&gt;     rational behind this is the fact that many Linux applications use this<br>
&gt;     function instead of getenv() as it&#39;s widely consider a, &quot;best<br>
&gt;     practice&quot;.<br>
&gt;     <br>
&gt;     Reviewed by: imp, mjg (feedback)<br>
&gt;     Pull Request: <a href="https://github.com/freebsd/freebsd-src/pull/686" rel="noreferrer" target="_blank">https://github.com/freebsd/freebsd-src/pull/686</a><br>;
&gt;     Signed-off-by: Lucy Marsh &lt;<a href="mailto:seafork@disroot.org" target="_blank">seafork@disroot.org</a>&gt;<br>
&gt; ---<br>
&gt;  include/stdlib.h             |  1 +<br>
&gt;  lib/libc/stdlib/Makefile.inc |  4 ++--<br>
&gt;  lib/libc/stdlib/Symbol.map   |  1 +<br>
&gt;  lib/libc/stdlib/getenv.3     | 26 +++++++++++++++++++++++++-<br>
&gt;  lib/libc/stdlib/getenv.c     | 12 ++++++++++++<br>
&gt;  5 files changed, 41 insertions(+), 3 deletions(-)<br>
&gt; <br>
&gt; diff --git a/include/stdlib.h b/include/stdlib.h<br>
&gt; index 01629ed84a11..c41e8704e810 100644<br>
&gt; --- a/include/stdlib.h<br>
&gt; +++ b/include/stdlib.h<br>
&gt; @@ -111,6 +111,7 @@ void       qsort(void *, size_t, size_t,<br>
&gt;           int (* _Nonnull)(const void *, const void *));<br>
&gt;  int   rand(void);<br>
&gt;  void *realloc(void *, size_t) __result_use_check __alloc_size(2);<br>
&gt; +char *secure_getenv(const char *);<br>
The declaration must be put under BSD_VISIBLE.<br></blockquote><div><br></div><div>Thanks. <a href="https://reviews.freebsd.org/D39076">https://reviews.freebsd.org/D39076</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
&gt;  void  srand(unsigned);<br>
&gt;  double        strtod(const char * __restrict, char ** __restrict);<br>
&gt;  float         strtof(const char * __restrict, char ** __restrict);<br>
</blockquote></div></div>

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfpkEq5%2BPRaieR4wz4AK_NBtzw5deMZB7c%2B1TcG=0zjqgA>