Josef Bacik
484611357c
bpf: allow access into map value arrays
...
Suppose you have a map array value that is something like this
struct foo {
unsigned iter;
int array[SOME_CONSTANT];
};
You can easily insert this into an array, but you cannot modify the contents of
foo->array[] after the fact. This is because we have no way to verify we won't
go off the end of the array at verification time. This patch provides a start
for this work. We accomplish this by keeping track of a minimum and maximum
value a register could be while we're checking the code. Then at the time we
try to do an access into a MAP_VALUE we verify that the maximum offset into that
region is a valid access into that memory region. So in practice, code such as
this
unsigned index = 0;
if (foo->iter >= SOME_CONSTANT)
foo->iter = index;
else
index = foo->iter++;
foo->array[index] = bar;
would be allowed, as we can verify that index will always be between 0 and
SOME_CONSTANT-1. If you wish to use signed values you'll have to have an extra
check to make sure the index isn't less than 0, or do something like index %=
SOME_CONSTANT.
Signed-off-by: Josef Bacik <jbacik@fb.com >
Acked-by: Alexei Starovoitov <ast@kernel.org >
Signed-off-by: David S. Miller <davem@davemloft.net >
2016-09-29 01:35:35 -04:00
..
2016-09-03 12:58:42 +03:00
2016-07-28 15:32:53 +02:00
2016-08-15 15:39:09 +01:00
2016-08-09 16:43:23 +02:00
2016-07-28 09:34:47 +05:30
2016-09-03 11:33:33 -07:00
2016-09-24 08:01:27 -04:00
2016-09-12 15:52:44 -07:00
2016-09-09 12:12:14 +03:00
2016-09-12 19:59:39 +02:00
2016-08-05 09:48:22 -04:00
2016-09-07 17:46:59 -07:00
2016-07-25 11:47:52 +01:00
2016-08-12 12:32:24 -07:00
2016-09-02 22:21:34 +02:00
2016-08-04 14:19:16 -06:00
2016-08-04 14:19:16 -06:00
2016-07-26 16:19:19 -07:00
2016-07-25 16:51:49 +10:00
2016-08-16 09:16:51 -06:00
2016-09-09 12:09:24 +03:00
2016-08-04 08:50:07 -04:00
2016-08-07 14:41:02 -06:00
2016-08-07 14:41:02 -06:00
2016-08-16 09:16:51 -06:00
2016-09-29 01:35:35 -04:00
2016-09-29 01:35:35 -04:00
2016-07-26 15:03:07 -07:00
2016-09-09 12:09:24 +03:00
2016-08-11 09:41:35 -06:00
2016-08-02 17:31:41 -04:00
2016-08-22 14:05:49 -03:00
2016-08-22 14:00:51 -03:00
2016-08-12 21:49:41 -07:00
2016-07-30 11:20:02 -07:00
2016-07-28 16:07:41 -07:00
2016-08-30 10:10:21 -07:00
2016-09-05 11:50:42 +02:00
2016-08-02 16:11:27 -04:00
2016-07-21 14:46:08 +02:00
2016-09-14 15:31:53 +02:00
2016-07-21 23:29:38 +02:00
2016-08-02 19:35:24 -04:00
2016-07-26 16:19:19 -07:00
2016-08-07 10:01:14 -04:00
2016-07-26 16:19:19 -07:00
2016-07-28 17:38:16 -07:00
2016-08-04 08:50:07 -04:00
2016-08-04 08:50:07 -04:00
2016-08-04 08:50:07 -04:00
2016-09-05 12:32:28 +01:00
2016-07-20 21:35:12 -06:00
2016-08-04 10:16:56 +09:30
2016-08-21 17:43:32 +02:00
2016-09-09 19:36:04 -07:00
2016-08-02 19:35:10 -04:00
2016-07-26 16:19:19 -07:00
2016-09-01 11:11:59 +02:00
2016-09-10 01:18:57 -04:00
2016-09-19 15:36:17 -07:00
2016-07-28 16:07:41 -07:00
2016-08-24 15:58:57 +02:00
2016-07-28 16:07:41 -07:00
2016-09-10 21:23:00 -07:00
2016-07-22 09:07:02 +02:00
2016-07-27 14:20:09 -07:00
2016-09-01 22:48:33 -07:00
2016-09-24 08:01:26 -04:00
2016-09-08 17:10:28 -07:00
2016-09-08 16:13:09 -07:00
2016-08-02 17:31:41 -04:00
2016-08-29 11:33:58 +10:00
2016-08-02 19:35:44 -04:00
2016-07-27 10:24:38 -05:00
2016-09-13 16:57:40 +02:00
2016-08-04 08:50:07 -04:00
2016-08-02 17:31:41 -04:00
2016-07-28 16:07:41 -07:00
2016-08-02 19:35:03 -04:00
2016-08-02 19:35:30 -04:00
2016-07-26 16:19:19 -07:00
2016-07-26 16:19:19 -07:00
2016-09-22 08:21:24 +01:00
2016-08-12 12:01:27 +02:00
2016-07-23 21:51:42 -07:00
2016-07-20 23:30:06 -04:00
2016-07-28 16:07:41 -07:00
2016-07-28 16:07:41 -07:00
2016-07-26 16:19:19 -07:00
2016-09-01 17:52:01 -07:00
2016-07-28 16:07:41 -07:00
2016-07-26 16:19:19 -07:00
2016-07-28 16:07:41 -07:00
2016-07-28 16:07:41 -07:00
2016-09-01 15:55:56 -07:00
2016-08-02 19:35:02 -04:00
2016-07-26 16:19:19 -07:00
2016-09-01 17:52:01 -07:00
2016-08-04 10:16:55 +09:30
2016-08-09 09:19:32 +02:00
2016-07-29 12:17:52 -07:00
2016-08-28 23:32:41 -04:00
2016-09-25 23:34:19 +02:00
2016-09-25 14:38:48 +02:00
2016-09-25 23:34:19 +02:00
2016-08-06 09:49:02 -04:00
2016-08-19 12:00:44 +03:00
2016-07-31 02:25:02 -07:00
2016-07-28 16:07:41 -07:00
2016-07-26 16:19:19 -07:00
2016-07-26 16:19:19 -07:00
2016-07-26 16:19:19 -07:00
2016-09-20 16:44:28 -07:00
2016-09-01 17:52:01 -07:00
2016-09-02 10:46:44 -07:00
2016-09-22 08:21:21 -04:00
2016-07-29 15:54:19 -07:00
2016-08-09 10:48:18 -07:00
2016-09-22 02:18:33 -04:00
2016-07-25 16:23:39 +02:00
2016-07-29 15:54:19 -07:00
2016-08-02 19:35:08 -04:00
2016-08-02 19:35:06 -04:00
2016-07-27 12:03:20 -07:00
2016-09-20 04:43:36 -04:00
2016-08-02 19:35:38 -04:00
2016-08-02 19:35:37 -04:00
2016-08-02 19:35:37 -04:00
2016-07-26 16:19:19 -07:00
2016-09-01 16:56:15 -07:00
2016-08-02 19:35:23 -04:00
2016-08-08 12:51:58 -07:00
2016-07-20 23:30:06 -04:00
2016-08-31 15:36:01 +02:00
2016-07-27 14:20:09 -07:00
2016-07-26 16:19:19 -07:00
2016-09-22 01:34:20 -04:00
2016-07-28 16:07:41 -07:00
2016-08-08 14:48:14 -07:00
2016-07-28 16:07:41 -07:00
2016-08-28 23:44:55 -04:00
2016-07-28 16:07:41 -07:00
2016-08-04 08:50:07 -04:00
2016-08-30 00:54:02 -04:00
2016-09-21 00:23:00 -04:00
2016-09-07 11:33:26 -07:00
2016-07-28 16:07:41 -07:00
2016-08-08 13:02:01 -07:00
2016-09-17 14:05:30 -07:00
2016-07-26 16:19:19 -07:00
2016-08-01 21:44:52 +03:00
2016-08-02 02:57:29 +03:00
2016-07-28 16:07:41 -07:00
2016-07-28 16:07:41 -07:00
2016-09-21 00:22:59 -04:00
2016-07-28 16:07:41 -07:00
2016-08-04 08:50:07 -04:00