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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190702161710.GB34718@lakrids.cambridge.arm.com>
Date:   Tue, 2 Jul 2019 17:17:10 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] stacktrace: Use PF_KTHREAD to check for kernel threads

On Tue, Jul 02, 2019 at 05:53:35PM +0200, Thomas Gleixner wrote:
> !current->mm is not a reliable indicator for kernel threads as they might
> temporarily use a user mm. Check for PF_KTHREAD instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>

FWIW:

Acked-by: Mark Rutland <mark.rutland@....com>

As a heads-up, I started looking into cleaning up bogus mm checks
tree-wide, since there are a number that look suspicious (e.g. arm64's
arch_dup_task_struct() and x86's __kernel_fpu_begin()).

I was hoping to add an is_kthread(tsk) helper to push people in the
right direction [1].

Thanks,
Mark.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=sched/kthread-cleanup

> ---
> --- a/kernel/stacktrace.c
> +++ b/kernel/stacktrace.c
> @@ -228,7 +228,7 @@ unsigned int stack_trace_save_user(unsig
>  	};
>  
>  	/* Trace user stack if not a kernel thread */
> -	if (!current->mm)
> +	if (current->flags & PF_KTHREAD)
>  		return 0;
>  
>  	arch_stack_walk_user(consume_entry, &c, task_pt_regs(current));

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ