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: <5e630d7c42319_5f672ade5903a5b8c5@john-XPS-13-9370.notmuch>
Date:   Fri, 06 Mar 2020 18:57:00 -0800
From:   John Fastabend <john.fastabend@...il.com>
To:     Eelco Chaudron <echaudro@...hat.com>, bpf@...r.kernel.org
Cc:     davem@...emloft.net, netdev@...r.kernel.org, ast@...nel.org,
        daniel@...earbox.net, kafai@...com, songliubraving@...com,
        yhs@...com, andriin@...com, toke@...hat.com
Subject: RE: [PATCH bpf-next] bpf: add bpf_xdp_output() helper

Eelco Chaudron wrote:
> Introduce new helper that reuses existing xdp perf_event output
> implementation, but can be called from raw_tracepoint programs
> that receive 'struct xdp_buff *' as a tracepoint argument.
> 
> Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
> ---
>  include/uapi/linux/bpf.h                           |   27 ++++++++++
>  kernel/bpf/verifier.c                              |    4 +-
>  kernel/trace/bpf_trace.c                           |    3 +
>  net/core/filter.c                                  |   16 ++++++
>  tools/include/uapi/linux/bpf.h                     |   27 ++++++++++
>  .../testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c |   53 ++++++++++++++++++++
>  .../testing/selftests/bpf/progs/test_xdp_bpf2bpf.c |   24 +++++++++
>  7 files changed, 150 insertions(+), 4 deletions(-)
> 
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 40b2d9476268..41a90e2d5821 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -2914,6 +2914,30 @@ union bpf_attr {
>   *		of sizeof(struct perf_branch_entry).
>   *
>   *		**-ENOENT** if architecture does not support branch records.
> + *
> + * int bpf_xdp_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
> + *	Description

feels a bit odd to have flags in the middle of a signature but it follows
bpf_perf_event_output() so I guess its better to have the two use the
same signature vs break it here.

> + *		Write raw *data* blob into a special BPF perf event held by
> + *		*map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
> + *		event must have the following attributes: **PERF_SAMPLE_RAW**
> + *		as **sample_type**, **PERF_TYPE_SOFTWARE** as **type**, and
> + *		**PERF_COUNT_SW_BPF_OUTPUT** as **config**.
> + *
> + *		The *flags* are used to indicate the index in *map* for which
> + *		the value must be put, masked with **BPF_F_INDEX_MASK**.
> + *		Alternatively, *flags* can be set to **BPF_F_CURRENT_CPU**
> + *		to indicate that the index of the current CPU core should be
> + *		used.
> + *
> + *		The value to write, of *size*, is passed through eBPF stack and
> + *		pointed by *data*.
> + *
> + *		*ctx* is a pointer to in-kernel struct xdp_buff.
> + *
> + *		This helper is similar to **bpf_perf_eventoutput**\ () but
> + *		restricted to raw_tracepoint bpf programs.
> + *	Return
> + *		0 on success, or a negative error in case of failure.
>   */

Otherwise,

Acked-by: John Fastabend <john.fastabend@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ