1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2*ba38961aSKees Cook #define __NO_FORTIFY 337185b33SAl Viro #include <linux/types.h> 437185b33SAl Viro #include <linux/module.h> 51da177e4SLinus Torvalds 61da177e4SLinus Torvalds /* Some of this are builtin function (some are not but could in the future), 71da177e4SLinus Torvalds * so I *must* declare good prototypes for them and then EXPORT them. 81da177e4SLinus Torvalds * The kernel code uses the macro defined by include/linux/string.h, 91da177e4SLinus Torvalds * so I undef macros; the userspace code does not include that and I 10e8234483SJeff Dike * add an EXPORT for the glibc one. 11e8234483SJeff Dike */ 121da177e4SLinus Torvalds 131da177e4SLinus Torvalds #undef strlen 141da177e4SLinus Torvalds #undef strstr 151da177e4SLinus Torvalds #undef memcpy 161da177e4SLinus Torvalds #undef memset 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds extern size_t strlen(const char *); 191da177e4SLinus Torvalds extern void *memmove(void *, const void *, size_t); 201da177e4SLinus Torvalds extern void *memset(void *, int, size_t); 211da177e4SLinus Torvalds extern int printf(const char *, ...); 221da177e4SLinus Torvalds 231a65f493SJeff Dike /* If it's not defined, the export is included in lib/string.c.*/ 247c45ad16SPaolo 'Blaisorblade' Giarrusso #ifdef __HAVE_ARCH_STRSTR 257c45ad16SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(strstr); 267c45ad16SPaolo 'Blaisorblade' Giarrusso #endif 277c45ad16SPaolo 'Blaisorblade' Giarrusso 2800699e84Sakpm@linux-foundation.org #ifndef __x86_64__ 2900699e84Sakpm@linux-foundation.org extern void *memcpy(void *, const void *, size_t); 301da177e4SLinus Torvalds EXPORT_SYMBOL(memcpy); 311da177e4SLinus Torvalds EXPORT_SYMBOL(memmove); 321da177e4SLinus Torvalds EXPORT_SYMBOL(memset); 335b301409SPatricia Alfonso #endif 345b301409SPatricia Alfonso 351da177e4SLinus Torvalds EXPORT_SYMBOL(printf); 361da177e4SLinus Torvalds 371da177e4SLinus Torvalds /* Here, instead, I can provide a fake prototype. Yes, someone cares: genksyms. 381da177e4SLinus Torvalds * However, the modules will use the CRC defined *here*, no matter if it is 391da177e4SLinus Torvalds * good; so the versions of these symbols will always match 401da177e4SLinus Torvalds */ 411da177e4SLinus Torvalds #define EXPORT_SYMBOL_PROTO(sym) \ 421da177e4SLinus Torvalds int sym(void); \ 431da177e4SLinus Torvalds EXPORT_SYMBOL(sym); 441da177e4SLinus Torvalds 4574433c0fSPaolo 'Blaisorblade' Giarrusso extern void readdir64(void) __attribute__((weak)); 4674433c0fSPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(readdir64); 4774433c0fSPaolo 'Blaisorblade' Giarrusso extern void truncate64(void) __attribute__((weak)); 4874433c0fSPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(truncate64); 4974433c0fSPaolo 'Blaisorblade' Giarrusso 50c6b17bbdSAl Viro #ifdef CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA 511da177e4SLinus Torvalds EXPORT_SYMBOL(vsyscall_ehdr); 521da177e4SLinus Torvalds EXPORT_SYMBOL(vsyscall_end); 531da177e4SLinus Torvalds #endif 541da177e4SLinus Torvalds 551da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__errno_location); 561da177e4SLinus Torvalds 571da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(access); 581da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(open); 591da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(open64); 601da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(close); 611da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(read); 621da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(write); 631da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(dup2); 641da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__xstat); 651da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__lxstat); 661da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__lxstat64); 67e8234483SJeff Dike EXPORT_SYMBOL_PROTO(__fxstat64); 681da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(lseek); 691da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(lseek64); 701da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(chown); 71e8234483SJeff Dike EXPORT_SYMBOL_PROTO(fchown); 721da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(truncate); 73e8234483SJeff Dike EXPORT_SYMBOL_PROTO(ftruncate64); 741da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(utime); 75e8234483SJeff Dike EXPORT_SYMBOL_PROTO(utimes); 76e8234483SJeff Dike EXPORT_SYMBOL_PROTO(futimes); 771da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(chmod); 78e8234483SJeff Dike EXPORT_SYMBOL_PROTO(fchmod); 791da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(rename); 801da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(__xmknod); 811da177e4SLinus Torvalds 821da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(symlink); 831da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(link); 841da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(unlink); 851da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(readlink); 861da177e4SLinus Torvalds 871da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(mkdir); 881da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(rmdir); 891da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(opendir); 901da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(readdir); 911da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(closedir); 921da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(seekdir); 931da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(telldir); 941da177e4SLinus Torvalds 951da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(ioctl); 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(pread64); 981da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(pwrite64); 991da177e4SLinus Torvalds 1001da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(statfs); 1011da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(statfs64); 1021da177e4SLinus Torvalds 1031da177e4SLinus Torvalds EXPORT_SYMBOL_PROTO(getuid); 1041da177e4SLinus Torvalds 105a2d76bd8SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL_PROTO(fsync); 106a2d76bd8SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL_PROTO(fdatasync); 107a2d76bd8SPaolo 'Blaisorblade' Giarrusso 108005a59ecSAl Viro EXPORT_SYMBOL_PROTO(lstat64); 109005a59ecSAl Viro EXPORT_SYMBOL_PROTO(fstat64); 110005a59ecSAl Viro EXPORT_SYMBOL_PROTO(mknod); 111005a59ecSAl Viro 112cead61a6SPaolo 'Blaisorblade' Giarrusso /* Export symbols used by GCC for the stack protector. */ 113cead61a6SPaolo 'Blaisorblade' Giarrusso extern void __stack_smash_handler(void *) __attribute__((weak)); 114cead61a6SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(__stack_smash_handler); 115cead61a6SPaolo 'Blaisorblade' Giarrusso 116cead61a6SPaolo 'Blaisorblade' Giarrusso extern long __guard __attribute__((weak)); 117cead61a6SPaolo 'Blaisorblade' Giarrusso EXPORT_SYMBOL(__guard); 118f956b3e4SRichard Weinberger 119f956b3e4SRichard Weinberger #ifdef _FORTIFY_SOURCE 120f956b3e4SRichard Weinberger extern int __sprintf_chk(char *str, int flag, size_t strlen, const char *format); 121f956b3e4SRichard Weinberger EXPORT_SYMBOL(__sprintf_chk); 122f956b3e4SRichard Weinberger #endif 123