Commit f89271f0 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files
Daniel Borkmann says:

====================
pull-request: bpf-next 2021-04-28

The main changes are:

1) Add link detach and following re-attach for trampolines, from Jiri Olsa.

2) Use kernel's "binary printf" lib for formatted output BPF helpers (which
   avoids the needs for variadic argument handling), from Florent Revest.

3) Fix verifier 64 to 32 bit min/max bound propagation, from Daniel Borkmann.

4) Convert cpumap to use netif_receive_skb_list(), from Lorenzo Bianconi.

5) Add generic batched-ops support to percpu array map, from Pedro Tammela.

6) Various CO-RE relocation BPF selftests fixes, from Andrii Nakryiko.

7) Misc doc rst fixes, from Hengqi Chen.

* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next:
  bpf, selftests: Update array map tests for per-cpu batched ops
  bpf: Add batched ops support for percpu array
  bpf: Implement formatted output helpers with bstr_printf
  seq_file: Add a seq_bprintf function
  bpf, docs: Fix literal block for example code
  bpf, cpumap: Bulk skb using netif_receive_skb_list
  bpf: Fix propagation of 32 bit unsigned bounds from 64 bit bounds
  bpf: Lock bpf_trace_printk's tmp buf before it is written to
  selftests/bpf: Fix core_reloc test runner
  selftests/bpf: Fix field existence CO-RE reloc tests
  selftests/bpf: Fix BPF_CORE_READ_BITFIELD() macro
  libbpf: Support BTF_KIND_FLOAT during type compatibility checks in CO-RE
  selftests/bpf: Add remaining ASSERT_xxx() variants
  selftests/bpf: Use ASSERT macros in lsm test
  selftests/bpf: Test that module can't be unloaded with attached trampoline
  selftests/bpf: Add re-attach test to lsm test
  selftests/bpf: Add re-attach test to fexit_test
  selftests/bpf: Add re-attach test to fentry_test
  bpf: Allow trampoline re-attach for tracing and lsm programs
====================

Link: https://lore.kernel.org/r/20210427233740.22238-1-daniel@iogearbox.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 99ba0ea6 3733bfbb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ Examples for low-level BPF:
  ret #-1
  drop: ret #0

**icmp random packet sampling, 1 in 4**:
**icmp random packet sampling, 1 in 4**::

  ldh [12]
  jne #0x800, drop
+18 −0
Original line number Diff line number Diff line
@@ -412,6 +412,24 @@ void seq_printf(struct seq_file *m, const char *f, ...)
}
EXPORT_SYMBOL(seq_printf);

#ifdef CONFIG_BINARY_PRINTF
void seq_bprintf(struct seq_file *m, const char *f, const u32 *binary)
{
	int len;

	if (m->count < m->size) {
		len = bstr_printf(m->buf + m->count, m->size - m->count, f,
				  binary);
		if (m->count + len < m->size) {
			m->count += len;
			return;
		}
	}
	seq_set_overflow(m);
}
EXPORT_SYMBOL(seq_bprintf);
#endif /* CONFIG_BINARY_PRINTF */

/**
 *	mangle_path -	mangle and copy path to buffer beginning
 *	@s: buffer start
+3 −19
Original line number Diff line number Diff line
@@ -2081,24 +2081,8 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
struct btf_id_set;
bool btf_id_set_contains(const struct btf_id_set *set, u32 id);

enum bpf_printf_mod_type {
	BPF_PRINTF_INT,
	BPF_PRINTF_LONG,
	BPF_PRINTF_LONG_LONG,
};

/* Workaround for getting va_list handling working with different argument type
 * combinations generically for 32 and 64 bit archs.
 */
#define BPF_CAST_FMT_ARG(arg_nb, args, mod)				\
	(mod[arg_nb] == BPF_PRINTF_LONG_LONG ||				\
	 (mod[arg_nb] == BPF_PRINTF_LONG && __BITS_PER_LONG == 64)	\
	  ? (u64)args[arg_nb]						\
	  : (u32)args[arg_nb])

int bpf_printf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args,
		       u64 *final_args, enum bpf_printf_mod_type *mod,
		       u32 num_args);
void bpf_printf_cleanup(void);
int bpf_bprintf_prepare(char *fmt, u32 fmt_size, const u64 *raw_args,
			u32 **bin_buf, u32 num_args);
void bpf_bprintf_cleanup(void);

#endif /* _LINUX_BPF_H */
+4 −0
Original line number Diff line number Diff line
@@ -146,6 +146,10 @@ void *__seq_open_private(struct file *, const struct seq_operations *, int);
int seq_open_private(struct file *, const struct seq_operations *, int);
int seq_release_private(struct inode *, struct file *);

#ifdef CONFIG_BINARY_PRINTF
void seq_bprintf(struct seq_file *m, const char *f, const u32 *binary);
#endif

#define DEFINE_SEQ_ATTRIBUTE(__name)					\
static int __name ## _open(struct inode *inode, struct file *file)	\
{									\
+1 −0
Original line number Diff line number Diff line
@@ -1708,6 +1708,7 @@ config BPF_SYSCALL
	select BPF
	select IRQ_WORK
	select TASKS_TRACE_RCU
	select BINARY_PRINTF
	select NET_SOCK_MSG if INET
	default n
	help
Loading