Re: [PATCH] io_thread/x86: don't reset 'cs', 'ss', 'ds' and 'es' registers for io_threads

From: Linus Torvalds
Date: Tue May 25 2021 - 16:24:26 EST


On Tue, May 25, 2021 at 9:40 AM Olivier Langlois <olivier@xxxxxxxxxxxxxx> wrote:
>
> If I look in the create_io_thread() function, I can see that CLONE_VM
> isn't set...

That would indeed be horribly buggy, but I'm not seeing it:

.flags = ((lower_32_bits(flags) | CLONE_VM |
CLONE_UNTRACED) & ~CSIGNAL),

Yeah, it has that odd "first create 'flags' without the CLONE_VM, but
that is only used for that

lower_32_bits(flags)

thing, and then we explicitly add CLONE_VM in there in the actual
kernel_clone_args.

It's because of how 'kernel_thread()' is written (that has historical
reasons), and the oddity is copied from there.

Linus