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: <B4012542-5EF6-41FB-B793-77B829D26B2C@fb.com>
Date:   Sun, 31 Dec 2017 11:20:56 +0000
From:   Lawrence Brakmo <brakmo@...com>
To:     Yuchung Cheng <ycheng@...gle.com>
CC:     netdev <netdev@...r.kernel.org>, Kernel Team <Kernel-team@...com>,
        "Blake Matheny" <bmatheny@...com>, Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Eric Dumazet <eric.dumazet@...il.com>,
        Neal Cardwell <ncardwell@...gle.com>
Subject: Re: [PATCH v2 bpf-next 06/11] bpf: Add sock_ops RTO callback


On 12/28/17, 9:58 AM, "Yuchung Cheng" <ycheng@...gle.com> wrote:

    On Thu, Dec 21, 2017 at 5:20 PM, Lawrence Brakmo <brakmo@...com> wrote:
    >
    > Adds an optional call to sock_ops BPF program based on whether the
    > BPF_SOCK_OPS_RTO_CB_FLAG is set in bpf_sock_ops_flags.
    > The BPF program is passed 2 arguments: icsk_retransmits and whether the
    > RTO has expired.
    >
    > Signed-off-by: Lawrence Brakmo <brakmo@...com>
    > ---
    >  include/uapi/linux/bpf.h | 5 +++++
    >  include/uapi/linux/tcp.h | 3 +++
    >  net/ipv4/tcp_timer.c     | 9 +++++++++
    >  3 files changed, 17 insertions(+)
    >
    > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
    > index 62b2c89..3cf9014 100644
    > --- a/include/uapi/linux/bpf.h
    > +++ b/include/uapi/linux/bpf.h
    > @@ -995,6 +995,11 @@ enum {
    >                                          * a congestion threshold. RTTs above
    >                                          * this indicate congestion
    >                                          */
    > +       BPF_SOCK_OPS_RTO_CB,            /* Called when an RTO has triggered.
    > +                                        * Arg1: value of icsk_retransmits
    > +                                        * Arg2: value of icsk_rto
    > +                                        * Arg3: whether RTO has expired
    > +                                        */
    >  };
    >
    >  #define TCP_BPF_IW             1001    /* Set TCP initial congestion window */
    > diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
    > index b4a4f64..089c19e 100644
    > --- a/include/uapi/linux/tcp.h
    > +++ b/include/uapi/linux/tcp.h
    > @@ -259,6 +259,9 @@ struct tcp_md5sig {
    >         __u8    tcpm_key[TCP_MD5SIG_MAXKEYLEN];         /* key (binary) */
    >  };
    >
    > +/* Definitions for bpf_sock_ops_flags */
    > +#define BPF_SOCK_OPS_RTO_CB_FLAG       (1<<0)
    > +
    >  /* INET_DIAG_MD5SIG */
    >  struct tcp_diag_md5sig {
    >         __u8    tcpm_family;
    > diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
    > index 6db3124..f9c57e2 100644
    > --- a/net/ipv4/tcp_timer.c
    > +++ b/net/ipv4/tcp_timer.c
    > @@ -215,9 +215,18 @@ static int tcp_write_timeout(struct sock *sk)
    >         tcp_fastopen_active_detect_blackhole(sk, expired);
    can't we just call it here once w/ 'expired' as a parameter, instead
    of duplicating the code?

Good point, I will fix it. Thanks!
    
    >         if (expired) {
    >                 /* Has it gone just too far? */
    > +               if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG))
    > +                       tcp_call_bpf_3arg(sk, BPF_SOCK_OPS_RTO_CB,
    > +                                         icsk->icsk_retransmits,
    > +                                         icsk->icsk_rto, 1);
    >                 tcp_write_err(sk);
    >                 return 1;
    >         }
    > +
    > +       if (BPF_SOCK_OPS_TEST_FLAG(tp, BPF_SOCK_OPS_RTO_CB_FLAG))
    > +               tcp_call_bpf_3arg(sk, BPF_SOCK_OPS_RTO_CB,
    > +                                 icsk->icsk_retransmits,
    > +                                 icsk->icsk_rto, 0);
    >         return 0;
    >  }
    >
    > --
    > 2.9.5
    >
    

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ