From: Alexei Starovoitov
Date: Sun, 29 Nov 2015 16:59:35 -0800
> From: Alexei Starovoitov
>
> For large map->value_size the user space can trigger memory allocation
> warnings like:
...
> To avoid never succeeding kmalloc with order >= MAX_ORDER check that
> elem->value_size and computed elem
On Mon, Nov 30, 2015 at 11:16:46PM +0100, Daniel Borkmann wrote:
>
> So, when creating a sufficiently large map where map->key_size +
> map->value_size
> would be > MAX_BPF_STACK (but map->key_size still <= MAX_BPF_STACK), we can
> only
> read the map from an eBPF program, but not update it. In
On 11/30/2015 07:13 PM, Alexei Starovoitov wrote:
On Mon, Nov 30, 2015 at 03:34:35PM +0100, Daniel Borkmann wrote:
diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
index 3f4c99e06c6b..b1e53b79c586 100644
--- a/kernel/bpf/arraymap.c
+++ b/kernel/bpf/arraymap.c
@@ -28,11 +28,17 @@ static
On Mon, Nov 30, 2015 at 03:34:35PM +0100, Daniel Borkmann wrote:
> >>diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
> >>index 3f4c99e06c6b..b1e53b79c586 100644
> >>--- a/kernel/bpf/arraymap.c
> >>+++ b/kernel/bpf/arraymap.c
> >>@@ -28,11 +28,17 @@ static struct bpf_map *array_map_alloc(
On 11/30/2015 02:52 PM, Daniel Borkmann wrote:
On 11/30/2015 01:59 AM, Alexei Starovoitov wrote:
[...]
For large map->value_size the user space can trigger memory allocation warnings
like:
[...]
To avoid never succeeding kmalloc with order >= MAX_ORDER check that
elem->value_size and compute
On Mon, Nov 30, 2015 at 3:13 PM, Daniel Borkmann wrote:
> On 11/30/2015 02:57 PM, Dmitry Vyukov wrote:
> ...
>>
>> kamlloc produces a WARNING if you try to allocate more than it ever
>> possibly can (KMALLOC_SHIFT_MAX).
>
>
> Sure, I understand that.
>
> The kzalloc() in array_map_alloc() is howev
On 11/30/2015 02:57 PM, Dmitry Vyukov wrote:
...
kamlloc produces a WARNING if you try to allocate more than it ever
possibly can (KMALLOC_SHIFT_MAX).
Sure, I understand that.
The kzalloc() in array_map_alloc() is however with __GFP_NOWARN flag already.
The warning only triggers in mm if:
W
On Mon, Nov 30, 2015 at 2:52 PM, Daniel Borkmann wrote:
> On 11/30/2015 01:59 AM, Alexei Starovoitov wrote:
> [...]
>>
>> For large map->value_size the user space can trigger memory allocation
>> warnings like:
>
> [...]
>
>> To avoid never succeeding kmalloc with order >= MAX_ORDER check that
>>
On 11/30/2015 01:59 AM, Alexei Starovoitov wrote:
[...]
For large map->value_size the user space can trigger memory allocation warnings
like:
[...]
To avoid never succeeding kmalloc with order >= MAX_ORDER check that
elem->value_size and computed elem_size are within limits for both hash and