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: <CAGHK07Afdys4WHEjsekSChbFVGwWVccofSS+Bk357m8=1BfJBw@mail.gmail.com>
Date:   Thu, 5 Jul 2018 09:34:23 +1000
From:   Jonathan Maxwell <jmaxwell37@...il.com>
To:     David Laight <David.Laight@...lab.com>
Cc:     Neal Cardwell <ncardwell@...gle.com>,
        David Miller <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Alexey Kuznetsov <kuznet@....inr.ac.ru>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        "jmaxwell@...hat.com" <jmaxwell@...hat.com>
Subject: Re: [net-next,v2] tcp: Improve setsockopt() TCP_USER_TIMEOUT accuracy

Let's wait for Eric to review. Then I'll put together the next version.

Regards

Jon

On Thu, Jul 5, 2018 at 12:57 AM, David Laight <David.Laight@...lab.com> wrote:
> From: Neal Cardwell
>> Sent: 04 July 2018 15:14
>>
>> On Tue, Jul 3, 2018 at 8:06 PM Jon Maxwell <jmaxwell37@...il.com> wrote:
>> >
>> > Signed-off-by: Jon Maxwell <jmaxwell37@...il.com>
>> > ---
>> >  net/ipv4/tcp_timer.c | 48 +++++++++++++++++++++++++++++++++++++++---------
>> >  1 file changed, 39 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
>> > index 3b3611729928..d129e670d02a 100644
>> > --- a/net/ipv4/tcp_timer.c
>> > +++ b/net/ipv4/tcp_timer.c
> ...
>> > +static __u32 tcp_clamp_rto_to_user_timeout(struct sock *sk)
>> > +{
>> > +       struct inet_connection_sock *icsk = inet_csk(sk);
>> > +       __u32 rto = icsk->icsk_rto;
>
> Why cache rto past all the function calls until it is needed?
>
>> > +       __u32 elapsed, user_timeout;
>> > +       unsigned int start_ts;
>>
>> I'd suggest u32 here for start_ts (per the rationale above).
>>
>> > +
>> > +       start_ts = tcp_retransmit_stamp(sk);
>> > +       if (!icsk->icsk_user_timeout || !start_ts)
>> > +               return rto;
>> > +       elapsed = tcp_time_stamp(tcp_sk(sk)) - start_ts;
>> > +       user_timeout = jiffies_to_msecs(icsk->icsk_user_timeout);
>> > +       if (elapsed >= user_timeout)
>> > +               rto = 1;  /* user timeout has passed; fire ASAP */
>> > +       else
>> > +               rto = min(rto, (__u32)msecs_to_jiffies(user_timeout - elapsed));
>>
>> My sense is that min_t would be preferred here, e.g:
>>
>>   rto = min_t(__u32, rto, msecs_to_jiffies(user_timeout - elapsed));
>
> Think I'd just write the conditional...
>
>> > +       return rto;
>> > +}
>
> Looks to me like it doesn't correctly allow for the conversions
> between millisecond and jiffies either.
> I suspect the msecs_to_jiffies() call can return zero (unless it rounds up).
> Coding with a signed 'time until user timeout' might make it simpler.
>
>         David
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ