aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile2
-rw-r--r--lib/execve.c23
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
index ddf3e676e1f4..4d752be0edc0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -35,6 +35,8 @@ ifneq ($(CONFIG_HAVE_DEC_LOCK),y)
35 lib-y += dec_and_lock.o 35 lib-y += dec_and_lock.o
36endif 36endif
37 37
38lib-y += execve.o
39
38obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o 40obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
39obj-$(CONFIG_CRC16) += crc16.o 41obj-$(CONFIG_CRC16) += crc16.o
40obj-$(CONFIG_CRC32) += crc32.o 42obj-$(CONFIG_CRC32) += crc32.o
diff --git a/lib/execve.c b/lib/execve.c
new file mode 100644
index 000000000000..2667ebc15045
--- /dev/null
+++ b/lib/execve.c
@@ -0,0 +1,23 @@
1#include <asm/bug.h>
2#include <asm/uaccess.h>
3
4#define __KERNEL_SYSCALLS__
5static int errno __attribute__((unused));
6#include <asm/unistd.h>
7
8#ifdef _syscall3
9int kernel_execve (const char *filename, char *const argv[], char *const envp[])
10 __attribute__((__weak__));
11int kernel_execve (const char *filename, char *const argv[], char *const envp[])
12{
13 mm_segment_t fs = get_fs();
14 int ret;
15
16 WARN_ON(segment_eq(fs, USER_DS));
17 ret = execve(filename, (char **)argv, (char **)envp);
18 if (ret)
19 ret = -errno;
20
21 return ret;
22}
23#endif