Re: [PATCH 4/5] init: unify opening /dev/console as stdin/stdout/stderr
From: Dominik Brodowski
Date: Thu Dec 19 2019 - 02:08:53 EST
On Thu, Dec 19, 2019 at 05:50:19AM +0800, youling 257 wrote:
> 2019-12-18 5:14 GMT+08:00, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>:
> > This should be fixed by 2d3145f8d280 ("early init: fix error handling
> > when opening /dev/console")
>
> this fix no help for me.
>
> > I'm not sure what you did to trigger that bug, but it was a bug.
>
> alt+f1, type bash command,
> bash: cannot set terminal process group (-1): Inappropriate ioctl for device
> bash: no job control in this shell
Could you test this patch, please? And if it does not work: What is the
content of /proc/1/fd/ and /proc/1/fdinfo/* for the working and non-working
case? That are the only changes visible to userspace...
Thanks,
Dominik
diff --git a/init/main.c b/init/main.c
index 1ecfd43ed464..8886530e9dec 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1162,7 +1162,7 @@ void console_on_rootfs(void)
unsigned int i;
/* Open /dev/console in kernelspace, this should never fail */
- file = filp_open("/dev/console", O_RDWR, 0);
+ file = filp_open("/dev/console", force_o_largefile() ? O_LARGEFILE | O_RDWR : O_RDWR, 0);
if (IS_ERR(file))
goto err_out;