[uClibc-cvs] [uClibc 0000222]: SysV IPC incorrect in user space

bugs at busybox.net bugs at busybox.net
Sat Apr 23 06:51:04 UTC 2005


A NOTE has been added to this issue.
======================================================================
<http://busybox.net/bugs/view.php?id=222> 
======================================================================
Reported By:                Luke
Assigned To:                uClibc
======================================================================
Project:                    uClibc
Issue ID:                   222
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
======================================================================
Date Submitted:             04-11-2005 21:15 PDT
Last Modified:              04-22-2005 23:51 PDT
======================================================================
Summary:                    SysV IPC incorrect in user space
Description: 
The output of ipcs does not correspond to the output of /proc/sysvipc/msg.


More specifically ipcs reports the "used-bytes" column to be 16384 when
there are no messages on the queue.

It looks like an alignment issue in the msqid_ds structure in
/usr/include/bits/ipc.h since the msg_qbytes default value of 16384 is
actually being seen in the msg_cbytes field.
======================================================================

----------------------------------------------------------------------
 Luke - 04-11-05 23:08 
----------------------------------------------------------------------
uClibc        : 0.9.27
kernel        : 2.6.11.6
gcc           : 3.4.3
kernel-headers: 2.6.11.2
busybox       : 1.00

Built using buildroot

----------------------------------------------------------------------
 Luke - 04-16-05 04:13 
----------------------------------------------------------------------
uClibc needs to distinguish between msqid_ds and msqid64_ds and be able to
convert from one to the other.

glibc does this and passes __IPC_64 as part of the cmd arg in msgctl,
shmctl and semctl syscalls.

----------------------------------------------------------------------
 Luke - 04-16-05 19:18 
----------------------------------------------------------------------
I have a patch against 0.9.27 that fixes the issue with the
{msg,sem,shm}ctl calls  
however I am not sure if uClibc keeps compatibility with older libc
versions and if so, this patch would break that compatibility.

glibc uses conditional compilation using SHLIB_COMPAT macros but I do not
see such a mechanism is uClibc.

If we want to use newer structures, glibc ORs the cmd field with __IPC_64
(0x100) in the {msg,sem,shm}ctl syscalls and everything is fine, otherwise
if SHLIB_COMPAT is set then it must ensure it passes the older struct in
the syscall (since that is what the kernel would be using).

It seems later 2.4.x and 2.6.x will work fine with this patch, 2.2.x will
not...

Anyhow, I will upload patch for those interested. Since I dont have much
experience with uClibc (or glibc for that matter) I cant make any
guarentees...

----------------------------------------------------------------------
 jocke - 04-17-05 03:32 
----------------------------------------------------------------------
Does all archs in glibc/kernel use the new __IPC_64 stuff?

Does this patch apply to all archs in uClibc?

uClibc usally break binary compatiblity between releases so you
must recompile your apps, but I don't know if uClibc still works
for 2.2 kernels.

----------------------------------------------------------------------
 Luke - 04-17-05 06:09 
----------------------------------------------------------------------
This particular patch does not apply to alpha, powerpc or sparc, as they
have slightly modified definitions (becuase of differing wordsizes, etc),
but the kernel definately uses the msqid64_ds for all arches (you can look
at linux/include/asm-*/msgbuf.h in the kernel sources).

I havent tried extending the patch to the other arches, as I dont have
anyway to test them but it should quite trivial, the changes would follow
suit as for the i386 patch.

I can provide the necessary patches and perhaps someone could test them?



----------------------------------------------------------------------
 jocke - 04-17-05 11:42 
----------------------------------------------------------------------
hmm, if all archs in kernel uses the msqid64_ds struct should not uClibc
do that as well? Please extend the patch to cover all archs. I can test
powerpc. Do you have a small test app?

----------------------------------------------------------------------
 jocke - 04-17-05 14:26 
----------------------------------------------------------------------
Here is a similar report for PPC.
http://cvs.uclibc.org/lists/uclibc/2005-April/011529.html

----------------------------------------------------------------------
 Luke - 04-22-05 23:51 
----------------------------------------------------------------------
Ok sorry, been a little busy with work and all.

Am working on them over the next couple of days.

Issue History
Date Modified  Username       Field                    Change              
======================================================================
04-11-05 21:15 Luke           New Issue                                    
04-11-05 23:08 Luke           Note Added: 0000142                          
04-13-05 22:29 Luke           Note Added: 0000146                          
04-16-05 04:13 Luke           Note Added: 0000165                          
04-16-05 15:42 vapier         Project                  buildroot => uClibc 
04-16-05 19:18 Luke           Note Added: 0000166                          
04-16-05 19:18 Luke           Note Edited: 0000146                         
04-16-05 19:24 Luke           Note Added: 0000167                          
04-16-05 19:48 Luke           File Added: 999-sysvipc.patch                    
04-16-05 19:49 Luke           Note Added: 0000168                          
04-16-05 19:49 Luke           Note Deleted: 0000167                        
04-16-05 19:49 Luke           Note Deleted: 0000168                        
04-16-05 19:49 Luke           Note Deleted: 0000146                        
04-17-05 03:32 jocke          Note Added: 0000171                          
04-17-05 06:08 Luke           Note Added: 0000172                          
04-17-05 06:09 Luke           Note Edited: 0000172                         
04-17-05 11:42 jocke          Note Added: 0000173                          
04-17-05 14:26 jocke          Note Added: 0000174                          
04-22-05 23:51 Luke           Note Added: 0000185                          
======================================================================




More information about the uClibc-cvs mailing list