From: Joel Soete <soete.joel@tiscali.be>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Carlos O'Donell <carlos@baldric.uwo.ca>,
Randolph Chung <randolph@tausq.org>,
parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] what's up with the ipc syscalls?
Date: Tue, 11 Nov 2003 20:41:15 +0000 [thread overview]
Message-ID: <3FB1496B.1080504@tiscali.be> (raw)
In-Reply-To: <20031110234414.GA27527@solo.franken.de>
Thomas Bogendoerfer wrote:
> On Mon, Nov 03, 2003 at 04:41:19PM -0500, Carlos O'Donell wrote:
>
>>On Mon, Nov 03, 2003 at 09:56:01AM +0100, Thomas Bogendoerfer wrote:
>
> [ stuff about broken ipc syscalls in 2.6 ...]
>
> I had some thoughts about the conversion stuff, I've added to work
> around problems introduced because of the change of some structures in
> glibc/kernel. I finally realized, that these conversion only works,
> if the "old glibc" is still installed together with the old binary.
> That's because the newer glibcs don't set the IPC_64 bit when doing
> the syscall, but the old binary still uses the wrong structs, so the
> conversion routine never triggers. I think it's really time to remove that
> crap. Below is an compiled but not booted patch, which removes it and also
> forward ports the necessary bits in ipc/util.c from 2.4.
I also reach to compile 2.4 with this patch :).
Can you point me out what should I apply as change to glibc?
Thanks,
Joel
>
> If someone also wants to change glibc, feel free. I still think changing
> glibc is a bad idea, because this new glibc won't work with a current 2.4
> kernel.
>
> Thomas.
>
>
> Index: arch/parisc/kernel/sys_parisc.c
> ===================================================================
> RCS file: /home/cvs/parisc/linux-2.6/arch/parisc/kernel/sys_parisc.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 sys_parisc.c
> --- arch/parisc/kernel/sys_parisc.c 1 Nov 2003 23:44:02 -0000 1.15
> +++ arch/parisc/kernel/sys_parisc.c 10 Nov 2003 23:17:53 -0000
> @@ -241,108 +241,6 @@ asmlinkage ssize_t parisc_readahead(int
> }
>
> /*
> - * FIXME, please remove this crap as soon as possible
> - *
> - * This is here to fix up broken glibc structures,
> - * which are already fixed in newer glibcs
> - */
> -#include <linux/msg.h>
> -#include <linux/sem.h>
> -#include <linux/shm.h>
> -#include "sys32.h"
> -
> -struct broken_ipc_perm
> -{
> - key_t key; /* Key. */
> - uid_t uid; /* Owner's user ID. */
> - gid_t gid; /* Owner's group ID. */
> - uid_t cuid; /* Creator's user ID. */
> - gid_t cgid; /* Creator's group ID. */
> - unsigned short int mode; /* Read/write permission. */
> - unsigned short int __pad1;
> - unsigned short int seq; /* Sequence number. */
> - unsigned short int __pad2;
> - unsigned long int __unused1;
> - unsigned long int __unused2;
> -};
> -
> -struct broken_shmid64_ds {
> - struct broken_ipc_perm shm_perm; /* operation perms */
> - size_t shm_segsz; /* size of segment (bytes) */
> -#ifndef __LP64__
> - unsigned int __pad1;
> -#endif
> - __kernel_time_t shm_atime; /* last attach time */
> -#ifndef __LP64__
> - unsigned int __pad2;
> -#endif
> - __kernel_time_t shm_dtime; /* last detach time */
> -#ifndef __LP64__
> - unsigned int __pad3;
> -#endif
> - __kernel_time_t shm_ctime; /* last change time */
> - __kernel_pid_t shm_cpid; /* pid of creator */
> - __kernel_pid_t shm_lpid; /* pid of last operator */
> - unsigned int shm_nattch; /* no. of current attaches */
> - unsigned int __unused1;
> - unsigned int __unused2;
> -};
> -
> -static void convert_broken_perm (struct broken_ipc_perm *out, struct ipc64_perm *in)
> -{
> - out->key = in->key;
> - out->uid = in->uid;
> - out->gid = in->gid;
> - out->cuid = in->cuid;
> - out->cgid = in->cgid;
> - out->mode = in->mode;
> - out->seq = in->seq;
> -}
> -
> -static int copyout_broken_shmid64(struct broken_shmid64_ds *buf, struct shmid64_ds *sbuf)
> -{
> - struct broken_shmid64_ds tbuf;
> -
> - memset(&tbuf, 0, sizeof tbuf);
> - convert_broken_perm (&tbuf.shm_perm, &sbuf->shm_perm);
> - tbuf.shm_segsz = sbuf->shm_segsz;
> - tbuf.shm_atime = sbuf->shm_atime;
> - tbuf.shm_dtime = sbuf->shm_dtime;
> - tbuf.shm_ctime = sbuf->shm_ctime;
> - tbuf.shm_cpid = sbuf->shm_cpid;
> - tbuf.shm_lpid = sbuf->shm_lpid;
> - tbuf.shm_nattch = sbuf->shm_nattch;
> - return copy_to_user(buf, &tbuf, sizeof tbuf) ? -EFAULT : 0;
> -}
> -
> -int sys_msgctl_broken(int msqid, int cmd, struct msqid_ds *buf)
> -{
> - return sys_msgctl (msqid, cmd & ~IPC_64, buf);
> -}
> -
> -int sys_semctl_broken(int semid, int semnum, int cmd, union semun arg)
> -{
> - return sys_semctl (semid, semnum, cmd & ~IPC_64, arg);
> -}
> -
> -int sys_shmctl_broken(int shmid, int cmd, struct shmid64_ds *buf)
> -{
> - struct shmid64_ds sbuf;
> - int err;
> -
> - if (cmd & IPC_64) {
> - cmd &= ~IPC_64;
> - if (cmd == IPC_STAT || cmd == SHM_STAT) {
> - KERNEL_SYSCALL(err, sys_shmctl, shmid, cmd, (struct shmid_ds *)&sbuf);
> - if (err == 0)
> - err = copyout_broken_shmid64((struct broken_shmid64_ds *)buf, &sbuf);
> - return err;
> - }
> - }
> - return sys_shmctl (shmid, cmd, (struct shmid_ds *)buf);
> -}
> -
> -/*
> * This changes the io permissions bitmap in the current task.
> */
> asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
> Index: arch/parisc/kernel/sys_parisc32.c
> ===================================================================
> RCS file: /home/cvs/parisc/linux-2.6/arch/parisc/kernel/sys_parisc32.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 sys_parisc32.c
> --- arch/parisc/kernel/sys_parisc32.c 28 Sep 2003 04:04:52 -0000 1.11
> +++ arch/parisc/kernel/sys_parisc32.c 10 Nov 2003 23:19:00 -0000
> @@ -1352,12 +1352,10 @@ asmlinkage int sys32_lseek(unsigned int
> return sys_lseek(fd, offset, origin);
> }
>
> -asmlinkage long sys32_semctl_broken(int semid, int semnum, int cmd, union semun arg)
> +asmlinkage long sys32_semctl(int semid, int semnum, int cmd, union semun arg)
> {
> union semun u;
>
> - cmd &= ~IPC_64; /* should be removed together with the _broken suffix */
> -
> if (cmd == SETVAL) {
> /* Ugh. arg is a union of int,ptr,ptr,ptr, so is 8 bytes.
> * The int should be in the first 4, but our argument
> Index: arch/parisc/kernel/syscall_table.S
> ===================================================================
> RCS file: /home/cvs/parisc/linux-2.6/arch/parisc/kernel/syscall_table.S,v
> retrieving revision 1.2
> diff -u -p -r1.2 syscall_table.S
> --- arch/parisc/kernel/syscall_table.S 2 Nov 2003 04:40:50 -0000 1.2
> +++ arch/parisc/kernel/syscall_table.S 10 Nov 2003 23:18:46 -0000
> @@ -260,15 +260,15 @@
> ENTRY_COMP(recvmsg)
> ENTRY_SAME(semop) /* 185 */
> ENTRY_SAME(semget)
> - ENTRY_DIFF(semctl_broken)
> + ENTRY_DIFF(semctl)
> ENTRY_DIFF(msgsnd)
> ENTRY_DIFF(msgrcv)
> ENTRY_SAME(msgget) /* 190 */
> - ENTRY_SAME(msgctl_broken)
> + ENTRY_SAME(msgctl)
> ENTRY_SAME(shmat_wrapper)
> ENTRY_SAME(shmdt)
> ENTRY_SAME(shmget)
> - ENTRY_SAME(shmctl_broken) /* 195 */
> + ENTRY_SAME(shmctl) /* 195 */
> ENTRY_SAME(ni_syscall) /* streams1 */
> ENTRY_SAME(ni_syscall) /* streams2 */
> ENTRY_SAME(lstat64)
> Index: ipc/util.c
> ===================================================================
> RCS file: /home/cvs/parisc/linux-2.6/ipc/util.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 util.c
> --- ipc/util.c 8 Oct 2003 20:53:06 -0000 1.3
> +++ ipc/util.c 10 Nov 2003 23:19:41 -0000
> @@ -509,7 +509,7 @@ int ipc_checkid(struct ipc_ids* ids, str
> return 0;
> }
>
> -#if !defined(__ia64__) && !defined(__x86_64__)
> +#if !defined(__ia64__) && !defined(__x86_64__) && !defined(__hppa__)
>
> /**
> * ipc_parse_version - IPC call version
> Index: ipc/util.h
> ===================================================================
> RCS file: /home/cvs/parisc/linux-2.6/ipc/util.h,v
> retrieving revision 1.1
> diff -u -p -r1.1 util.h
> --- ipc/util.h 29 Jul 2003 17:02:19 -0000 1.1
> +++ ipc/util.h 10 Nov 2003 23:20:13 -0000
> @@ -56,7 +56,7 @@ int ipc_checkid(struct ipc_ids* ids, str
> void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out);
> void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out);
>
> -#if defined(__ia64__) || defined(__x86_64__)
> +#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__)
> /* On IA-64, we always use the "64-bit version" of the IPC structures. */
> # define ipc_parse_version(cmd) IPC_64
> #else
next prev parent reply other threads:[~2003-11-11 20:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-01 8:24 [parisc-linux] what's up with the ipc syscalls? Randolph Chung
2003-11-02 18:01 ` Thomas Bogendoerfer
2003-11-02 18:12 ` Randolph Chung
2003-11-02 21:42 ` Thomas Bogendoerfer
2003-11-02 21:55 ` Randolph Chung
2003-11-03 8:59 ` Thomas Bogendoerfer
2003-11-02 22:56 ` Carlos O'Donell
2003-11-03 8:56 ` Thomas Bogendoerfer
2003-11-03 21:41 ` Carlos O'Donell
2003-11-10 23:44 ` Thomas Bogendoerfer
2003-11-11 20:41 ` Joel Soete [this message]
2003-11-11 21:46 ` Carlos O'Donell
2003-11-12 15:32 ` Thomas Bogendoerfer
2003-11-14 0:35 ` Carlos O'Donell
2003-11-12 19:54 ` JSO
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FB1496B.1080504@tiscali.be \
--to=soete.joel@tiscali.be \
--cc=carlos@baldric.uwo.ca \
--cc=parisc-linux@lists.parisc-linux.org \
--cc=randolph@tausq.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.