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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aaee2292-022b-d99e-9fa9-b48ad5c2fe92@alexander-lochmann.de>
Date:   Sat, 18 Sep 2021 22:22:17 +0200
From:   Alexander Lochmann <info@...xander-lochmann.de>
To:     Andrey Konovalov <andreyknvl@...il.com>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Jonathan Corbet <corbet@....net>,
        Randy Dunlap <rdunlap@...radead.org>,
        Andrew Klychkov <andrew.a.klychkov@...il.com>,
        Miguel Ojeda <ojeda@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Aleksandr Nogikh <nogikh@...gle.com>,
        Wei Yongjun <weiyongjun1@...wei.com>,
        Maciej Grochowski <maciej.grochowski@...me>,
        kasan-dev@...glegroups.com, linux-doc@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv3] Introduced new tracing mode KCOV_MODE_UNIQUE.



On 27.03.21 15:56, Andrey Konovalov wrote:
> 
>> @@ -213,9 +223,10 @@ static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
>>          struct task_struct *t;
>>          u64 *area;
>>          u64 count, start_index, end_pos, max_pos;
>> +       unsigned int mode;
>>
>>          t = current;
>> -       if (!check_kcov_mode(KCOV_MODE_TRACE_CMP, t))
>> +       if (!check_kcov_mode(KCOV_MODE_TRACE_CMP, t, &mode))
>>                  return;
> 
> mode isn't used here, right? No need for it then.
> 
No, it's not. However, check_kcov_mode() needs it. Dmitry suggested 
passing a pointer to check_kcov_mode(), and let the optimizer do the rest.
>> @@ -562,12 +576,14 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
>>   {
>>          struct task_struct *t;
>>          unsigned long size, unused;
>> -       int mode, i;
>> +       int mode, i, text_size, ret = 0;
>>          struct kcov_remote_arg *remote_arg;
>>          struct kcov_remote *remote;
>>          unsigned long flags;
>>
>>          switch (cmd) {
>> +       case KCOV_INIT_UNIQUE:
>> +               fallthrough;
>>          case KCOV_INIT_TRACE:
>>                  /*
>>                   * Enable kcov in trace mode and setup buffer size.
>> @@ -581,11 +597,42 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
>>                   * that must not overflow.
>>                   */
>>                  size = arg;
>> -               if (size < 2 || size > INT_MAX / sizeof(unsigned long))
>> -                       return -EINVAL;
>> -               kcov->size = size;
>> -               kcov->mode = KCOV_MODE_INIT;
>> -               return 0;
>> +               if (cmd == KCOV_INIT_UNIQUE) {
> 
> Let's put this code under KCOV_INIT_UNIQUE in the switch. This
> internal if only saves duplicating two lines of code, which isn't
> worth it.
So. Shall I skip the fallthrough and move 'my' code upwards?

-- 
Alexander Lochmann                PGP key: 0xBC3EF6FD
Heiliger Weg 72                   phone:  +49.231.28053964
D-44141 Dortmund                  mobile: +49.151.15738323



Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ