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: <6390faf3-5b91-2534-0d53-b5bfb213c6c9@gmail.com>
Date: Thu, 3 Aug 2023 13:04:07 -0700
From: Kui-Feng Lee <sinquersw@...il.com>
To: David Ahern <dsahern@...nel.org>, thinker.li@...il.com,
 davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 netdev@...r.kernel.org, pabeni@...hat.com, martin.lau@...ux.dev,
 kernel-team@...a.com, yhs@...a.com
Cc: kuifeng@...a.com
Subject: Re: [PATCH net-next v5 2/2] selftests: fib_tests: Add a test case for
 IPv6 garbage collection



On 8/3/23 12:49, David Ahern wrote:
> On 8/2/23 10:09 PM, Kui-Feng Lee wrote:
>>
>>
>> On 8/2/23 19:06, David Ahern wrote:
>>> On 8/1/23 6:43 PM, thinker.li@...il.com wrote:
>>> \> @@ -747,6 +750,97 @@ fib_notify_test()
>>>>        cleanup &> /dev/null
>>>>    }
>>>>    +fib6_gc_test()
>>>> +{
>>>> +    echo
>>>> +    echo "Fib6 garbage collection test"
>>>> +
>>>> +    STRACE=$(which strace)
>>>> +    if [ -z "$STRACE" ]; then
>>>> +        echo "    SKIP: strace not found"
>>>> +        ret=$ksft_skip
>>>> +        return
>>>> +    fi
>>>> +
>>>> +    EXPIRE=10
>>>> +
>>>> +    setup
>>>> +
>>>> +    set -e
>>>> +
>>>> +    # Check expiration of routes every 3 seconds (GC)
>>>> +    $NS_EXEC sysctl -wq net.ipv6.route.gc_interval=300
>>>> +
>>>> +    $IP link add dummy_10 type dummy
>>>> +    $IP link set dev dummy_10 up
>>>> +    $IP -6 address add 2001:10::1/64 dev dummy_10
>>>> +
>>>> +    $NS_EXEC sysctl -wq net.ipv6.route.flush=1
>>>> +
>>>> +    # Temporary routes
>>>> +    for i in $(seq 1 1000); do
>>>> +        # Expire route after $EXPIRE seconds
>>>> +        $IP -6 route add 2001:20::$i \
>>>> +        via 2001:10::2 dev dummy_10 expires $EXPIRE
>>>> +    done
>>>> +    N_EXP=$($IP -6 route list |grep expires|wc -l)
>>>> +    if [ $N_EXP -ne 1000 ]; then
>>>
>>> race condition here ... that you can install all 1000 routes and then
>>> run this command before any expire. 10 seconds is normally more than
>>> enough time, but on a loaded server it might not be. And really it does
>>> not matter. What matters is that you install routes with an expires and
>>> they disappear when expected - and I believe the flush below should not
>>> be needed to validate they have been removed.
>>
>> Without the flush below, the result will be very unpredictable or need
>> to wait longer, at least two gc_interval seconds. We can
>> shorten gc_interval to 10s, but we need to wait for 20s to make it
>> certain. It is more predictable with the flush.
>>
>> About race condition, I will remove the check.  Just like what you said,
>> it is not necessary.
> 
> you do not need to measure how long it takes to remove expired routes in
> a selftest; you are only testing that in fact the expired routes are
> removed.
> 
> EXPIRES=1
> install routes
> # wait 2x expires time for removal
> sleep 2
> verify routes are removed.
Got it!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ