public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21719] New: program using "initgroups()" fails with stack corruption
@ 2005-05-23 13:59 Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-05-23 14:02 ` [Bug c/21719] " pinskia at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ulrich dot Windl at rz dot uni-regensburg dot de @ 2005-05-23 13:59 UTC (permalink / raw)
  To: gcc-bugs

Tracing down a problem with sudo receiving a stack corruption on one machine,
I've found out that a minimal program gets a stack corruption when compiled with
gcc-3.4.3, but not when being compiled with HP's bundled "cc". See details here:
http://www.sudo.ws/bugs/show_bug.cgi?id=170#c26

The minimal program is this:
main()
{
    initgroups("root", 3);
}

Possible required further conditions are: /etc/group must have "+:" in the last
line, /etc/nsswitch.conf should have "compat" for selector "groups", and the
machine should be NIS master server. (When removing the "+:" from /etc/group,
the gcc-compiled binary also doesn't get a memory fault).
I'd like to file a bug report for the HP C library once I know it's not a gcc
bug. Upon request I can attach or include disassemblies of both, HP-CC code, and
 GCC code.

-- 
           Summary: program using "initgroups()" fails with stack corruption
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Ulrich dot Windl at rz dot uni-regensburg dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: hppa2.0w-hp-hpux11.11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug c/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
@ 2005-05-23 14:02 ` pinskia at gcc dot gnu dot org
  2005-05-23 14:03 ` [Bug target/21719] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-23 14:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-23 14:02 -------
This really sounds like a HP C library bug or bug in the code but I don't know for sure.  You are using 
old style K&R C, can you use -Wall -W and fix all the warnings?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug target/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-05-23 14:02 ` [Bug c/21719] " pinskia at gcc dot gnu dot org
@ 2005-05-23 14:03 ` pinskia at gcc dot gnu dot org
  2005-05-24  8:38 ` Ulrich dot Windl at rz dot uni-regensburg dot de
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-23 14:03 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |target
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug target/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-05-23 14:02 ` [Bug c/21719] " pinskia at gcc dot gnu dot org
  2005-05-23 14:03 ` [Bug target/21719] " pinskia at gcc dot gnu dot org
@ 2005-05-24  8:38 ` Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-05-31 17:41 ` sje at cup dot hp dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ulrich dot Windl at rz dot uni-regensburg dot de @ 2005-05-24  8:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Ulrich dot Windl at rz dot uni-regensburg dot de  2005-05-24 08:31 -------
Created an attachment (id=8958)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=8958&action=view)
Log file with revised source, disassemblies for both compilers

I've revised the source to fix all warnings (except unused formal parameters).
Including the declaration or not does not make any difference BTW. I've also
added gdb's disassembly of function main for both compilers; gcc-3.4.3, and
that of HP-UX 11.11. Finally let me remark that the OS runs 64 bit, but all
binaries are 32 bit (which is no problem at all).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug target/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
                   ` (2 preceding siblings ...)
  2005-05-24  8:38 ` Ulrich dot Windl at rz dot uni-regensburg dot de
@ 2005-05-31 17:41 ` sje at cup dot hp dot com
  2005-06-01  6:14 ` Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-06-01 19:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: sje at cup dot hp dot com @ 2005-05-31 17:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sje at cup dot hp dot com  2005-05-31 17:38 -------
This seems more likely to be an HP library bug.  I recommend trying the latest
libc patch for HP-UX 11.11, PHCO_31903.  There is a reference to the HP defect
JAGad41604 that may be causing your problem.  I don't know why it wouldn't fail
when compiled with HP'c C.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com
  GCC build triplet|hppa2.0w-hp-hpux11.11       |hppa2.0w-hpux11.11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug target/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
                   ` (3 preceding siblings ...)
  2005-05-31 17:41 ` sje at cup dot hp dot com
@ 2005-06-01  6:14 ` Ulrich dot Windl at rz dot uni-regensburg dot de
  2005-06-01 19:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: Ulrich dot Windl at rz dot uni-regensburg dot de @ 2005-06-01  6:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From Ulrich dot Windl at rz dot uni-regensburg dot de  2005-06-01 06:14 -------
Just for reference: The machine in question does not have C-library patch
PHCO_31903 installed, but the quoted defect (JAGad41604) doesn't seem to be
relevant (The system isn't a trusted one, and only the "hosts" entry in
/etc/nsswitch.conf uses "dns", while the "group" entry uses "compat").
I'm hoping someone who really understands the PA assembler can compare the
assembly code of both compilers and find out whether there's a significant
difference. Having something like Linux' "ltrace" or "valgrind" for HP-UX would
be great to track down that problem.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

* [Bug target/21719] program using "initgroups()" fails with stack corruption
  2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
                   ` (4 preceding siblings ...)
  2005-06-01  6:14 ` Ulrich dot Windl at rz dot uni-regensburg dot de
@ 2005-06-01 19:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-01 19:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-01 19:52 -------
Not a GCC bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21719


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

end of thread, other threads:[~2005-06-01 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 13:59 [Bug c/21719] New: program using "initgroups()" fails with stack corruption Ulrich dot Windl at rz dot uni-regensburg dot de
2005-05-23 14:02 ` [Bug c/21719] " pinskia at gcc dot gnu dot org
2005-05-23 14:03 ` [Bug target/21719] " pinskia at gcc dot gnu dot org
2005-05-24  8:38 ` Ulrich dot Windl at rz dot uni-regensburg dot de
2005-05-31 17:41 ` sje at cup dot hp dot com
2005-06-01  6:14 ` Ulrich dot Windl at rz dot uni-regensburg dot de
2005-06-01 19:52 ` pinskia at gcc dot gnu dot 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).