From 7fe8fbec77343dc12cd90833d80eb7f721248bc7 Mon Sep 17 00:00:00 2001 From: kib Date: Sun, 18 Jan 2015 11:54:20 +0000 Subject: Fix known issues which blow up the process after dlopen("libthr.so") (or loading a dso linked to libthr.so into process which was not linked against threading library). MFC r276630: Remove interposing, fix malloc, reinstall signal handlers wrappers on libthr load. MFC r276681: Avoid calling internal libc function through PLT or accessing data though GOT. MFC r277032: Reduce the size of the interposing table and amount of cancellation-handling code in the libthr. MFC note: r276646 ("do not erronously export 'openat' symbol from rtld") is not applicable to stable/10 yet, since PATHFDS support was not merged. --- lib/libc/compat-43/creat.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/libc/compat-43/creat.c') diff --git a/lib/libc/compat-43/creat.c b/lib/libc/compat-43/creat.c index fc3be06..4545482 100644 --- a/lib/libc/compat-43/creat.c +++ b/lib/libc/compat-43/creat.c @@ -36,11 +36,18 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include "un-namespace.h" +#include "libc_private.h" +__weak_reference(__creat, creat); +__weak_reference(__creat, _creat); + +#pragma weak creat int __creat(const char *path, mode_t mode) { - return(_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)); + + return (((int (*)(int, const char *, int, ...)) + __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, O_WRONLY | + O_CREAT | O_TRUNC, mode)); } -__weak_reference(__creat, creat); -__weak_reference(__creat, _creat); + -- cgit v1.1