linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Alexander Potapenko <glider@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Popov <alex.popov@linux.com>,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	Quentin Casasnovas <quentin.casasnovas@oracle.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Kees Cook <keescook@chromium.org>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	syzkaller <syzkaller@googlegroups.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] kcov: support comparison operands collection
Date: Tue, 10 Oct 2017 17:34:42 +0200	[thread overview]
Message-ID: <CACT4Y+ZeYmOXK8P37+HkfYAavnSsnoMDYLP7MF6FL_VpnC6bZw@mail.gmail.com> (raw)
In-Reply-To: <CAG_fn=UsTCyueyuMGT8i6ZoX9CWwvE9GhJAWnsJsPhf1AY2Z4Q@mail.gmail.com>

On Tue, Oct 10, 2017 at 5:28 PM, 'Alexander Potapenko' via syzkaller
<syzkaller@googlegroups.com> wrote:
> On Mon, Oct 9, 2017 at 8:46 AM, Mark Rutland <mark.rutland@arm.com> wrote:
>> Hi,
>>
>> I look forward to using this! :)
>>
>> I just have afew comments below.
>>
>> On Mon, Oct 09, 2017 at 05:05:19PM +0200, Alexander Potapenko wrote:
>>> +/*
>>> + * Defines the format for the types of collected comparisons.
>>> + */
>>> +enum kcov_cmp_type {
>>> +     /*
>>> +      * LSB shows whether one of the arguments is a compile-time constant.
>>> +      */
>>> +     KCOV_CMP_CONST = 1,
>>> +     /*
>>> +      * Second and third LSBs contain the size of arguments (1/2/4/8 bytes).
>>> +      */
>>> +     KCOV_CMP_SIZE1 = 0,
>>> +     KCOV_CMP_SIZE2 = 2,
>>> +     KCOV_CMP_SIZE4 = 4,
>>> +     KCOV_CMP_SIZE8 = 6,
>>> +     KCOV_CMP_SIZE_MASK = 6,
>>> +};
>>
>> Given that LSB is meant to be OR-ed in, (and hence combinations of
>> values are meaningful) I don't think it makes sense for this to be an
>> enum. This would clearer as something like:
>>
>> /*
>>  * The format for the types of collected comparisons.
>>  *
>>  * Bit 0 shows whether one of the arguments is a compile-time constant.
>>  * Bits 1 & 2 contain log2 of the argument size, up to 8 bytes.
>>  */
>> #define KCOV_CMP_CONST          (1 << 0)
>> #define KCOV_CMP_SIZE(n)        ((n) << 1)
>> #define KCOV_CMP_MASK           KCOV_CMP_SIZE(3)
> Agreed.
>> ... I note that a few places in the kernel use a 128-bit type. Are
>> 128-bit comparisons not instrumented?
>>
>> [...]
>>
>>> +static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
>>> +{
>>> +     enum kcov_mode mode;
>>> +
>>> +     /*
>>> +      * We are interested in code coverage as a function of a syscall inputs,
>>> +      * so we ignore code executed in interrupts.
>>> +      */
>>> +     if (!t || !in_task())
>>> +             return false;
>>
>> This !t check can go, as with the one in __sanitizer_cov_trace_pc, since
>> t is always current, and therefore cannot be NULL.
> Ok.
>> IIRC there's a patch queued for that, which this may conflict with.
> Sorry, I don't quite understand what exactly is conflicting here.


This patch should be in mm tree:
https://patchwork.kernel.org/patch/9978383/

--
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>

  reply	other threads:[~2017-10-10 15:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 15:05 Alexander Potapenko
2017-10-09 15:05 ` [PATCH v2 2/3] Makefile: support flag -fsanitizer-coverage=trace-cmp Alexander Potapenko
2017-10-09 15:53   ` Andrey Ryabinin
2017-10-10 15:28     ` Alexander Potapenko
2017-10-10 21:53   ` kbuild test robot
2017-10-09 15:05 ` [PATCH v2 3/3] kcov: update documentation Alexander Potapenko
2017-10-09 15:46 ` [PATCH v2 1/3] kcov: support comparison operands collection Mark Rutland
2017-10-09 18:15   ` Dmitry Vyukov
2017-10-09 18:37     ` Mark Rutland
2017-10-09 18:46       ` Dmitry Vyukov
2017-10-10  9:56         ` Mark Rutland
2017-10-10 15:28   ` Alexander Potapenko
2017-10-10 15:34     ` Dmitry Vyukov [this message]
2017-10-11  9:56       ` Alexander Potapenko

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=CACT4Y+ZeYmOXK8P37+HkfYAavnSsnoMDYLP7MF6FL_VpnC6bZw@mail.gmail.com \
    --to=dvyukov@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.popov@linux.com \
    --cc=andreyknvl@google.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=glider@google.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=quentin.casasnovas@oracle.com \
    --cc=syzkaller@googlegroups.com \
    --cc=vegard.nossum@oracle.com \
    /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