Re: Does uaccess_kernel() work for detecting kernel thread?

2021-01-05 Thread Tetsuo Handa
On 2021/01/05 16:59, Christoph Hellwig wrote: > On Wed, Dec 23, 2020 at 07:11:38PM +0900, Tetsuo Handa wrote: >> due to commit 5e6e9852d6f76e01 ("uaccess: add infrastructure for kernel >> builds with set_fs()") and follow up changes. Don't we need to change this >> "uaccess_kernel()" with

Re: Does uaccess_kernel() work for detecting kernel thread?

2021-01-05 Thread Christoph Hellwig
On Wed, Dec 23, 2020 at 07:11:38PM +0900, Tetsuo Handa wrote: > due to commit 5e6e9852d6f76e01 ("uaccess: add infrastructure for kernel > builds with set_fs()") and follow up changes. Don't we need to change this > "uaccess_kernel()" with "(current->flags & PF_KTHREAD)" ? No. The real problem

Re: Does uaccess_kernel() work for detecting kernel thread?

2021-01-04 Thread Christoph Hellwig
On Tue, Dec 22, 2020 at 11:33:58AM -0600, Eric W. Biederman wrote: > I do wonder though if perhaps we should create a is_user_cred helper to > detect the difference between the creds of kernel threads and the thread > of ordinary userspace. Which would handle io_uring that copy creds > around

Re: Does uaccess_kernel() work for detecting kernel thread?

2020-12-23 Thread Tetsuo Handa
On 2020/12/23 16:53, Christoph Hellwig wrote: > On Tue, Dec 22, 2020 at 11:39:08PM +0900, Tetsuo Handa wrote: >> For example, if uaccess_kernel() is "false" due to CONFIG_SET_FS=n, >> isn't sg_check_file_access() failing to detect kernel context? > > sg_check_file_access does exactly the right

Re: Does uaccess_kernel() work for detecting kernel thread?

2020-12-22 Thread Christoph Hellwig
On Tue, Dec 22, 2020 at 11:39:08PM +0900, Tetsuo Handa wrote: > For example, if uaccess_kernel() is "false" due to CONFIG_SET_FS=n, > isn't sg_check_file_access() failing to detect kernel context? sg_check_file_access does exactly the right thing - fail for all kernel threads as those can't

Re: Does uaccess_kernel() work for detecting kernel thread?

2020-12-22 Thread Eric W. Biederman
Tetsuo Handa writes: > Commit db68ce10c4f0a27c ("new helper: uaccess_kernel()") replaced > segment_eq(get_fs(), KERNEL_DS) > with uaccess_kernel(). But uaccess_kernel() became an unconditional "false" > for some architectures > due to commit 5e6e9852d6f76e01 ("uaccess: add infrastructure for

Does uaccess_kernel() work for detecting kernel thread?

2020-12-22 Thread Tetsuo Handa
Commit db68ce10c4f0a27c ("new helper: uaccess_kernel()") replaced segment_eq(get_fs(), KERNEL_DS) with uaccess_kernel(). But uaccess_kernel() became an unconditional "false" for some architectures due to commit 5e6e9852d6f76e01 ("uaccess: add infrastructure for kernel builds with set_fs()") and