Linux Audio

Check our new training course

Loading...
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0
 2#define __NO_FORTIFY
 3#include <linux/types.h>
 4#include <linux/module.h>
 5
 6/*
 7 * This file exports some critical string functions and compiler
 8 * built-in functions (where calls are emitted by the compiler
 9 * itself that we cannot avoid even in kernel code) to modules.
10 *
11 * "_user.c" code that previously used exports here such as hostfs
12 * really should be considered part of the 'hypervisor' and define
13 * its own API boundary like hostfs does now; don't add exports to
14 * this file for such cases.
15 */
16
 
 
 
 
 
 
 
 
 
 
17/* If it's not defined, the export is included in lib/string.c.*/
18#ifdef __HAVE_ARCH_STRSTR
19#undef strstr
20EXPORT_SYMBOL(strstr);
21#endif
22
23#ifndef __x86_64__
24#undef memcpy
25extern void *memcpy(void *, const void *, size_t);
26EXPORT_SYMBOL(memcpy);
27extern void *memmove(void *, const void *, size_t);
28EXPORT_SYMBOL(memmove);
29#undef memset
30extern void *memset(void *, int, size_t);
31EXPORT_SYMBOL(memset);
32#endif
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34#ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
35/* needed for __access_ok() */
36EXPORT_SYMBOL(vsyscall_ehdr);
37EXPORT_SYMBOL(vsyscall_end);
38#endif
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40#ifdef _FORTIFY_SOURCE
41extern int __sprintf_chk(char *str, int flag, size_t len, const char *format);
42EXPORT_SYMBOL(__sprintf_chk);
43#endif
v6.2
  1// SPDX-License-Identifier: GPL-2.0
  2#define __NO_FORTIFY
  3#include <linux/types.h>
  4#include <linux/module.h>
  5
  6/* Some of this are builtin function (some are not but could in the future),
  7 * so I *must* declare good prototypes for them and then EXPORT them.
  8 * The kernel code uses the macro defined by include/linux/string.h,
  9 * so I undef macros; the userspace code does not include that and I
 10 * add an EXPORT for the glibc one.
 
 
 
 
 11 */
 12
 13#undef strlen
 14#undef strstr
 15#undef memcpy
 16#undef memset
 17
 18extern size_t strlen(const char *);
 19extern void *memmove(void *, const void *, size_t);
 20extern void *memset(void *, int, size_t);
 21extern int printf(const char *, ...);
 22
 23/* If it's not defined, the export is included in lib/string.c.*/
 24#ifdef __HAVE_ARCH_STRSTR
 
 25EXPORT_SYMBOL(strstr);
 26#endif
 27
 28#ifndef __x86_64__
 
 29extern void *memcpy(void *, const void *, size_t);
 30EXPORT_SYMBOL(memcpy);
 
 31EXPORT_SYMBOL(memmove);
 
 
 32EXPORT_SYMBOL(memset);
 33#endif
 34
 35EXPORT_SYMBOL(printf);
 36
 37/* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms.
 38 * However, the modules will use the CRC defined *here*, no matter if it is
 39 * good; so the versions of these symbols will always match
 40 */
 41#define EXPORT_SYMBOL_PROTO(sym)       \
 42	int sym(void);                  \
 43	EXPORT_SYMBOL(sym);
 44
 45extern void readdir64(void) __attribute__((weak));
 46EXPORT_SYMBOL(readdir64);
 47extern void truncate64(void) __attribute__((weak));
 48EXPORT_SYMBOL(truncate64);
 49
 50#ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA
 
 51EXPORT_SYMBOL(vsyscall_ehdr);
 52EXPORT_SYMBOL(vsyscall_end);
 53#endif
 54
 55EXPORT_SYMBOL_PROTO(__errno_location);
 56
 57EXPORT_SYMBOL_PROTO(access);
 58EXPORT_SYMBOL_PROTO(open);
 59EXPORT_SYMBOL_PROTO(open64);
 60EXPORT_SYMBOL_PROTO(close);
 61EXPORT_SYMBOL_PROTO(read);
 62EXPORT_SYMBOL_PROTO(write);
 63EXPORT_SYMBOL_PROTO(dup2);
 64EXPORT_SYMBOL_PROTO(__xstat);
 65EXPORT_SYMBOL_PROTO(__lxstat);
 66EXPORT_SYMBOL_PROTO(__lxstat64);
 67EXPORT_SYMBOL_PROTO(__fxstat64);
 68EXPORT_SYMBOL_PROTO(lseek);
 69EXPORT_SYMBOL_PROTO(lseek64);
 70EXPORT_SYMBOL_PROTO(chown);
 71EXPORT_SYMBOL_PROTO(fchown);
 72EXPORT_SYMBOL_PROTO(truncate);
 73EXPORT_SYMBOL_PROTO(ftruncate64);
 74EXPORT_SYMBOL_PROTO(utime);
 75EXPORT_SYMBOL_PROTO(utimes);
 76EXPORT_SYMBOL_PROTO(futimes);
 77EXPORT_SYMBOL_PROTO(chmod);
 78EXPORT_SYMBOL_PROTO(fchmod);
 79EXPORT_SYMBOL_PROTO(rename);
 80EXPORT_SYMBOL_PROTO(__xmknod);
 81
 82EXPORT_SYMBOL_PROTO(symlink);
 83EXPORT_SYMBOL_PROTO(link);
 84EXPORT_SYMBOL_PROTO(unlink);
 85EXPORT_SYMBOL_PROTO(readlink);
 86
 87EXPORT_SYMBOL_PROTO(mkdir);
 88EXPORT_SYMBOL_PROTO(rmdir);
 89EXPORT_SYMBOL_PROTO(opendir);
 90EXPORT_SYMBOL_PROTO(readdir);
 91EXPORT_SYMBOL_PROTO(closedir);
 92EXPORT_SYMBOL_PROTO(seekdir);
 93EXPORT_SYMBOL_PROTO(telldir);
 94
 95EXPORT_SYMBOL_PROTO(ioctl);
 96
 97EXPORT_SYMBOL_PROTO(pread64);
 98EXPORT_SYMBOL_PROTO(pwrite64);
 99
100EXPORT_SYMBOL_PROTO(statfs);
101EXPORT_SYMBOL_PROTO(statfs64);
102
103EXPORT_SYMBOL_PROTO(getuid);
104
105EXPORT_SYMBOL_PROTO(fsync);
106EXPORT_SYMBOL_PROTO(fdatasync);
107
108EXPORT_SYMBOL_PROTO(lstat64);
109EXPORT_SYMBOL_PROTO(fstat64);
110EXPORT_SYMBOL_PROTO(mknod);
111
112/* Export symbols used by GCC for the stack protector. */
113extern void __stack_smash_handler(void *) __attribute__((weak));
114EXPORT_SYMBOL(__stack_smash_handler);
115
116extern long __guard __attribute__((weak));
117EXPORT_SYMBOL(__guard);
118
119#ifdef _FORTIFY_SOURCE
120extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format);
121EXPORT_SYMBOL(__sprintf_chk);
122#endif