mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* sysdeps/gnu/bits/msq.h: Qualify kernel's
data structure pointers as __unbounded. * sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise. * sysdeps/generic/bp-semctl.h: New file. * sysdeps/unix/sysv/linux/msgctl.c: Qualify kernel's data structure pointers as __unbounded. Check bounds of syscall args. * sysdeps/unix/sysv/linux/msgrcv.c: Likewise. * sysdeps/unix/sysv/linux/msgsnd.c: Likewise. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/semop.c: Likewise. * sysdeps/unix/sysv/linux/shmat.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/shmdt.c: Likewise. * sysdeps/unix/sysv/linux/alpha/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/semctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/semctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c: Likewise. 2000-07-26 Greg McGary <greg@mcgary.org> * sysdeps/gnu/bits/msq.h: Qualify kernel's data structure pointers as __unbounded. * sysdeps/unix/sysv/linux/mips/bits/shm.h: Likewise. * sysdeps/generic/bp-semctl.h: New file. * sysdeps/unix/sysv/linux/msgctl.c: Qualify kernel's data structure pointers as __unbounded. Check bounds of syscall args. * sysdeps/unix/sysv/linux/msgrcv.c: Likewise. * sysdeps/unix/sysv/linux/msgsnd.c: Likewise. * sysdeps/unix/sysv/linux/semctl.c: Likewise. * sysdeps/unix/sysv/linux/semop.c: Likewise. * sysdeps/unix/sysv/linux/shmat.c: Likewise. * sysdeps/unix/sysv/linux/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/shmdt.c: Likewise. * sysdeps/unix/sysv/linux/alpha/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/semctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/semctl.c: Likewise. * sysdeps/unix/sysv/linux/i386/shmctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/semctl.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/shmctl.c: Likewise.
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <bp-checks.h>
|
||||
|
||||
/* Attach the shared memory segment associated with SHMID to the data
|
||||
segment of the calling process. SHMADDR and SHMFLG determine how
|
||||
@ -34,11 +35,23 @@ shmat (shmid, shmaddr, shmflg)
|
||||
const void *shmaddr;
|
||||
int shmflg;
|
||||
{
|
||||
long int retval;
|
||||
unsigned long raddr;
|
||||
void *__unbounded result;
|
||||
void *__unbounded raddr;
|
||||
|
||||
retval = INLINE_SYSCALL (ipc, 5, IPCOP_shmat, shmid, shmflg,
|
||||
(long int) &raddr, (void *) shmaddr);
|
||||
return ((unsigned long int) retval > -(unsigned long int) SHMLBA
|
||||
? (void *) retval : (void *) raddr);
|
||||
#if __BOUNDED_POINTERS__
|
||||
size_t length = ~0;
|
||||
struct shmid_ds shmds;
|
||||
/* It's unfortunate that we need to make another system call to get
|
||||
the shared memory segment length... */
|
||||
if (shmctl (shmid, ICP_STAT, &shmds) == 0)
|
||||
length = shmds.shm_segsz;
|
||||
#endif
|
||||
|
||||
result = (void *__unbounded) INLINE_SYSCALL (ipc, 5, IPCOP_shmat, shmid, shmflg,
|
||||
__ptrvalue (&raddr),
|
||||
__ptrvalue (shmaddr));
|
||||
if ((unsigned long) result <= -(unsigned long) SHMLBA)
|
||||
result = raddr;
|
||||
|
||||
return BOUNDED_N (result, length);
|
||||
}
|
||||
|
Reference in New Issue
Block a user