[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8841773d-c7d2-73aa-6fa6-fe496952f2ba@alexander-lochmann.de>
Date: Mon, 15 Mar 2021 22:43:25 +0100
From: Alexander Lochmann <info@...xander-lochmann.de>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Andrey Konovalov <andreyknvl@...gle.com>,
Jonathan Corbet <corbet@....net>,
Andrew Morton <akpm@...ux-foundation.org>,
Wei Yongjun <weiyongjun1@...wei.com>,
Maciej Grochowski <maciej.grochowski@...me>,
kasan-dev <kasan-dev@...glegroups.com>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
syzkaller <syzkaller@...glegroups.com>
Subject: Re: [PATCH] KCOV: Introduced tracing unique covered PCs
On 15.03.21 09:02, Dmitry Vyukov wrote:
>>>> static notrace unsigned long canonicalize_ip(unsigned long ip)
>>>> @@ -191,18 +192,26 @@ void notrace __sanitizer_cov_trace_pc(void)
>>>> struct task_struct *t;
>>>> unsigned long *area;
>>>> unsigned long ip = canonicalize_ip(_RET_IP_);
>>>> - unsigned long pos;
>>>> + unsigned long pos, idx;
>>>>
>>>> t = current;
>>>> - if (!check_kcov_mode(KCOV_MODE_TRACE_PC, t))
>>>> + if (!check_kcov_mode(KCOV_MODE_TRACE_PC | KCOV_MODE_UNIQUE_PC, t))
>>>> return;
>>>>
>>>> area = t->kcov_area;
>>>> - /* The first 64-bit word is the number of subsequent PCs. */
>>>> - pos = READ_ONCE(area[0]) + 1;
>>>> - if (likely(pos < t->kcov_size)) {
>>>> - area[pos] = ip;
>>>> - WRITE_ONCE(area[0], pos);
>>>> + if (likely(t->kcov_mode == KCOV_MODE_TRACE_PC)) {
>>>
>>> Does this introduce an additional real of t->kcov_mode?
>>> If yes, please reuse the value read in check_kcov_mode.
>> Okay. How do I get that value from check_kcov_mode() to the caller?
>> Shall I add an additional parameter to check_kcov_mode()?
>
> Yes, I would try to add an additional pointer parameter for mode. I
> think after inlining the compiler should be able to regestrize it.
>
Should kcov->mode be written directly to that ptr?
Otherwise, it must be written to the already present variable mode, and
than copied to the ptr (if not NULL).
- Alex
--
Alexander Lochmann PGP key: 0xBC3EF6FD
Heiliger Weg 72 phone: +49.231.28053964
D-44141 Dortmund mobile: +49.151.15738323
Powered by blists - more mailing lists