mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
7bd509e311
When loading a BPF program via bpf(2), calculate the digest over the program's instruction stream and store it in struct bpf_prog's digest member. This is done at a point in time before any instructions are rewritten by the verifier. Any unstable map file descriptor number part of the imm field will be zeroed for the hash. fdinfo example output for progs: # cat /proc/1590/fdinfo/5 pos: 0 flags: 02000002 mnt_id: 11 prog_type: 1 prog_jited: 1 prog_digest: b27e8b06da22707513aa97363dfb11c7c3675d28 memlock: 4096 When programs are pinned and retrieved by an ELF loader, the loader can check the program's digest through fdinfo and compare it against one that was generated over the ELF file's program section to see if the program needs to be reloaded. Furthermore, this can also be exposed through other means such as netlink in case of a tc cls/act dump (or xdp in future), but also through tracepoints or other facilities to identify the program. Other than that, the digest can also serve as a base name for the work in progress kallsyms support of programs. The digest doesn't depend/select the crypto layer, since we need to keep dependencies to a minimum. iproute2 will get support for this facility. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
36 lines
710 B
C
36 lines
710 B
C
/*
|
|
* Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef __LINUX_TC_BPF_H
|
|
#define __LINUX_TC_BPF_H
|
|
|
|
#include <linux/pkt_cls.h>
|
|
|
|
#define TCA_ACT_BPF 13
|
|
|
|
struct tc_act_bpf {
|
|
tc_gen;
|
|
};
|
|
|
|
enum {
|
|
TCA_ACT_BPF_UNSPEC,
|
|
TCA_ACT_BPF_TM,
|
|
TCA_ACT_BPF_PARMS,
|
|
TCA_ACT_BPF_OPS_LEN,
|
|
TCA_ACT_BPF_OPS,
|
|
TCA_ACT_BPF_FD,
|
|
TCA_ACT_BPF_NAME,
|
|
TCA_ACT_BPF_PAD,
|
|
TCA_ACT_BPF_DIGEST,
|
|
__TCA_ACT_BPF_MAX,
|
|
};
|
|
#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)
|
|
|
|
#endif
|