summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/__error.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-01-05 01:06:54 +0000
committerkib <kib@FreeBSD.org>2015-01-05 01:06:54 +0000
commit6b2710fe565e79b8b3f78ae193d1b68ab1a90bf2 (patch)
treeae1060e14ffc1f7203b630e4e1e7624871ab2ce0 /lib/libc/sys/__error.c
parentdd81221ce677c9962a2192db095b25098af8a656 (diff)
downloadFreeBSD-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.c14
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)
OpenPOWER on IntegriCloud