aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>2000-07-21 07:43:25 +0000
committerGreg McGary <greg@mcgary.org>2000-07-21 07:43:25 +0000
commitdf0f2bf8cccb0d1c4fc829eac281ae8f0ecef734 (patch)
tree87acdf8e6dc9683089c6e79467adea259d105f9d /sysdeps/unix
parent137bca87e71138610a5b57e64b5e2619d6889853 (diff)
downloadglibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.tar
glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.tar.gz
glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.tar.bz2
glibc-df0f2bf8cccb0d1c4fc829eac281ae8f0ecef734.zip
* sysdeps/powerpc/bp-asm.h (DISCARD_BOUNDS): Rename from UNCHECK_BOUNDS.
* sysdeps/powerpc/bits/setjmp.h (JB_SIZE): New constant. * sysdeps/powerpc/elf/libc-start.c (__libc_start_main): Wrap bounds around argv & envp and each of their string members. * sysdeps/powerpc/elf/start.S: Designate BP symbols. * sysdeps/unix/sysv/linux/powerpc/brk.S: Wrap entry-point symbol in BP_SYM (). Discard bounds of address arg. * sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Discard bounds on address arg, add bounds to return value. 2000-07-21 Greg McGary <greg@mcgary.org> * sysdeps/powerpc/bp-asm.h (DISCARD_BOUNDS): Rename from UNCHECK_BOUNDS. * sysdeps/powerpc/bits/setjmp.h (JB_SIZE): New constant. * sysdeps/powerpc/elf/libc-start.c (__libc_start_main): Wrap bounds around argv & envp and each of their string members. * sysdeps/powerpc/elf/start.S: Designate BP symbols. * sysdeps/unix/sysv/linux/powerpc/brk.S: Wrap entry-point symbol in BP_SYM (). Discard bounds of address arg. * sysdeps/unix/sysv/linux/powerpc/clone.S: Likewise. * sysdeps/unix/sysv/linux/powerpc/mmap64.c (__mmap64): Discard bounds on address arg, add bounds to return value.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/brk.S10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/clone.S17
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/mmap64.c18
3 files changed, 30 insertions, 15 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/brk.S b/sysdeps/unix/sysv/linux/powerpc/brk.S
index 69dd0ee6e8..f3350e490c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/brk.S
@@ -20,10 +20,14 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
.comm __curbrk,4,4
.section ".text"
-ENTRY(__brk)
+ENTRY (BP_SYM (__brk))
+ DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em */
+
stwu r1,-16(r1)
stw r3,8(r1)
DO_CALL(SYS_ify(brk))
@@ -45,6 +49,6 @@ ENTRY(__brk)
blelr+
li r3,ENOMEM
b JUMPTARGET(__syscall_error)
-END (__brk)
+END (BP_SYM (__brk))
-weak_alias (__brk, brk)
+weak_alias (BP_SYM (__brk), BP_SYM (brk))
diff --git a/sysdeps/unix/sysv/linux/powerpc/clone.S b/sysdeps/unix/sysv/linux/powerpc/clone.S
index d5703d6bb8..ebcd82d5fe 100644
--- a/sysdeps/unix/sysv/linux/powerpc/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/clone.S
@@ -1,5 +1,5 @@
/* Wrapper around clone system call.
- Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,14 +20,21 @@
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
/* This is the only really unusual system call in PPC linux, but not
because of any weirdness in the system call itself; because of
all the freaky stuff we have to do to make the call useful. */
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+/* int [r3] clone(int (*fn)(void *arg) [r3], void *child_stack [r4],
+ int flags [r5], void *arg [r6]); */
+
+ENTRY (BP_SYM (__clone))
+ /* GKM FIXME: add bounds checks, where sensible. */
+ DISCARD_BOUNDS (r4)
+ DISCARD_BOUNDS (r6)
-ENTRY(__clone)
/* Check for child_stack == NULL || fn == NULL. */
cmpwi cr0,r4,0
cmpwi cr1,r3,0
@@ -82,6 +89,6 @@ L(parent):
L(badargs):
li r3,EINVAL
b JUMPTARGET(__syscall_error)
-END (__clone)
+END (BP_SYM (__clone))
-weak_alias (__clone, clone)
+weak_alias (BP_SYM (__clone), BP_SYM (clone))
diff --git a/sysdeps/unix/sysv/linux/powerpc/mmap64.c b/sysdeps/unix/sysv/linux/powerpc/mmap64.c
index e081b76b57..dacbbe3cf2 100644
--- a/sysdeps/unix/sysv/linux/powerpc/mmap64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/mmap64.c
@@ -19,18 +19,18 @@
#include <errno.h>
#include <unistd.h>
+#include <sys/mman.h>
#include <sysdep.h>
#include <sys/syscall.h>
-
-#include <sys/mman.h>
+#include <bp-checks.h>
#include <asm/page.h>
-
#include "kernel-features.h"
#ifdef __NR_mmap2
-extern __ptr_t __syscall_mmap2(__ptr_t, size_t, int, int, int, off_t);
+extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t,
+ int, int, int, off_t);
#ifndef __ASSUME_MMAP2_SYSCALL
static int have_no_mmap2;
#endif
@@ -50,9 +50,13 @@ __mmap64 (__ptr_t addr, size_t len, int prot, int flags, int fd, off64_t offset)
int saved_errno = errno;
#endif
/* This will be always 12, no matter what page size is. */
- __ptr_t result = INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags,
- fd, (off_t) (offset >> PAGE_SHIFT));
-
+ __ptr_t result;
+ __ptrvalue (result) = INLINE_SYSCALL (mmap2, 6, __ptrvalue (addr), len, prot,
+ flags, fd, (off_t) (offset >> PAGE_SHIFT));
+#if __BOUNDED_POINTERS__
+ __ptrlow (result) = __ptrvalue (result);
+ __ptrhigh (result) = __ptrvalue (result) + len;
+#endif
#ifndef __ASSUME_MMAP2_SYSCALL
if (result != (__ptr_t) -1 || errno != ENOSYS)
#endif