public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/65018] New: Use secure_getenv when available
@ 2015-02-11 11:27 redi at gcc dot gnu.org
  2021-07-30  9:40 ` [Bug libstdc++/65018] " rschiron at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-02-11 11:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65018

            Bug ID: 65018
           Summary: Use secure_getenv when available
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

The calls to getenv in the following files should use the GNU extension
secure_getenv:

include/ext/mt_allocator.h:      _M_force_new(std::getenv("GLIBCXX_FORCE_NEW")
? true : false)
include/ext/mt_allocator.h:                         
std::getenv("GLIBCXX_FORCE_NEW") ? true : false);
include/ext/pool_allocator.h:         if (std::getenv("GLIBCXX_FORCE_NEW"))
include/profile/impl/profiler_trace.h:    char* __env_value =
std::getenv(__env_var);
include/profile/impl/profiler_trace.h:    char* __env_trace_file_name =
std::getenv(_GLIBCXX_PROFILE_TRACE_ENV_VAR);
include/profile/impl/profiler_trace.h:      =
std::getenv(_GLIBCXX_PROFILE_MAX_WARN_COUNT_ENV_VAR);
include/profile/impl/profiler_trace.h:      const char* __env_value =
std::getenv(__factor->__env_var);
src/c++11/debug.cc:    const char* __nptr =
std::getenv("GLIBCXX_DEBUG_MESSAGE_LENGTH");
src/c++98/localename.cc:            char* __env = std::getenv("LC_ALL");
src/c++98/localename.cc:                __env = std::getenv("LANG");
src/c++98/localename.cc:                      __env =
std::getenv(_S_categories[__i]);
src/c++98/localename.cc:                      __env =
std::getenv(_S_categories[__i]);
src/c++98/localename.cc:                        __env =
std::getenv(_S_categories[__i]);


>From Jakub on IRC: "note that at some point, there used to be __secure_getenv
instead. perhaps look at libgfortran configury what it does for this"


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/65018] Use secure_getenv when available
  2015-02-11 11:27 [Bug libstdc++/65018] New: Use secure_getenv when available redi at gcc dot gnu.org
@ 2021-07-30  9:40 ` rschiron at redhat dot com
  2021-07-30 13:04 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rschiron at redhat dot com @ 2021-07-30  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65018

rschiron at redhat dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rschiron at redhat dot com

--- Comment #3 from rschiron at redhat dot com ---
Function fs::temp_directory_path() in src/filesystem/ops.cc uses getenv() on
TMPDIR/TMP/TEMP/TEMPDIR. Probably secure_getenv() should be used in that case.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/65018] Use secure_getenv when available
  2015-02-11 11:27 [Bug libstdc++/65018] New: Use secure_getenv when available redi at gcc dot gnu.org
  2021-07-30  9:40 ` [Bug libstdc++/65018] " rschiron at redhat dot com
@ 2021-07-30 13:04 ` redi at gcc dot gnu.org
  2021-07-30 17:13 ` cvs-commit at gcc dot gnu.org
  2022-04-21 12:34 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-30 13:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65018

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #0)
> From Jakub on IRC: "note that at some point, there used to be
> __secure_getenv instead. perhaps look at libgfortran configury what it does
> for this"

secure_getenv was added to glibc in 2.17, before then only the internal
__secure_getenv was provided. But I don't think we need to care too much about
pre-2.17 so I'm not going to bother checking for __secure_getenv.

The profile mode has been removed from libstdc++, so we don't need to care
about those variables now. The others in comment 0 are not a problem. Only the
queries for TMPDIR etc need to use secure_getenv. I am testing a patch for
that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/65018] Use secure_getenv when available
  2015-02-11 11:27 [Bug libstdc++/65018] New: Use secure_getenv when available redi at gcc dot gnu.org
  2021-07-30  9:40 ` [Bug libstdc++/65018] " rschiron at redhat dot com
  2021-07-30 13:04 ` redi at gcc dot gnu.org
@ 2021-07-30 17:13 ` cvs-commit at gcc dot gnu.org
  2022-04-21 12:34 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-30 17:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65018

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:3dbd4d94bf380f3efa8bba9b203ce7d4c8f47fbb

commit r12-2631-g3dbd4d94bf380f3efa8bba9b203ce7d4c8f47fbb
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jul 30 13:56:14 2021 +0100

    libstdc++: Use secure_getenv for filesystem::temp_directory_path()
[PR65018]

    This adds a configure check for the GNU extension secure_getenv and then
    uses it for looking up TMPDIR and similar variables.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/65018
            * configure.ac: Check for secure_getenv.
            * config.h.in: Regenerate.
            * configure: Regenerate.
            * src/filesystem/ops-common.h (get_temp_directory_from_env): New
            helper function to obtain path from the environment.
            * src/c++17/fs_ops.cc (fs::temp_directory_path): Use new helper.
            * src/filesystem/ops.cc (fs::temp_directory_path): Likewise.
            * testsuite/27_io/filesystem/operations/temp_directory_path.cc:
            Print messages if test cannot be run.
            *
testsuite/experimental/filesystem/operations/temp_directory_path.cc:
            Likewise. Fix incorrect condition. Use "TMP" to work with
            Windows as well as POSIX.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/65018] Use secure_getenv when available
  2015-02-11 11:27 [Bug libstdc++/65018] New: Use secure_getenv when available redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-07-30 17:13 ` cvs-commit at gcc dot gnu.org
@ 2022-04-21 12:34 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-21 12:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65018

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:90f2289496e4890e1e03fc3d794c0f8efb75cc0e

commit r11-9919-g90f2289496e4890e1e03fc3d794c0f8efb75cc0e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jul 30 13:56:14 2021 +0100

    libstdc++: Use secure_getenv for filesystem::temp_directory_path()
[PR65018]

    This adds a configure check for the GNU extension secure_getenv and then
    uses it for looking up TMPDIR and similar variables.

    Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

    libstdc++-v3/ChangeLog:

            PR libstdc++/65018
            * configure.ac: Check for secure_getenv.
            * config.h.in: Regenerate.
            * configure: Regenerate.
            * src/filesystem/ops-common.h (get_temp_directory_from_env): New
            helper function to obtain path from the environment.
            * src/c++17/fs_ops.cc (fs::temp_directory_path): Use new helper.
            * src/filesystem/ops.cc (fs::temp_directory_path): Likewise.
            * testsuite/27_io/filesystem/operations/temp_directory_path.cc:
            Print messages if test cannot be run.
            *
testsuite/experimental/filesystem/operations/temp_directory_path.cc:
            Likewise. Fix incorrect condition. Use "TMP" to work with
            Windows as well as POSIX.

    (cherry picked from commit 3dbd4d94bf380f3efa8bba9b203ce7d4c8f47fbb)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-21 12:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-11 11:27 [Bug libstdc++/65018] New: Use secure_getenv when available redi at gcc dot gnu.org
2021-07-30  9:40 ` [Bug libstdc++/65018] " rschiron at redhat dot com
2021-07-30 13:04 ` redi at gcc dot gnu.org
2021-07-30 17:13 ` cvs-commit at gcc dot gnu.org
2022-04-21 12:34 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).