Skip to content

Commit f089568

Browse files
rhvgoyaltorvalds
authored andcommitted
kexec: new syscall kexec_file_load() declaration
This is the new syscall kexec_file_load() declaration/interface. I have reserved the syscall number only for x86_64 so far. Other architectures (including i386) can reserve syscall number when they enable the support for this new syscall. Signed-off-by: Vivek Goyal <[email protected]> Cc: Michael Kerrisk <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Yinghai Lu <[email protected]> Cc: Eric Biederman <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Matthew Garrett <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Dave Young <[email protected]> Cc: WANG Chao <[email protected]> Cc: Baoquan He <[email protected]> Cc: Andy Lutomirski <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 815d570 commit f089568

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

arch/x86/syscalls/syscall_64.tbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@
326326
317 common seccomp sys_seccomp
327327
318 common getrandom sys_getrandom
328328
319 common memfd_create sys_memfd_create
329+
320 common kexec_file_load sys_kexec_file_load
329330

330331
#
331332
# x32-specific system call numbers start at 512 to avoid cache impact

include/linux/syscalls.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ asmlinkage long sys_restart_syscall(void);
317317
asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
318318
struct kexec_segment __user *segments,
319319
unsigned long flags);
320+
asmlinkage long sys_kexec_file_load(int kernel_fd, int initrd_fd,
321+
unsigned long cmdline_len,
322+
const char __user *cmdline_ptr,
323+
unsigned long flags);
320324

321325
asmlinkage long sys_exit(int error_code);
322326
asmlinkage long sys_exit_group(int error_code);

kernel/kexec.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,13 @@ COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry,
10581058
}
10591059
#endif
10601060

1061+
SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,
1062+
unsigned long, cmdline_len, const char __user *, cmdline_ptr,
1063+
unsigned long, flags)
1064+
{
1065+
return -ENOSYS;
1066+
}
1067+
10611068
void crash_kexec(struct pt_regs *regs)
10621069
{
10631070
/* Take the kexec_mutex here to prevent sys_kexec_load

kernel/sys_ni.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ cond_syscall(sys_swapon);
2525
cond_syscall(sys_swapoff);
2626
cond_syscall(sys_kexec_load);
2727
cond_syscall(compat_sys_kexec_load);
28+
cond_syscall(sys_kexec_file_load);
2829
cond_syscall(sys_init_module);
2930
cond_syscall(sys_finit_module);
3031
cond_syscall(sys_delete_module);

0 commit comments

Comments
 (0)