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:   Tue, 13 Dec 2016 22:21:59 +0300
From:   Andrey Ryabinin <aryabinin@...tuozzo.com>
To:     Andy Lutomirski <luto@...capital.net>,
        Michal Hocko <mhocko@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>
CC:     Andrew Morton <akpm@...ux-foundation.org>,
        Huang Ying <ying.huang@...ux.intel.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Christoph Hellwig <hch@....de>,
        Joel Fernandes <joelaf@...gle.com>,
        "Jisheng Zhang" <jszhang@...vell.com>,
        Chris Wilson <chris@...is-wilson.co.uk>,
        "John Dias" <joaodias@...gle.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        LKP <lkp@...org>
Subject: Re: [PATCH] mm-add-vfree_atomic-fix

On 12/13/2016 09:15 PM, Andy Lutomirski wrote:


>>>
>>> But not quite acked by me.  What happened to the vfree code that
>>> causes vfree_deferred to be called in a preemptable context?  That
>>> sounds like a bug.
>>
>> Not sure I understand but the above stack points to a preemptible
>> context (copy_process). My stack was different and it looks preemptible as well.
>> free_thread_stack calls vfree_atomic unconditionally. So I am not sure
>> why do you think this is a bug?
>>
>>> (This code doesn't exist in Linus' tree.  What tree does this apply to.)
>>
>> Anyway, now that I am looking at Andrew's tree I can see [1] which
>> doesn't have this_cpu_ptr. So I am not sure where this this_cpu_ptr came
>> from. Maybe the previous version of the patch which has shown up in the
>> linux-next and Andrew has picked up [2] in the meantime. /me confused
>>
>> [1] http://www.ozlabs.org/~akpm/mmotm/broken-out/mm-add-vfree_atomic.patch
>> [2] http://lkml.kernel.org/r/1481553981-3856-1-git-send-email-aryabinin@virtuozzo.com
> 
> The underlying issue seems to be that we have this shiny new function
> vfree_atomic() which doesn't work in *non-atomic* context and that we

It does work non-atomic context. It's fixed now.

> have "kernel/fork: use vfree_atomic() to free thread stack" that calls
> vfree_atomic() from non-atomic context.

>From both context actually. Usually task stack is freed from atomic context:
	http://lkml.kernel.org/r/20161019111541.GQ29358@nuc-i3427.alporthouse.com
	http://lkml.kernel.org/r/CALCETrVqjejgpQVUdem8RK3uxdEgfOZy4cOJqJQjCLtBDnJfyQ@mail.gmail.com

On rare occasions it can be freed from non-atomic context, e.g. error path in copy_process().

> I'm not sure what the motivation of the latter patch was, but ISTM we
> should revert it.  TBH I'm not quite sure what the purpose of
> splitting vfree() and vfree_atomic() was, but I'm not seeing any
> reason that the common case of freeing stacks from non-atomic context
> should defer the free instead of just doing it right away.
>
> Andrey, Johannes, why should task stack freeing use vfree_atomic() in
> the first place?

Because vfree() now can sleep and task stack freeing usually done in atomic context.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ