From: Alexander Potapenko <glider@google.com>
To: Chen Gang <chengang@emindsoft.com.cn>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Dmitriy Vyukov <dvyukov@google.com>,
kasan-dev <kasan-dev@googlegroups.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Memory Management List <linux-mm@kvack.org>,
Chen Gang <gang.chen.5i5j@gmail.com>
Subject: Re: [PATCH] include/linux/kasan.h: Notice about 0 for kasan_[dis/en]able_current()
Date: Mon, 2 May 2016 13:23:03 +0200 [thread overview]
Message-ID: <CAG_fn=W7m0UN6-38Ut0c-a_m4BfuUPjrmHQThGCLLqV-brKTmA@mail.gmail.com> (raw)
In-Reply-To: <572737FB.2020405@emindsoft.com.cn>
On Mon, May 2, 2016 at 1:20 PM, Chen Gang <chengang@emindsoft.com.cn> wrote:
> On 5/2/16 18:49, Alexander Potapenko wrote:
>> On Mon, May 2, 2016 at 7:35 AM, <chengang@emindsoft.com.cn> wrote:
>>>
>>> According to their comments and the kasan_depth's initialization, if
>>> kasan_depth is zero, it means disable. So kasan_depth need consider
>>> about the 0 overflow.
>>>
>>> Also remove useless comments for dummy kasan_slab_free().
>>>
>>> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
>>
>> Acked-by: Alexander Potapenko <glider@google.com>
Nacked-by: Alexander Potapenko <glider@google.com>
>>
>
> OK, thanks.
Well, on a second thought I take that back, there still might be problems.
I haven't noticed the other CL, and was too hasty reviewing this one.
As kasan_disable_current() and kasan_enable_current() always go
together, we need to prevent nested calls to them from breaking
everything.
If we ignore some calls to kasan_disable_current() to prevent
overflows, the pairing calls to kasan_enable_current() will bring
|current->kasan_depth| to an invalid state.
E.g. if I'm understanding your idea correctly, after the following
sequence of calls:
kasan_disable_current(); // #1
kasan_disable_current(); // #2
kasan_enable_current(); // #3
kasan_enable_current(); // #4
the value of |current->kasan_depth| will be 2, so a single subsequent
call to kasan_disable_current() won't disable KASAN.
I think we'd better add BUG checks to bail out if the value of
|current->kasan_depth| is too big or too small.
> Another patch thread is also related with this patch thread, please help
> check.
>
> And sorry, originally, I did not let the 2 patches in one patches set.
>
> Thanks.
> --
> Chen Gang (陈刚)
>
> Managing Natural Environments is the Duty of Human Beings.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-05-02 11:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 5:35 chengang
2016-05-02 10:49 ` Alexander Potapenko
2016-05-02 11:20 ` Chen Gang
2016-05-02 11:23 ` Alexander Potapenko [this message]
2016-05-02 12:40 ` Chen Gang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAG_fn=W7m0UN6-38Ut0c-a_m4BfuUPjrmHQThGCLLqV-brKTmA@mail.gmail.com' \
--to=glider@google.com \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=chengang@emindsoft.com.cn \
--cc=dvyukov@google.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox