user_syms.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0
  2. #define __NO_FORTIFY
  3. #include <linux/types.h>
  4. #include <linux/module.h>
  5. /*
  6. * This file exports some critical string functions and compiler
  7. * built-in functions (where calls are emitted by the compiler
  8. * itself that we cannot avoid even in kernel code) to modules.
  9. *
  10. * "_user.c" code that previously used exports here such as hostfs
  11. * really should be considered part of the 'hypervisor' and define
  12. * its own API boundary like hostfs does now; don't add exports to
  13. * this file for such cases.
  14. */
  15. /* If it's not defined, the export is included in lib/string.c.*/
  16. #ifdef __HAVE_ARCH_STRSTR
  17. #undef strstr
  18. EXPORT_SYMBOL(strstr);
  19. #endif
  20. #ifndef __x86_64__
  21. #undef memcpy
  22. extern void *memcpy(void *, const void *, size_t);
  23. EXPORT_SYMBOL(memcpy);
  24. extern void *memmove(void *, const void *, size_t);
  25. EXPORT_SYMBOL(memmove);
  26. #undef memset
  27. extern void *memset(void *, int, size_t);
  28. EXPORT_SYMBOL(memset);
  29. #endif
  30. #ifdef _FORTIFY_SOURCE
  31. extern int __sprintf_chk(char *str, int flag, size_t len, const char *format);
  32. EXPORT_SYMBOL(__sprintf_chk);
  33. #endif