public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning
@ 2012-07-03 13:43 nyh at math dot technion.ac.il
  2012-07-03 13:55 ` [Bug libc/14327] " polacek at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nyh at math dot technion.ac.il @ 2012-07-03 13:43 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

             Bug #: 14327
           Summary: pthread uses mktemp(), causing link-time warning
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: nyh@math.technion.ac.il
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


When *statically* linking a program with -lpthread, I get the following
warning:

/usr/lib/gcc/x86_64-redhat-linux/4.7.0/../../../../lib64/libpthread.a(libpthread.o):
In function `sem_open':
(.text+0x67f8): warning: the use of `mktemp' is dangerous, better use `mkstemp'

This warning is annoying, because it implies there something wrong with
libpthread. Can glibc use mkstemp like the warning suggests? Or do something
else to avoid this warning from the linker?

I'm seeing this problem on Fedora 17, gcc 4.7.0, glibc 2.15.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
@ 2012-07-03 13:55 ` polacek at redhat dot com
  2012-07-03 14:02 ` aj at suse dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: polacek at redhat dot com @ 2012-07-03 13:55 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

Marek Polacek <polacek at redhat dot com> changed:

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

--- Comment #1 from Marek Polacek <polacek at redhat dot com> 2012-07-03 13:54:35 UTC ---
Well, no, the comment above mktemp says:
"We really want to use mktemp here.  We cannot use mkstemp since the file must
be opened with a specific mode.  The mode cannot later be set since then we
cannot apply the file create mask."

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
  2012-07-03 13:55 ` [Bug libc/14327] " polacek at redhat dot com
@ 2012-07-03 14:02 ` aj at suse dot de
  2012-07-03 14:16 ` nyh at math dot technion.ac.il
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aj at suse dot de @ 2012-07-03 14:02 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

Andreas Jaeger <aj at suse dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aj at suse dot de

--- Comment #2 from Andreas Jaeger <aj at suse dot de> 2012-07-03 14:02:29 UTC ---
Initial analysis:
nptl/sem_open.c contains:

       {
          /* Add the suffix for mktemp.  */
          strcpy (xxxxxx, "XXXXXX");

          /* We really want to use mktemp here.  We cannot use mkstemp
             since the file must be opened with a specific mode.  The
             mode cannot later be set since then we cannot apply the
             file create mask.  */
          if (mktemp (tmpfname) == NULL)
            return SEM_FAILED;

          /* Open the file.  Make sure we do not overwrite anything.  */
          fd = __libc_open (tmpfname, O_RDWR | O_CREAT | O_EXCL, mode);


There's no function that does this directly. mktemp is short, we could use the
implementation directly in sem_open just avoiding the warning, I just don't
like duplication of code.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
  2012-07-03 13:55 ` [Bug libc/14327] " polacek at redhat dot com
  2012-07-03 14:02 ` aj at suse dot de
@ 2012-07-03 14:16 ` nyh at math dot technion.ac.il
  2012-07-03 23:15 ` bugdal at aerifal dot cx
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nyh at math dot technion.ac.il @ 2012-07-03 14:16 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

--- Comment #3 from Nadav Har'El <nyh at math dot technion.ac.il> 2012-07-03 14:16:23 UTC ---
I have another possible (even is twisted) workaround.

In glibc, rename the current function mktemp() to _mktemp(), and have mktemp()
call _mktemp(). Users that use mktemp() will be warned, as usual. But the
libpthread code, aware of _mktemp(), will "extern" it (it won't be in any
header file) and use it.

Another, cleaner, option is to invent a new function, say mkomstemp(), which is
like mkostemp() but adds a mode parameter, and then (?) libpthread could use
that (though I'm not sure - I don't know what is __libc_open).

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
                   ` (2 preceding siblings ...)
  2012-07-03 14:16 ` nyh at math dot technion.ac.il
@ 2012-07-03 23:15 ` bugdal at aerifal dot cx
  2013-01-16 14:59 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bugdal at aerifal dot cx @ 2012-07-03 23:15 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> 2012-07-03 23:15:16 UTC ---
This bug needs to be fixed anyway since calling mktemp is a namespace
violation. mktemp was removed from POSIX in 2008. So calling __mktemp or
similar instead would be the perfect fix.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
                   ` (3 preceding siblings ...)
  2012-07-03 23:15 ` bugdal at aerifal dot cx
@ 2013-01-16 14:59 ` schwab@linux-m68k.org
  2013-05-15  9:45 ` schwab@linux-m68k.org
  2014-06-13 18:50 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2013-01-16 14:59 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |2.18

--- Comment #5 from Andreas Schwab <schwab@linux-m68k.org> 2013-01-16 14:58:52 UTC ---
Fixed in 2.18.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
                   ` (4 preceding siblings ...)
  2013-01-16 14:59 ` schwab@linux-m68k.org
@ 2013-05-15  9:45 ` schwab@linux-m68k.org
  2014-06-13 18:50 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2013-05-15  9:45 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=14327

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |geir at cray dot com

--- Comment #6 from Andreas Schwab <schwab@linux-m68k.org> 2013-05-15 09:45:18 UTC ---
*** Bug 15137 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/14327] pthread uses mktemp(), causing link-time warning
  2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
                   ` (5 preceding siblings ...)
  2013-05-15  9:45 ` schwab@linux-m68k.org
@ 2014-06-13 18:50 ` fweimer at redhat dot com
  6 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=14327

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-13 18:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-03 13:43 [Bug libc/14327] New: pthread uses mktemp(), causing link-time warning nyh at math dot technion.ac.il
2012-07-03 13:55 ` [Bug libc/14327] " polacek at redhat dot com
2012-07-03 14:02 ` aj at suse dot de
2012-07-03 14:16 ` nyh at math dot technion.ac.il
2012-07-03 23:15 ` bugdal at aerifal dot cx
2013-01-16 14:59 ` schwab@linux-m68k.org
2013-05-15  9:45 ` schwab@linux-m68k.org
2014-06-13 18:50 ` fweimer at redhat dot com

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).