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]
Message-ID: <ZTa9Us6Uq3TF_TDe@google.com>
Date: Mon, 23 Oct 2023 11:37:06 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Magnus Karlsson <magnus.karlsson@...il.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net, 
	andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org, yhs@...com, 
	john.fastabend@...il.com, kpsingh@...nel.org, haoluo@...gle.com, 
	jolsa@...nel.org, kuba@...nel.org, toke@...nel.org, willemb@...gle.com, 
	dsahern@...nel.org, magnus.karlsson@...el.com, bjorn@...nel.org, 
	maciej.fijalkowski@...el.com, hawk@...nel.org, yoong.siang.song@...el.com, 
	netdev@...r.kernel.org, xdp-hints@...-project.net
Subject: Re: [PATCH bpf-next v4 01/11] xsk: Support tx_metadata_len

On 10/23, Magnus Karlsson wrote:
> On Thu, 19 Oct 2023 at 19:50, Stanislav Fomichev <sdf@...gle.com> wrote:
> >
> > For zerocopy mode, tx_desc->addr can point to the arbitrary offset
> 
> nit: the -> an

Thanks!
 
> > and carry some TX metadata in the headroom. For copy mode, there
> > is no way currently to populate skb metadata.
> >
> > Introduce new tx_metadata_len umem config option that indicates how many
> > bytes to treat as metadata. Metadata bytes come prior to tx_desc address
> > (same as in RX case).
> >
> > The size of the metadata has the same constraints as XDP:
> > - less than 256 bytes
> > - 4-byte aligned
> > - non-zero
> >
> > This data is not interpreted in any way right now.
> >
> > Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> > ---
> >  include/net/xdp_sock.h            |  1 +
> >  include/net/xsk_buff_pool.h       |  1 +
> >  include/uapi/linux/if_xdp.h       |  1 +
> >  net/xdp/xdp_umem.c                |  4 ++++
> >  net/xdp/xsk.c                     | 12 +++++++++++-
> >  net/xdp/xsk_buff_pool.c           |  1 +
> >  net/xdp/xsk_queue.h               | 17 ++++++++++-------
> >  tools/include/uapi/linux/if_xdp.h |  1 +
> >  8 files changed, 30 insertions(+), 8 deletions(-)
> >
> > diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
> > index 7dd0df2f6f8e..5ae88a00f34a 100644
> > --- a/include/net/xdp_sock.h
> > +++ b/include/net/xdp_sock.h
> > @@ -30,6 +30,7 @@ struct xdp_umem {
> >         struct user_struct *user;
> >         refcount_t users;
> >         u8 flags;
> > +       u8 tx_metadata_len;
> >         bool zc;
> >         struct page **pgs;
> >         int id;
> > diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
> > index b0bdff26fc88..1985ffaf9b0c 100644
> > --- a/include/net/xsk_buff_pool.h
> > +++ b/include/net/xsk_buff_pool.h
> > @@ -77,6 +77,7 @@ struct xsk_buff_pool {
> >         u32 chunk_size;
> >         u32 chunk_shift;
> >         u32 frame_len;
> > +       u8 tx_metadata_len; /* inherited from umem */
> >         u8 cached_need_wakeup;
> >         bool uses_need_wakeup;
> >         bool dma_need_sync;
> > diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h
> > index 8d48863472b9..2ecf79282c26 100644
> > --- a/include/uapi/linux/if_xdp.h
> > +++ b/include/uapi/linux/if_xdp.h
> > @@ -76,6 +76,7 @@ struct xdp_umem_reg {
> >         __u32 chunk_size;
> >         __u32 headroom;
> >         __u32 flags;
> > +       __u32 tx_metadata_len;
> >  };
> >
> >  struct xdp_statistics {
> > diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
> > index 06cead2b8e34..333f3d53aad4 100644
> > --- a/net/xdp/xdp_umem.c
> > +++ b/net/xdp/xdp_umem.c
> > @@ -199,6 +199,9 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
> >         if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
> >                 return -EINVAL;
> >
> > +       if (mr->tx_metadata_len > 256 || mr->tx_metadata_len % 4)
> > +               return -EINVAL;
> 
> Should be >= 256 since the final internal destination is a u8 and the
> documentation says "should be less than 256 bytes".

Thanks, will fix.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ