cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

bpf_iter.h (3978B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/* Copyright (c) 2020 Facebook */
      3/* "undefine" structs in vmlinux.h, because we "override" them below */
      4#define bpf_iter_meta bpf_iter_meta___not_used
      5#define bpf_iter__bpf_map bpf_iter__bpf_map___not_used
      6#define bpf_iter__ipv6_route bpf_iter__ipv6_route___not_used
      7#define bpf_iter__netlink bpf_iter__netlink___not_used
      8#define bpf_iter__task bpf_iter__task___not_used
      9#define bpf_iter__task_file bpf_iter__task_file___not_used
     10#define bpf_iter__task_vma bpf_iter__task_vma___not_used
     11#define bpf_iter__tcp bpf_iter__tcp___not_used
     12#define tcp6_sock tcp6_sock___not_used
     13#define bpf_iter__udp bpf_iter__udp___not_used
     14#define udp6_sock udp6_sock___not_used
     15#define bpf_iter__unix bpf_iter__unix___not_used
     16#define bpf_iter__bpf_map_elem bpf_iter__bpf_map_elem___not_used
     17#define bpf_iter__bpf_sk_storage_map bpf_iter__bpf_sk_storage_map___not_used
     18#define bpf_iter__sockmap bpf_iter__sockmap___not_used
     19#define bpf_iter__bpf_link bpf_iter__bpf_link___not_used
     20#define btf_ptr btf_ptr___not_used
     21#define BTF_F_COMPACT BTF_F_COMPACT___not_used
     22#define BTF_F_NONAME BTF_F_NONAME___not_used
     23#define BTF_F_PTR_RAW BTF_F_PTR_RAW___not_used
     24#define BTF_F_ZERO BTF_F_ZERO___not_used
     25#include "vmlinux.h"
     26#undef bpf_iter_meta
     27#undef bpf_iter__bpf_map
     28#undef bpf_iter__ipv6_route
     29#undef bpf_iter__netlink
     30#undef bpf_iter__task
     31#undef bpf_iter__task_file
     32#undef bpf_iter__task_vma
     33#undef bpf_iter__tcp
     34#undef tcp6_sock
     35#undef bpf_iter__udp
     36#undef udp6_sock
     37#undef bpf_iter__unix
     38#undef bpf_iter__bpf_map_elem
     39#undef bpf_iter__bpf_sk_storage_map
     40#undef bpf_iter__sockmap
     41#undef bpf_iter__bpf_link
     42#undef btf_ptr
     43#undef BTF_F_COMPACT
     44#undef BTF_F_NONAME
     45#undef BTF_F_PTR_RAW
     46#undef BTF_F_ZERO
     47
     48struct bpf_iter_meta {
     49	struct seq_file *seq;
     50	__u64 session_id;
     51	__u64 seq_num;
     52} __attribute__((preserve_access_index));
     53
     54struct bpf_iter__ipv6_route {
     55	struct bpf_iter_meta *meta;
     56	struct fib6_info *rt;
     57} __attribute__((preserve_access_index));
     58
     59struct bpf_iter__netlink {
     60	struct bpf_iter_meta *meta;
     61	struct netlink_sock *sk;
     62} __attribute__((preserve_access_index));
     63
     64struct bpf_iter__task {
     65	struct bpf_iter_meta *meta;
     66	struct task_struct *task;
     67} __attribute__((preserve_access_index));
     68
     69struct bpf_iter__task_file {
     70	struct bpf_iter_meta *meta;
     71	struct task_struct *task;
     72	__u32 fd;
     73	struct file *file;
     74} __attribute__((preserve_access_index));
     75
     76struct bpf_iter__task_vma {
     77	struct bpf_iter_meta *meta;
     78	struct task_struct *task;
     79	struct vm_area_struct *vma;
     80} __attribute__((preserve_access_index));
     81
     82struct bpf_iter__bpf_map {
     83	struct bpf_iter_meta *meta;
     84	struct bpf_map *map;
     85} __attribute__((preserve_access_index));
     86
     87struct bpf_iter__tcp {
     88	struct bpf_iter_meta *meta;
     89	struct sock_common *sk_common;
     90	uid_t uid;
     91} __attribute__((preserve_access_index));
     92
     93struct tcp6_sock {
     94	struct tcp_sock	tcp;
     95	struct ipv6_pinfo inet6;
     96} __attribute__((preserve_access_index));
     97
     98struct bpf_iter__udp {
     99	struct bpf_iter_meta *meta;
    100	struct udp_sock *udp_sk;
    101	uid_t uid __attribute__((aligned(8)));
    102	int bucket __attribute__((aligned(8)));
    103} __attribute__((preserve_access_index));
    104
    105struct udp6_sock {
    106	struct udp_sock	udp;
    107	struct ipv6_pinfo inet6;
    108} __attribute__((preserve_access_index));
    109
    110struct bpf_iter__unix {
    111	struct bpf_iter_meta *meta;
    112	struct unix_sock *unix_sk;
    113	uid_t uid;
    114} __attribute__((preserve_access_index));
    115
    116struct bpf_iter__bpf_map_elem {
    117	struct bpf_iter_meta *meta;
    118	struct bpf_map *map;
    119	void *key;
    120	void *value;
    121};
    122
    123struct bpf_iter__bpf_sk_storage_map {
    124	struct bpf_iter_meta *meta;
    125	struct bpf_map *map;
    126	struct sock *sk;
    127	void *value;
    128};
    129
    130struct bpf_iter__sockmap {
    131	struct bpf_iter_meta *meta;
    132	struct bpf_map *map;
    133	void *key;
    134	struct sock *sk;
    135};
    136
    137struct bpf_iter__bpf_link {
    138	struct bpf_iter_meta *meta;
    139	struct bpf_link *link;
    140};
    141
    142struct btf_ptr {
    143	void *ptr;
    144	__u32 type_id;
    145	__u32 flags;
    146};
    147
    148enum {
    149	BTF_F_COMPACT	=	(1ULL << 0),
    150	BTF_F_NONAME	=	(1ULL << 1),
    151	BTF_F_PTR_RAW	=	(1ULL << 2),
    152	BTF_F_ZERO	=	(1ULL << 3),
    153};