This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[jhw@wetware.com] libc/1574: semctl variable parameter handling



Hi glibc developers,

we've received the appended bug report about a problem on PowerPC.
Could somebody look into it and send a fix?

Thanks,
Andreas




>Number:         1574
>Category:       libc
>Synopsis:       semctl variable parameter handling
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    libc-gnats
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Wed Feb 02 12:10:01 EST 2000
>Last-Modified:
>Originator:     jhw@wetware.com
>Organization:
net
>Release:        glibc-2.1.2
>Environment:
Linux
>Description:
The prototype for the System V IPC call 'semctl' is declared in the header
file like so:

	int semctl(int, int, int, ...)

Nevertheless, the source code for the function in the implementation for Linux kernels does not key off the third argument to decide whether to acquire the fourth argument (always a union semun passed by value)-- it just reaches for it whether it was provided or not.

This causes gcc, and presumably most other compilers, to produce code that
exhibits what the ANSI C standard euphemistically refers to as "undefined
behavior".  It may very well be that on some architectures of Linux, the GCC
compiler produces code that works, but on my Powerbook G3 running Linux/PPC
1999 and gcc-2.95.2, I get code that unceremoniously core dumps right where
the va_arg() macro lives.

I am, of course, not surprised; and I realize that trying to use System V IPC
on Linux/PPC with a Powerbook G3 is evidence of great sin in my life, but one
dances with them that brung you.
>How-To-Repeat:
Try this on Linux/PPC 1999, or any other architecture for which structures
passed by value are managed some other way than simply pushing them byte-for-
byte onto the stack:

	semctl(semid, semnum, IPC_RMID);

Observe the lovely SIGSEGV event-sequence that smells funny
>Fix:
>Audit-Trail:
>Unformatted:




-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]