[Bug 4910] New: __IPC_64 bit is not expected by Kernel's SYSV *ctl fuctions

bugzilla at busybox.net bugzilla at busybox.net
Tue Mar 13 00:32:40 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=4910

           Summary: __IPC_64 bit is not expected by Kernel's SYSV *ctl
                    fuctions
           Product: uClibc
           Version: 0.9.32
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Standard Compliance
        AssignedTo: unassigned at uclibc.org
        ReportedBy: skoulik at gmail.com
                CC: uclibc-cvs at uclibc.org
   Estimated Hours: 0.0


The following define in libc/misc/sysvipc/ipc.h effectively makes uclibc
wrappers OR user's *ctl commands with 0x100 before passing to kernel. However
this flag is not expected and not decoded on kernel side. The latter causes all
user's commands passed to *ctl fuctions fail with EINVAL result.

#if __WORDSIZE == 32 || defined __alpha__ || defined __mips__
# define __IPC_64    0x100
#else
# define __IPC_64    0x0
#endif

The problem affects the following SYSV fuctions: semctl(), msgctl(), shmctl().
ipc/sem.c:
SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg)
{
[...]
   switch(cmd) { <-- 0x100 is not removed, goes directly to default case and
returns -EINVAL

ipc/shm.c:
SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
{
[...]
   version = ipc_parse_version(&cmd); <-- 0x100 is removed iff
__ARCH_WANT_IPC_PARSE_VERSION is defined (which is not always the case)

ipc/msg.c:
SYSCALL_DEFINE3(msgctl, int, msqid, int, cmd, struct msqid_ds __user *, buf)
{
[...]
   version = ipc_parse_version(&cmd); <-- 0x100 is removed iff
__ARCH_WANT_IPC_PARSE_VERSION is defined (which is not always the case)

A quick and dirty fix is to define __IPC_64 0x0 unconditionally as modern
kernels do not seem to use old 32 bit structures internally any more (checked
2.6 and 3.x trunk). So does user space.

A better solution is to look at kernel's version to check if 0x100 is actually
needed.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the uClibc-cvs mailing list