mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* 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.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2000-07-20 Ulrich Drepper <drepper@redhat.com>
|
2000-07-20 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* elf/Makefile (tests): Add filter. Add rules to generate filter.
|
* elf/Makefile (tests): Add filter. Add rules to generate filter.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
/* Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -34,6 +34,7 @@
|
|||||||
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
|
# define JB_GPRS 3 /* GPRs 14 through 31 are saved, 18 in total */
|
||||||
# define JB_CR 21 /* Condition code registers. */
|
# define JB_CR 21 /* Condition code registers. */
|
||||||
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
|
# define JB_FPRS 22 /* FPRs 14 through 31 are saved, 18*2 words total */
|
||||||
|
# define JB_SIZE (58*4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _ASM
|
#ifndef _ASM
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
/* Don't check bounds, just convert the BP register to its simple
|
/* Don't check bounds, just convert the BP register to its simple
|
||||||
pointer value. */
|
pointer value. */
|
||||||
|
|
||||||
# define UNCHECK_BOUNDS(rBP) \
|
# define DISCARD_BOUNDS(rBP) \
|
||||||
lwz rBP, oVALUE(rBP)
|
lwz rBP, oVALUE(rBP)
|
||||||
|
|
||||||
/* Check low bound, with the side effect that the BP register is converted
|
/* Check low bound, with the side effect that the BP register is converted
|
||||||
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
# define UNCHECK_BOUNDS(rBP)
|
# define DISCARD_BOUNDS(rBP)
|
||||||
# define CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH)
|
# define CHECK_BOUNDS_LOW(rBP, rLOW, rHIGH)
|
||||||
# define CHECK_BOUNDS_HIGH(rVALUE, rHIGH, TWLcc)
|
# define CHECK_BOUNDS_HIGH(rVALUE, rHIGH, TWLcc)
|
||||||
# define CHECK_BOUNDS_HIGH_RTN(rVALUE, rHIGH, TWLcc)
|
# define CHECK_BOUNDS_HIGH_RTN(rVALUE, rHIGH, TWLcc)
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ldsodefs.h>
|
#include <ldsodefs.h>
|
||||||
|
#include <bp-start.h>
|
||||||
|
#include <bp-sym.h>
|
||||||
|
|
||||||
extern void __libc_init_first (int argc, char **argv, char **envp);
|
extern void __libc_init_first (int argc, char **argv, char **envp);
|
||||||
|
|
||||||
@ -29,18 +31,27 @@ extern void *__libc_stack_end;
|
|||||||
|
|
||||||
struct startup_info
|
struct startup_info
|
||||||
{
|
{
|
||||||
void *sda_base;
|
void *__unbounded sda_base;
|
||||||
int (*main) (int, char **, char **, void *);
|
int (*main) (int, char **, char **, void *);
|
||||||
int (*init) (int, char **, char **, void *);
|
int (*init) (int, char **, char **, void *);
|
||||||
void (*fini) (void);
|
void (*fini) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
__libc_start_main (int argc, char **argv, char **envp,
|
/* GKM FIXME: GCC: this should get __BP_ prefix by virtue of the
|
||||||
void *auxvec, void (*rtld_fini) (void),
|
BPs in the arglist of startup_info.main and startup_info.init. */
|
||||||
struct startup_info *stinfo,
|
BP_SYM (__libc_start_main) (int argc, char *__unbounded *__unbounded ubp_av,
|
||||||
char **stack_on_entry)
|
char *__unbounded *__unbounded ubp_ev,
|
||||||
|
void *__unbounded auxvec, void (*rtld_fini) (void),
|
||||||
|
struct startup_info *__unbounded stinfo,
|
||||||
|
char *__unbounded *__unbounded stack_on_entry)
|
||||||
{
|
{
|
||||||
|
#if __BOUNDED_POINTERS__
|
||||||
|
char **argv;
|
||||||
|
#else
|
||||||
|
# define argv ubp_av
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SHARED
|
#ifndef SHARED
|
||||||
/* The next variable is only here to work around a bug in gcc <= 2.7.2.2.
|
/* The next variable is only here to work around a bug in gcc <= 2.7.2.2.
|
||||||
If the address would be taken inside the expression the optimizer
|
If the address would be taken inside the expression the optimizer
|
||||||
@ -58,23 +69,22 @@ __libc_start_main (int argc, char **argv, char **envp,
|
|||||||
/* ...in which case, we have argc as the top thing on the
|
/* ...in which case, we have argc as the top thing on the
|
||||||
stack, followed by argv (NULL-terminated), envp (likewise),
|
stack, followed by argv (NULL-terminated), envp (likewise),
|
||||||
and the auxilary vector. */
|
and the auxilary vector. */
|
||||||
argc = *(int *) stack_on_entry;
|
argc = *(int *__unbounded) stack_on_entry;
|
||||||
argv = stack_on_entry + 1;
|
ubp_av = stack_on_entry + 1;
|
||||||
envp = argv + argc + 1;
|
ubp_ev = ubp_av + argc + 1;
|
||||||
auxvec = envp;
|
auxvec = ubp_ev;
|
||||||
while (*(char **) auxvec != NULL)
|
while (*(char *__unbounded *__unbounded) auxvec != NULL)
|
||||||
++auxvec;
|
++auxvec;
|
||||||
++auxvec;
|
++auxvec;
|
||||||
rtld_fini = NULL;
|
rtld_fini = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INIT_ARGV_and_ENVIRON;
|
||||||
|
|
||||||
/* Store something that has some relationship to the end of the
|
/* Store something that has some relationship to the end of the
|
||||||
stack, for backtraces. This variable should be thread-specific. */
|
stack, for backtraces. This variable should be thread-specific. */
|
||||||
__libc_stack_end = stack_on_entry + 4;
|
__libc_stack_end = stack_on_entry + 4;
|
||||||
|
|
||||||
/* Set the global _environ variable correctly. */
|
|
||||||
__environ = envp;
|
|
||||||
|
|
||||||
/* Register the destructor of the dynamic linker if there is any. */
|
/* Register the destructor of the dynamic linker if there is any. */
|
||||||
if (rtld_fini != NULL)
|
if (rtld_fini != NULL)
|
||||||
atexit (rtld_fini);
|
atexit (rtld_fini);
|
||||||
@ -84,7 +94,7 @@ __libc_start_main (int argc, char **argv, char **envp,
|
|||||||
if (_dl_debug_impcalls)
|
if (_dl_debug_impcalls)
|
||||||
_dl_debug_message (1, "\ninitialize libc\n\n", NULL);
|
_dl_debug_message (1, "\ninitialize libc\n\n", NULL);
|
||||||
#endif
|
#endif
|
||||||
__libc_init_first (argc, argv, envp);
|
__libc_init_first (argc, argv, __environ);
|
||||||
|
|
||||||
/* Register the destructor of the program, if any. */
|
/* Register the destructor of the program, if any. */
|
||||||
if (stinfo->fini)
|
if (stinfo->fini)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Startup code for programs linked with GNU libc.
|
/* Startup code for programs linked with GNU libc.
|
||||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -27,6 +27,7 @@
|
|||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
|
#include "bp-sym.h"
|
||||||
|
|
||||||
/* These are the various addresses we require. */
|
/* These are the various addresses we require. */
|
||||||
.section ".rodata"
|
.section ".rodata"
|
||||||
@ -35,7 +36,7 @@
|
|||||||
weak_extern(_fini)
|
weak_extern(_fini)
|
||||||
L(start_addresses):
|
L(start_addresses):
|
||||||
.long _SDA_BASE_
|
.long _SDA_BASE_
|
||||||
.long JUMPTARGET(main)
|
.long JUMPTARGET(BP_SYM (main))
|
||||||
.long JUMPTARGET(_init)
|
.long JUMPTARGET(_init)
|
||||||
.long JUMPTARGET(_fini)
|
.long JUMPTARGET(_fini)
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
@ -55,7 +56,7 @@ ENTRY(_start)
|
|||||||
lis r8,L(start_addresses)@ha
|
lis r8,L(start_addresses)@ha
|
||||||
lwzu r13,L(start_addresses)@l(r8)
|
lwzu r13,L(start_addresses)@l(r8)
|
||||||
/* and continue in libc-start, in glibc. */
|
/* and continue in libc-start, in glibc. */
|
||||||
b JUMPTARGET(__libc_start_main)
|
b JUMPTARGET(BP_SYM (__libc_start_main))
|
||||||
END(_start)
|
END(_start)
|
||||||
|
|
||||||
/* Define a symbol for the first piece of initialized data. */
|
/* Define a symbol for the first piece of initialized data. */
|
||||||
|
@ -20,10 +20,14 @@
|
|||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H 1
|
#define _ERRNO_H 1
|
||||||
#include <bits/errno.h>
|
#include <bits/errno.h>
|
||||||
|
#include <bp-sym.h>
|
||||||
|
#include <bp-asm.h>
|
||||||
|
|
||||||
.comm __curbrk,4,4
|
.comm __curbrk,4,4
|
||||||
.section ".text"
|
.section ".text"
|
||||||
ENTRY(__brk)
|
ENTRY (BP_SYM (__brk))
|
||||||
|
DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em */
|
||||||
|
|
||||||
stwu r1,-16(r1)
|
stwu r1,-16(r1)
|
||||||
stw r3,8(r1)
|
stw r3,8(r1)
|
||||||
DO_CALL(SYS_ify(brk))
|
DO_CALL(SYS_ify(brk))
|
||||||
@ -45,6 +49,6 @@ ENTRY(__brk)
|
|||||||
blelr+
|
blelr+
|
||||||
li r3,ENOMEM
|
li r3,ENOMEM
|
||||||
b JUMPTARGET(__syscall_error)
|
b JUMPTARGET(__syscall_error)
|
||||||
END (__brk)
|
END (BP_SYM (__brk))
|
||||||
|
|
||||||
weak_alias (__brk, brk)
|
weak_alias (BP_SYM (__brk), BP_SYM (brk))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Wrapper around clone system call.
|
/* 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.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -20,14 +20,21 @@
|
|||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H 1
|
#define _ERRNO_H 1
|
||||||
#include <bits/errno.h>
|
#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
|
/* This is the only really unusual system call in PPC linux, but not
|
||||||
because of any weirdness in the system call itself; because of
|
because of any weirdness in the system call itself; because of
|
||||||
all the freaky stuff we have to do to make the call useful. */
|
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. */
|
/* Check for child_stack == NULL || fn == NULL. */
|
||||||
cmpwi cr0,r4,0
|
cmpwi cr0,r4,0
|
||||||
cmpwi cr1,r3,0
|
cmpwi cr1,r3,0
|
||||||
@ -82,6 +89,6 @@ L(parent):
|
|||||||
L(badargs):
|
L(badargs):
|
||||||
li r3,EINVAL
|
li r3,EINVAL
|
||||||
b JUMPTARGET(__syscall_error)
|
b JUMPTARGET(__syscall_error)
|
||||||
END (__clone)
|
END (BP_SYM (__clone))
|
||||||
|
|
||||||
weak_alias (__clone, clone)
|
weak_alias (BP_SYM (__clone), BP_SYM (clone))
|
||||||
|
@ -19,18 +19,18 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <bp-checks.h>
|
||||||
#include <sys/mman.h>
|
|
||||||
|
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
|
||||||
#include "kernel-features.h"
|
#include "kernel-features.h"
|
||||||
|
|
||||||
#ifdef __NR_mmap2
|
#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
|
#ifndef __ASSUME_MMAP2_SYSCALL
|
||||||
static int have_no_mmap2;
|
static int have_no_mmap2;
|
||||||
#endif
|
#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;
|
int saved_errno = errno;
|
||||||
#endif
|
#endif
|
||||||
/* This will be always 12, no matter what page size is. */
|
/* This will be always 12, no matter what page size is. */
|
||||||
__ptr_t result = INLINE_SYSCALL (mmap2, 6, addr, len, prot, flags,
|
__ptr_t result;
|
||||||
fd, (off_t) (offset >> PAGE_SHIFT));
|
__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
|
#ifndef __ASSUME_MMAP2_SYSCALL
|
||||||
if (result != (__ptr_t) -1 || errno != ENOSYS)
|
if (result != (__ptr_t) -1 || errno != ENOSYS)
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user