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: <CAFd5g45V6P9ATGQ3kqkuFLNDB=_01gws8Ldr1kH3j+r0aSZ-Og@mail.gmail.com>
Date:   Wed, 23 Mar 2022 19:56:26 -0400
From:   Brendan Higgins <brendanhiggins@...gle.com>
To:     David Gow <davidgow@...gle.com>
Cc:     Daniel Latypov <dlatypov@...gle.com>,
        Shuah Khan <skhan@...uxfoundation.org>,
        kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: Make kunit_remove_resource() idempotent

On Fri, Mar 18, 2022 at 2:50 AM David Gow <davidgow@...gle.com> wrote:
>
> The kunit_remove_resource() function is used to unlink a resource from
> the list of resources in the test, making it no longer show up in
> kunit_find_resource().
>
> However, this could lead to a race condition if two threads called
> kunit_remove_resource() on the same resource at the same time: the
> resource would be removed from the list twice (causing a crash at the
> second list_del()), and the refcount for the resource would be
> decremented twice (instead of once, for the reference held by the
> resource list).
>
> Fix both problems, the first by using list_del_init(), and the second by
> checking if the resource has already been removed using list_empty(),
> and only decrementing its refcount if it has not.
>
> Also add a KUnit test for the kunit_remove_resource() function which
> tests this behaviour.
>
> Reported-by: Daniel Latypov <dlatypov@...gle.com>
> Signed-off-by: David Gow <davidgow@...gle.com>

Reviewed-by: Brendan Higgins <brendanhiggins@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ