diff options
author | kib <kib@FreeBSD.org> | 2015-01-05 01:06:54 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-01-05 01:06:54 +0000 |
commit | 6b2710fe565e79b8b3f78ae193d1b68ab1a90bf2 (patch) | |
tree | ae1060e14ffc1f7203b630e4e1e7624871ab2ce0 /lib/libc/sys/__error.c | |
parent | dd81221ce677c9962a2192db095b25098af8a656 (diff) | |
download | FreeBSD-src-6b2710fe565e79b8b3f78ae193d1b68ab1a90bf2.zip FreeBSD-src-6b2710fe565e79b8b3f78ae193d1b68ab1a90bf2.tar.gz |
Avoid calling internal libc function through PLT or accessing data
though GOT, by staticizing and hiding. Add setter for
__error_selector to hide it as well.
Suggested and reviewed by: jilles
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'lib/libc/sys/__error.c')
-rw-r--r-- | lib/libc/sys/__error.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/sys/__error.c b/lib/libc/sys/__error.c index 329d124..28cc31d 100644 --- a/lib/libc/sys/__error.c +++ b/lib/libc/sys/__error.c @@ -32,13 +32,21 @@ __FBSDID("$FreeBSD$"); extern int errno; -int * +static int * __error_unthreaded(void) { - return(&errno); + + return (&errno); } -int *(*__error_selector)(void) = __error_unthreaded; +static int *(*__error_selector)(void) = __error_unthreaded; + +void +__set_error_selector(int *(*arg)(void)) +{ + + __error_selector = arg; +} int * __error(void) |