Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Alexei Starovoitov says: ==================== pull-request: bpf-next 2021-07-15 The following pull-request contains BPF updates for your *net-next* tree. We've added 45 non-merge commits during the last 15 day(s) which contain a total of 52 files changed, 3122 insertions(+), 384 deletions(-). The main changes are: 1) Introduce bpf timers, from Alexei. 2) Add sockmap support for unix datagram socket, from Cong. 3) Fix potential memleak and UAF in the verifier, from He. 4) Add bpf_get_func_ip helper, from Jiri. 5) Improvements to generic XDP mode, from Kumar. 6) Support for passing xdp_md to XDP programs in bpf_prog_run, from Zvi. =================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
82a1ffe57e
52 changed files with 3127 additions and 389 deletions
|
|
@ -324,9 +324,6 @@ union bpf_iter_link_info {
|
|||
* **BPF_PROG_TYPE_SK_LOOKUP**
|
||||
* *data_in* and *data_out* must be NULL.
|
||||
*
|
||||
* **BPF_PROG_TYPE_XDP**
|
||||
* *ctx_in* and *ctx_out* must be NULL.
|
||||
*
|
||||
* **BPF_PROG_TYPE_RAW_TRACEPOINT**,
|
||||
* **BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE**
|
||||
*
|
||||
|
|
@ -3249,7 +3246,7 @@ union bpf_attr {
|
|||
* long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
|
||||
* Description
|
||||
* Select a **SO_REUSEPORT** socket from a
|
||||
* **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
|
||||
* **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*.
|
||||
* It checks the selected socket is matching the incoming
|
||||
* request in the socket buffer.
|
||||
* Return
|
||||
|
|
@ -4780,6 +4777,76 @@ union bpf_attr {
|
|||
* Execute close syscall for given FD.
|
||||
* Return
|
||||
* A syscall result.
|
||||
*
|
||||
* long bpf_timer_init(struct bpf_timer *timer, struct bpf_map *map, u64 flags)
|
||||
* Description
|
||||
* Initialize the timer.
|
||||
* First 4 bits of *flags* specify clockid.
|
||||
* Only CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_BOOTTIME are allowed.
|
||||
* All other bits of *flags* are reserved.
|
||||
* The verifier will reject the program if *timer* is not from
|
||||
* the same *map*.
|
||||
* Return
|
||||
* 0 on success.
|
||||
* **-EBUSY** if *timer* is already initialized.
|
||||
* **-EINVAL** if invalid *flags* are passed.
|
||||
* **-EPERM** if *timer* is in a map that doesn't have any user references.
|
||||
* The user space should either hold a file descriptor to a map with timers
|
||||
* or pin such map in bpffs. When map is unpinned or file descriptor is
|
||||
* closed all timers in the map will be cancelled and freed.
|
||||
*
|
||||
* long bpf_timer_set_callback(struct bpf_timer *timer, void *callback_fn)
|
||||
* Description
|
||||
* Configure the timer to call *callback_fn* static function.
|
||||
* Return
|
||||
* 0 on success.
|
||||
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
|
||||
* **-EPERM** if *timer* is in a map that doesn't have any user references.
|
||||
* The user space should either hold a file descriptor to a map with timers
|
||||
* or pin such map in bpffs. When map is unpinned or file descriptor is
|
||||
* closed all timers in the map will be cancelled and freed.
|
||||
*
|
||||
* long bpf_timer_start(struct bpf_timer *timer, u64 nsecs, u64 flags)
|
||||
* Description
|
||||
* Set timer expiration N nanoseconds from the current time. The
|
||||
* configured callback will be invoked in soft irq context on some cpu
|
||||
* and will not repeat unless another bpf_timer_start() is made.
|
||||
* In such case the next invocation can migrate to a different cpu.
|
||||
* Since struct bpf_timer is a field inside map element the map
|
||||
* owns the timer. The bpf_timer_set_callback() will increment refcnt
|
||||
* of BPF program to make sure that callback_fn code stays valid.
|
||||
* When user space reference to a map reaches zero all timers
|
||||
* in a map are cancelled and corresponding program's refcnts are
|
||||
* decremented. This is done to make sure that Ctrl-C of a user
|
||||
* process doesn't leave any timers running. If map is pinned in
|
||||
* bpffs the callback_fn can re-arm itself indefinitely.
|
||||
* bpf_map_update/delete_elem() helpers and user space sys_bpf commands
|
||||
* cancel and free the timer in the given map element.
|
||||
* The map can contain timers that invoke callback_fn-s from different
|
||||
* programs. The same callback_fn can serve different timers from
|
||||
* different maps if key/value layout matches across maps.
|
||||
* Every bpf_timer_set_callback() can have different callback_fn.
|
||||
*
|
||||
* Return
|
||||
* 0 on success.
|
||||
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
|
||||
* or invalid *flags* are passed.
|
||||
*
|
||||
* long bpf_timer_cancel(struct bpf_timer *timer)
|
||||
* Description
|
||||
* Cancel the timer and wait for callback_fn to finish if it was running.
|
||||
* Return
|
||||
* 0 if the timer was not active.
|
||||
* 1 if the timer was active.
|
||||
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
|
||||
* **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its
|
||||
* own timer which would have led to a deadlock otherwise.
|
||||
*
|
||||
* u64 bpf_get_func_ip(void *ctx)
|
||||
* Description
|
||||
* Get address of the traced function (for tracing and kprobe programs).
|
||||
* Return
|
||||
* Address of the traced function.
|
||||
*/
|
||||
#define __BPF_FUNC_MAPPER(FN) \
|
||||
FN(unspec), \
|
||||
|
|
@ -4951,6 +5018,11 @@ union bpf_attr {
|
|||
FN(sys_bpf), \
|
||||
FN(btf_find_by_name_kind), \
|
||||
FN(sys_close), \
|
||||
FN(timer_init), \
|
||||
FN(timer_set_callback), \
|
||||
FN(timer_start), \
|
||||
FN(timer_cancel), \
|
||||
FN(get_func_ip), \
|
||||
/* */
|
||||
|
||||
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
|
||||
|
|
@ -6077,6 +6149,11 @@ struct bpf_spin_lock {
|
|||
__u32 val;
|
||||
};
|
||||
|
||||
struct bpf_timer {
|
||||
__u64 :64;
|
||||
__u64 :64;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
struct bpf_sysctl {
|
||||
__u32 write; /* Sysctl is being read (= 0) or written (= 1).
|
||||
* Allows 1,2,4-byte read, but no write.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue