forked from CTSRD-CHERI/cheribsd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More fixes for RTLD depedency reduction
- Loading branch information
1 parent
2524566
commit 40d6ef0
Showing
13 changed files
with
93 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/*- | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
* | ||
* Copyright 2018 Alex Richadson <[email protected]> | ||
* Copyright 2019 Alex Richadson <[email protected]> | ||
* All rights reserved. | ||
* | ||
* This software was developed by SRI International and the University of | ||
|
@@ -33,34 +33,6 @@ | |
#ifndef _RTLD_LIBC_PRIVATE_H_ | ||
#define _RTLD_LIBC_PRIVATE_H_ | ||
|
||
#include <sys/cdefs.h> | ||
#include <sys/types.h> | ||
#include <sys/fcntl.h> | ||
|
||
#define __isthreaded syntax error | ||
|
||
int __sys_fcntl(int, int, __intptr_t); | ||
int __sys_close(int); | ||
int __sys_openat(int, const char *, int, int); | ||
|
||
int __sys_sigprocmask(int, const sigset_t *, sigset_t *); | ||
__ssize_t __sys_pread(int, void *, __size_t, __off_t); | ||
__ssize_t __sys_read(int, void *, __size_t); | ||
__ssize_t __sys_write(int, const void *, __size_t); | ||
|
||
/* | ||
* Don't pull in any of the libc wrappers, we want to use the system call | ||
* directly inside RTLD. | ||
*/ | ||
#define close(fd) __sys_close(fd) | ||
#define read(fd, buf, nbytes) __sys_read(fd, buf, nbytes) | ||
#define write(fd, buf, nbytes) __sys_write(fd, buf, nbytes) | ||
#define pread(fd, buf, nbytes, offset) __sys_pread(fd, buf, nbytes, offset) | ||
#define sigprocmask(how, set, oset) __sys_sigprocmask(how, set, oset) | ||
#define strerror(errno) rtld_strerror(errno) | ||
/* | ||
* TODO: use a macro for open with mandatory mode | ||
* #define open(path, flags, mode) __sys_openat(AT_FDCWD, path, flags, mode) | ||
*/ | ||
#include "rtld_avoid_libc_deps.h" | ||
|
||
#endif /* _RTLD_LIBC_PRIVATE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#define fcntl _fcntl | ||
#define open _open | ||
#define openat _openat | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/*- | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
* | ||
* Copyright 2019 Alex Richadson <[email protected]> | ||
* All rights reserved. | ||
* | ||
* This software was developed by SRI International and the University of | ||
* Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 | ||
* ("CTSRD"), as part of the DARPA CRASH research programme. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
*/ | ||
#ifndef _RTLD_AVOID_LIBC_DEPS_H_ | ||
#define _RTLD_AVOID_LIBC_DEPS_H_ | ||
|
||
#include <sys/cdefs.h> | ||
#include <sys/types.h> | ||
#include <sys/fcntl.h> | ||
|
||
#define __isthreaded syntax error | ||
|
||
void __sys_exit(int) __dead2; | ||
int __sys_fcntl(int, int, __intptr_t); | ||
int __sys_close(int); | ||
int __sys_openat(int, const char *, int, int); | ||
|
||
int __sys_sigprocmask(int, const sigset_t *, sigset_t *); | ||
__ssize_t __sys_pread(int, void *, __size_t, __off_t); | ||
__ssize_t __sys_read(int, void *, __size_t); | ||
__ssize_t __sys_write(int, const void *, __size_t); | ||
|
||
/* | ||
* Don't pull in any of the libc wrappers, we want to use the system call | ||
* directly inside RTLD. | ||
*/ | ||
#define _exit(status) __sys_exit(status) | ||
#define close(fd) __sys_close(fd) | ||
#define _close(fd) __sys_close(fd) | ||
#define fcntl(fd, cmd, arg) __sys_fcntl(fd, cmd, arg) | ||
#define _fcntl(fd, cmd, arg) __sys_fcntl(fd, cmd, arg) | ||
#define read(fd, buf, nbytes) __sys_read(fd, buf, nbytes) | ||
#define write(fd, buf, nbytes) __sys_write(fd, buf, nbytes) | ||
#define pread(fd, buf, nbytes, offset) __sys_pread(fd, buf, nbytes, offset) | ||
#define sigprocmask(how, set, oset) __sys_sigprocmask(how, set, oset) | ||
#define strerror(errno) rtld_strerror(errno) | ||
/* | ||
* TODO: use a macro for open with mandatory mode | ||
* #define open(path, flags, mode) __sys_openat(AT_FDCWD, path, flags, mode) | ||
*/ | ||
|
||
#endif /* _RTLD_AVOID_LIBC_DEPS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ | |
#undef close | ||
#undef fstatfs | ||
#undef getdirentries | ||
|
||
#include "rtld_avoid_libc_deps.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters