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] [thread-next>] [day] [month] [year] [list]
Date: Fri, 5 Apr 2024 15:29:53 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: "Matthieu Baerts (NGI0)" <matttbe@...nel.org>
Cc: mptcp@...ts.linux.dev, Mat Martineau <martineau@...nel.org>, 
	Geliang Tang <geliang@...nel.org>, "David S. Miller" <davem@...emloft.net>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Shuah Khan <shuah@...nel.org>, 
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, Geliang Tang <tanggeliang@...inos.cn>
Subject: Re: [PATCH net-next 1/2] mptcp: add last time fields in mptcp_info

On Fri, Apr 5, 2024 at 3:06 PM Matthieu Baerts (NGI0)
<matttbe@...nel.org> wrote:
>
> From: Geliang Tang <tanggeliang@...inos.cn>
>
> This patch adds "last time" fields last_data_sent, last_data_recv and
> last_ack_recv in struct mptcp_sock to record the last time data_sent,
> data_recv and ack_recv happened. They all are initialized as
> tcp_jiffies32 in __mptcp_init_sock(), and updated as tcp_jiffies32 too
> when data is sent in __subflow_push_pending(), data is received in
> __mptcp_move_skbs_from_subflow(), and ack is received in ack_update_msk().
>
> Similar to tcpi_last_data_sent, tcpi_last_data_recv and tcpi_last_ack_recv
> exposed with TCP, this patch exposes the last time "an action happened" for
> MPTCP in mptcp_info, named mptcpi_last_data_sent, mptcpi_last_data_recv and
> mptcpi_last_ack_recv, calculated in mptcp_diag_fill_info() as the time
> deltas between now and the newly added last time fields in mptcp_sock.
>
> Also add three reserved bytes in struct mptcp_info not to have holes in
> this structure exposed to userspace.
>
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/446
> Signed-off-by: Geliang Tang <tanggeliang@...inos.cn>
> Reviewed-by: Mat Martineau <martineau@...nel.org>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@...nel.org>
> ---
>  include/uapi/linux/mptcp.h | 4 ++++


> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index 73fdf423de44..2ec2fdf9f4af 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
> @@ -896,6 +896,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int
>  void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
>  {
>         struct sock *sk = (struct sock *)msk;
> +       u32 now = tcp_jiffies32;
>         u32 flags = 0;
>         bool slow;
>
> @@ -930,6 +931,7 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
>         info->mptcpi_snd_una = msk->snd_una;
>         info->mptcpi_rcv_nxt = msk->ack_seq;
>         info->mptcpi_bytes_acked = msk->bytes_acked;
> +       info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv);
>         mptcp_data_unlock(sk);
>
>         slow = lock_sock_fast(sk);

 lock_sock_fast(sk) can sleep and be quite slow...

I suggest you reload now = jiffies32;


> @@ -942,6 +944,8 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
>         info->mptcpi_bytes_retrans = msk->bytes_retrans;
>         info->mptcpi_subflows_total = info->mptcpi_subflows +
>                 __mptcp_has_initial_subflow(msk);
> +       info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent);
> +       info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv);
>         unlock_sock_fast(sk, slow);
>  }
>  EXPORT_SYMBOL_GPL(mptcp_diag_fill_info);
>
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ