lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Feb 2024 17:22:36 -0500
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, fuyuanli <fuyuanli@...iglobal.com>
Subject: Re: [PATCH] kernel/hung_task.c: export sysctl_hung_task_timeout_secs

On Fri, Feb 09, 2024 at 02:13:24PM -0800, Andrew Morton wrote:
> On Fri,  9 Feb 2024 02:09:35 -0500 Kent Overstreet <kent.overstreet@...ux.dev> wrote:
> 
> > needed for thread_with_file; also rare but not unheard of to need this
> > in module code, when blocking on user input.
> 
> I see no bcachefs code in linux-next which uses this.  All I have to go
> with is the above explanation-free assertion.  IOW this patch is
> unreviewable.
> 
> > one workaround used by some code is wait_event_interruptible()
> 
> examples?

fs/bcachefs/util.h kthread_wait_event(); we use that - among other
things - when the kthread is parked waiting for userspace to flip it on.

TASK_INTERRUPTIBLE was the suggestion I got years ago, but I want to get
away from it because -

> 
> > - but that can be buggy if the outer context isn't expecting unwinding.
> 
> More explanation of this?

We're starting to think about this a bit more because of David Howell's
proposal; the idea is that perhaps TASK_UNINTERRUPTIBLE vs.
TASK_INTERURPTIBLE vs. TASK_KILLABLE should probably not be set at the
waiting context, it should be set at the outer context where we would
handle (or not handle) -ERESTARTSYS.

think mutex_lock() vs. mutex_lock_killable(); that is bubbling up the
context specification in an ad hoc way. This would regularize that.

I've also seen bugs where code was doing a fixed TASK_INTERRUPTIBLE and
the outer context wasn't expecting that - kthread creation does this.

> 
> > --- a/kernel/hung_task.c
> > +++ b/kernel/hung_task.c
> > @@ -43,6 +43,7 @@ static int __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT;
> >   * Zero means infinite timeout - no checking done:
> >   */
> >  unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_TASK_TIMEOUT;
> > +EXPORT_SYMBOL_GPL(sysctl_hung_task_timeout_secs);
> 
> It seems strange that a module wouild want this.  Makes one wonder what
> the heck is going on in there.
 
specifically, this is for thread_with_file, where we've got a kthread
hooked up to a file descriptor, effectively using it as both stdin and
stdout.

When the kthread reads from the fd, that can block for an unbounded
amount of time - we're waiting on userspace input and it's totally fine.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ