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: <20190814163959.GB54611@arrakis.emea.arm.com>
Date:   Wed, 14 Aug 2019 17:39:59 +0100
From:   Catalin Marinas <catalin.marinas@....com>
To:     Mark Rutland <mark.rutland@....com>
Cc:     linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        akpm@...ux-foundation.org, bigeasy@...utronix.de, bp@...e.de,
        davem@...emloft.net, hch@....de, kan.liang@...el.com,
        mingo@...nel.org, peterz@...radead.org, riel@...riel.com,
        will@...nel.org
Subject: Re: [PATCH 3/9] kmemleak: correctly check for kthreads

On Wed, Aug 14, 2019 at 11:41:25AM +0100, Mark Rutland wrote:
> In general, a non-NULL current->mm doesn't imply that current is a
> kthread, as kthreads can install an mm via use_mm(), and so it's
> preferable to use is_kthread() to determine whether a thread is a
> kthread.
> 
> For consistency, let's use is_kthread() here.
> 
> Signed-off-by: Mark Rutland <mark.rutland@....com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Peter Zijlstra <peterz@...radead.org>
> ---
>  mm/kmemleak.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Acked-by: Catalin Marinas <catalin.marinas@....com>

> index 6e9e8cca663e..42ea3c14b577 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -1290,10 +1290,10 @@ static int scan_should_stop(void)
>  	 * This function may be called from either process or kthread context,
>  	 * hence the need to check for both stop conditions.
>  	 */
> -	if (current->mm)
> -		return signal_pending(current);
> -	else
> +	if (is_kthread(current))
>  		return kthread_should_stop();
> +	else
> +		return signal_pending(current);

While you are at it, you can drop the 'else' as well (occasionally
checkpatch complains about 'else' after return).

Thanks.

-- 
Catalin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ