Re: [PATCH] fs: use KERNEL_DS instead of get_ds()
From: Al Viro
Date: Fri Mar 08 2019 - 09:23:38 EST
On Fri, Mar 08, 2019 at 06:01:42AM -0800, Christoph Hellwig wrote:
> On Mon, Mar 04, 2019 at 04:23:06PM -0800, Linus Torvalds wrote:
> > Your script is disgusting, and I will not quote it for posterity for
> > that reason. I will just say that git has a "path exclusion" thing
> > that you can use to make it much more streamlined.
> >
> > And I ended up going a bit further, and just got rid of it all in
> > commit 736706bee329 ("get rid of legacy 'get_ds()' function")
>
> Any chance we could just retire the legacy FS/DS names that are
> horribly misleading these days? E.g. turn the whole thing into:
>
> uaccess_kernel_enable();
>
> ...
>
> uaccess_kernel_disable();
>
> which for now turn into the existing calls with a nesting counter
> in task_struct, with the hopes of cleaning all that mess up
> eventually.
You do realize that nested pairs of that sort are not all there is?
Even leaving m68k aside (there the same registers that select
userland or kernel for that kind of access can be used e.g. for
writeback control, or to switch to accessing sun3 MMU tables, etc.)
there are
* temporary switches to USER_DS in things like unaligned
access handlers, etc., where the kernel is doing emulation of possibly
userland insns; similar for oops code dumping, etc.
* use_mm()/unuse_mm() should probably switch to USER_DS and
back, rather than doing that in callers.
* switch to USER_DS (and no, it's *not* "USER_DS unless we started
with KERNEL_DS" - nested counter is no-go here) for perf callbacks.
* regular non-paired switches to USER_DS: do_exit() and
flush_old_exec().