Paul Chaignon
d71962f3e6
bpf: allow map helpers access to map values directly
...
Helpers that expect ARG_PTR_TO_MAP_KEY and ARG_PTR_TO_MAP_VALUE can only
access stack and packet memory. Allow these helpers to directly access
map values by passing registers of type PTR_TO_MAP_VALUE.
This change removes the need for an extra copy to the stack when using a
map value to perform a second map lookup, as in the following:
struct bpf_map_def SEC("maps") infobyreq = {
.type = BPF_MAP_TYPE_HASHMAP,
.key_size = sizeof(struct request *),
.value_size = sizeof(struct info_t),
.max_entries = 1024,
};
struct bpf_map_def SEC("maps") counts = {
.type = BPF_MAP_TYPE_HASHMAP,
.key_size = sizeof(struct info_t),
.value_size = sizeof(u64),
.max_entries = 1024,
};
SEC("kprobe/blk_account_io_start")
int bpf_blk_account_io_start(struct pt_regs *ctx)
{
struct info_t *info = bpf_map_lookup_elem(&infobyreq, &ctx->di);
u64 *count = bpf_map_lookup_elem(&counts, info);
(*count)++;
}
Signed-off-by: Paul Chaignon <paul.chaignon@orange.com >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
2018-04-24 22:39:13 +02:00
..
2018-04-24 22:39:13 +02:00
2018-04-03 18:00:13 -07:00
2018-02-10 13:16:35 -08:00
2018-04-12 10:21:19 -07:00
2018-04-12 09:55:50 +02:00
2017-11-02 11:10:55 +01:00
2018-04-06 12:19:51 +02:00
2018-04-17 13:42:48 +02:00
2018-03-31 07:30:50 +02:00
2018-04-09 13:49:40 +02:00
2018-04-10 11:27:30 -07:00
2018-02-23 15:15:41 -08:00
2018-04-15 12:43:30 -07:00
2018-04-15 16:12:35 -07:00
2018-04-15 12:36:31 -07:00
2018-01-04 16:45:09 -08:00
2018-02-06 18:32:44 -08:00
2017-05-03 11:05:15 -07:00
2018-02-23 11:22:22 -05:00
2017-08-16 16:48:34 -07:00
2018-04-06 15:01:25 -07:00
2018-02-23 11:22:22 -05:00
2018-02-15 14:36:29 -05:00
2018-02-15 14:40:25 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-02 20:15:32 +02:00
2016-12-24 11:46:01 -08:00
2017-07-31 13:09:49 +02:00
2018-03-15 20:34:40 +01:00
2018-04-13 17:10:27 -07:00
2017-05-18 10:30:19 -06:00
2018-01-16 03:29:36 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-22 14:28:50 -05:00
2018-04-02 20:14:51 +02:00
2018-02-21 16:54:06 +01:00
2018-03-12 16:16:00 +01:00
2018-04-05 21:36:27 -07:00
2016-07-28 16:07:41 -07:00
2017-11-02 11:10:55 +01:00
2018-02-06 18:32:46 -08:00
2017-12-14 16:00:49 -08:00
2017-05-08 17:15:10 -07:00
2018-01-08 19:43:15 +01:00
2018-03-20 08:57:17 +01:00
2018-02-01 13:36:15 -08:00
2017-11-02 11:10:55 +01:00
2016-10-25 11:31:51 +02:00
2018-02-06 18:32:46 -08:00
2017-07-18 11:38:04 +02:00
2018-04-13 17:10:28 -07:00
2017-11-02 11:10:55 +01:00
2018-04-02 20:15:01 +02:00
2017-09-08 18:26:51 -07:00
2018-02-16 09:12:58 +01:00
2017-07-12 16:25:59 -07:00
2017-11-21 16:35:54 -08:00
2017-03-02 08:42:39 +01:00
2018-01-12 17:33:38 -08:00
2018-03-06 10:58:54 -08:00
2016-04-11 22:43:43 +01:00
2018-04-02 20:20:12 -07:00
2017-02-24 17:46:56 -08:00
2017-03-13 15:57:41 -03:00
2018-01-05 18:43:00 +11:00
2018-04-11 10:28:35 -07:00
2018-04-11 10:28:37 -07:00
2018-04-03 19:15:32 -07:00
2018-04-11 10:28:39 -07:00
2017-03-02 08:42:39 +01:00
2018-02-06 18:32:46 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 16:10:04 -08:00
2018-02-21 15:35:43 -08:00
2018-04-13 17:10:27 -07:00
2018-02-22 10:50:24 -08:00
2018-04-07 11:11:41 -07:00
2017-11-08 11:13:50 +01:00
2017-10-04 10:53:54 +02:00
2017-11-02 11:10:55 +01:00
2018-03-09 11:50:55 +01:00
2017-03-08 09:18:02 +01:00
2017-05-26 10:10:36 +02:00
2018-04-05 16:59:38 +02:00
2018-04-02 20:16:06 +02:00
2017-11-02 11:10:55 +01:00
2018-04-11 10:28:38 -07:00
2017-12-17 13:57:15 +01:00
2018-02-06 18:32:46 -08:00
2017-10-20 11:02:54 +02:00
2017-12-11 09:18:30 -08:00
2017-12-04 10:52:56 -08:00
2017-03-02 08:42:39 +01:00
2018-04-05 21:36:27 -07:00
2018-04-02 20:15:59 +02:00
2018-04-02 20:15:30 +02:00
2018-04-02 20:14:51 +02:00
2017-08-29 15:14:38 +02:00
2017-11-16 12:20:15 -08:00
2018-02-22 10:21:02 -08:00
2017-03-03 01:45:36 +01:00
2018-04-11 10:28:35 -07:00
2017-11-04 08:53:04 +01:00
2017-11-08 10:17:15 +01:00
2017-11-06 12:26:49 -08:00
2018-04-03 18:00:13 -07:00