On Thu, Jul 9, 2020 at 11:19 AM Christoph Hellwig [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Don't rely on the implicit set_fs(KERNEL_DS) for ksys_open to work, but
instead open a struct file for /dev/console and then install it as FD
0/1/2 manually.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/file.c | 7 +------
include/linux/syscalls.h | 1 -
init/main.c | 16 ++++++++++------
3 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/fs/file.c b/fs/file.c
index abb8b7081d7a44..85b7993165dd2f 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -985,7 +985,7 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
return ksys_dup3(oldfd, newfd, 0);
}
-int ksys_dup(unsigned int fildes)
+SYSCALL_DEFINE1(dup, unsigned int, fildes)
{
int ret = -EBADF;
struct file *file = fget_raw(fildes);@@ -1000,11 +1000,6 @@ int ksys_dup(unsigned int fildes)
return ret;
}
-SYSCALL_DEFINE1(dup, unsigned int, fildes)
-{
- return ksys_dup(fildes);
-}
-
Please split the removal of the now unused ksys_*() functions into a
separate patch.
--
Brian Gerst