BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000222 [uClibc] Architecture Specific major always 04-11-05 21:15 04-27-05 06:16
Reporter Luke View Status public  
Assigned To jocke
Priority normal Resolution fixed  
Status closed   Product Version 0.9.27
Summary 0000222: 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.
Additional Information
Attached Files  999-sysvipc.patch [^] (5,937 bytes) 04-16-05 19:48
 uClibc-0.9.27-sysvipc-msqid64.patch [^] (7,761 bytes) 04-23-05 22:03
 tst_msg.c [^] (2,633 bytes) 04-23-05 22:03

- Relationships

- Notes
(0000142)
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
 
(0000165)
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.
 
(0000166)
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...
 
(0000171)
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.
 
(0000172)
Luke
04-17-05 06:08
edited on: 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?

 
(0000173)
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?
 
(0000174)
jocke
04-17-05 14:26

Here is a similar report for PPC.
http://cvs.uclibc.org/lists/uclibc/2005-April/011529.html [^]
 
(0000185)
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.
 
(0000186)
jocke
04-23-05 05:35

Good.
I think it just as well to convert all archs to the newer __IPC_64 i/f and
be done with it. I don't think support for 2.2 kernels is needed.
 
(0000188)
Luke
04-23-05 22:02

Actually there wasnt much to do.

Patch uploaded...
Simple test program for IPC msg queues uploaded.
 
(0000189)
jocke
04-24-05 12:31

Just checked in a patch for the new __IPC_64 syscall interface. You will
find that there are a few differences from your latest patch. Please
check that this works for you.
 
(0000190)
Luke
04-24-05 19:21

Browsing the source tells me there are two main differences:
(1) in my patch, the fields in msqid_ds are __kernel_whatever_t rather than __whatever_t since this seems to be common throughout uclibc.
(2) my libc/sysdeps/linux/sparc/bits/msq.h gets rid of the #ifdef __WORDSIZE stuff and makes it more like the msqid64_ds struct in the kernel.
 
(0000193)
jocke
04-24-05 23:58

(1)
  Kernel types should not be exported to user space if it can be avoided.
  UClibc needs some more cleanup in this respect.

(2)
  The __WORDSIZE stuff is needed to separate SPARC32/64, PowerPC32/64 once
  once that gets supported.

Also
  A few archs got a new ipc.h and/or msq.h

I guess everthing is working for you as expected?
I will wait a day or so until I close this report.
 
(0000194)
jocke
04-25-05 00:00

New __IPC_64 interface added to SVN repo.
 
(0000196)
jocke
04-27-05 06:16

No complaints so far, lets close it.
 

- 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
04-23-05 05:35 jocke Note Added: 0000186
04-23-05 22:02 Luke Note Added: 0000188
04-23-05 22:03 Luke File Added: uClibc-0.9.27-sysvipc-msqid64.patch
04-23-05 22:03 Luke File Added: tst_msg.c
04-24-05 12:31 jocke Note Added: 0000189
04-24-05 19:21 Luke Note Added: 0000190
04-24-05 23:58 jocke Note Added: 0000193
04-24-05 23:58 jocke Assigned To uClibc => jocke
04-25-05 00:00 jocke Status assigned => resolved
04-25-05 00:00 jocke Resolution open => fixed
04-25-05 00:00 jocke Note Added: 0000194
04-27-05 06:16 jocke Status resolved => closed
04-27-05 06:16 jocke Note Added: 0000196


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker