Commit 5d90cf6d authored by Johannes Berg's avatar Johannes Berg Committed by Richard Weinberger

um: further clean up user_syms

Make some cleanups, add and fix some comments and document
here that we shouldn't export (libc) symbols for "_user.c"
code, rather such should work like hostfs does now.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 6d708d1a
...@@ -3,35 +3,36 @@ ...@@ -3,35 +3,36 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/module.h> #include <linux/module.h>
/* Some of this are builtin function (some are not but could in the future), /*
* so I *must* declare good prototypes for them and then EXPORT them. * This file exports some critical string functions and compiler
* The kernel code uses the macro defined by include/linux/string.h, * built-in functions (where calls are emitted by the compiler
* so I undef macros; the userspace code does not include that and I * itself that we cannot avoid even in kernel code) to modules.
* add an EXPORT for the glibc one. *
* "_user.c" code that previously used exports here such as hostfs
* really should be considered part of the 'hypervisor' and define
* its own API boundary like hostfs does now; don't add exports to
* this file for such cases.
*/ */
#undef strlen
#undef strstr
#undef memcpy
#undef memset
extern size_t strlen(const char *);
extern void *memmove(void *, const void *, size_t);
extern void *memset(void *, int, size_t);
/* If it's not defined, the export is included in lib/string.c.*/ /* If it's not defined, the export is included in lib/string.c.*/
#ifdef __HAVE_ARCH_STRSTR #ifdef __HAVE_ARCH_STRSTR
#undef strstr
EXPORT_SYMBOL(strstr); EXPORT_SYMBOL(strstr);
#endif #endif
#ifndef __x86_64__ #ifndef __x86_64__
#undef memcpy
extern void *memcpy(void *, const void *, size_t); extern void *memcpy(void *, const void *, size_t);
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
extern void *memmove(void *, const void *, size_t);
EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(memmove);
#undef memset
extern void *memset(void *, int, size_t);
EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memset);
#endif #endif
#ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
/* needed for __access_ok() */
EXPORT_SYMBOL(vsyscall_ehdr); EXPORT_SYMBOL(vsyscall_ehdr);
EXPORT_SYMBOL(vsyscall_end); EXPORT_SYMBOL(vsyscall_end);
#endif #endif
...@@ -44,6 +45,6 @@ extern long __guard __attribute__((weak)); ...@@ -44,6 +45,6 @@ extern long __guard __attribute__((weak));
EXPORT_SYMBOL(__guard); EXPORT_SYMBOL(__guard);
#ifdef _FORTIFY_SOURCE #ifdef _FORTIFY_SOURCE
extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format); extern int __sprintf_chk(char *str, int flag, size_t len, const char *format);
EXPORT_SYMBOL(__sprintf_chk); EXPORT_SYMBOL(__sprintf_chk);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment