Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1392155

Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled()

From Chen Gang <chengang@emindsoft.com.cn>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled()
Date 2016-05-02 14:10 +0200
Message-ID <rukPM-35U-7@gated-at.bofh.it> (permalink)
References <ruf3I-6ho-7@gated-at.bofh.it> <rukmK-2pV-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 5/2/16 19:34, Alexander Potapenko wrote:
> On Mon, May 2, 2016 at 7:36 AM,  <chengang@emindsoft.com.cn> wrote:
>> From: Chen Gang <chengang@emindsoft.com.cn>
>>
>> According to kasan_[dis|en]able_current() comments and the kasan_depth'
>> s initialization, if kasan_depth is zero, it means disable.
> The comments for those functions are really poor, but there's nothing
> there that says kasan_depth==0 disables KASAN.
> Actually, kasan_report_enabled() is currently the only place that
> denotes the semantics of kasan_depth, so it couldn't be wrong.
> 
> init_task.kasan_depth is 1 during bootstrap and is then set to zero by
> kasan_init()
> For every other thread, current->kasan_depth is zero-initialized.
> 

OK, what you said sound reasonable to me. and do you also mean:

 - kasan_depth == 0 means enable KASAN, others means disable KASAN.

 - If always let kasan_[en|dis]able_current() be pair, and notice about
   the overflow, it should be OK: "kasan_enable_current() can let
   kasan_depth++, and kasan_disable_current() will let kasan_depth--".

 - If we check the related overflow, "kasan_depth == 1" mean "the KASAN
   should be always in disable state".


Thanks.
-- 
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() chengang@emindsoft.com.cn - 2016-05-02 08:00 +0200
  Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Dmitry Vyukov <dvyukov@google.com> - 2016-05-02 10:30 +0200
    Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 13:20 +0200
      Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Dmitry Vyukov <dvyukov@google.com> - 2016-05-02 13:30 +0200
        Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 14:30 +0200
          Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Alexander Potapenko <glider@google.com> - 2016-05-02 14:50 +0200
            Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 15:50 +0200
              Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Alexander Potapenko <glider@google.com> - 2016-05-02 16:30 +0200
                Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 17:10 +0200
                Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Alexander Potapenko <glider@google.com> - 2016-05-02 17:40 +0200
                Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 18:20 +0200
                Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 18:40 +0200
  Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Alexander Potapenko <glider@google.com> - 2016-05-02 13:40 +0200
    Re: [PATCH] mm/kasan/kasan.h: Fix boolean checking issue for kasan_report_enabled() Chen Gang <chengang@emindsoft.com.cn> - 2016-05-02 14:10 +0200

csiph-web