Re: [PATCH bpf-next] bpf: fail mmap without CONFIG_MMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 23, 2019 at 12:56:28PM -0800, Andrii Nakryiko wrote:
> mmap() support for BPF array depends on vmalloc_user_node_flags, which is
> available only on CONFIG_MMU configurations. Fail mmap-able allocations if no
> CONFIG_MMU is set.
> 
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Reported-by: kbuild test robot <lkp@xxxxxxxxx>
> Signed-off-by: Andrii Nakryiko <andriin@xxxxxx>
> ---
>  kernel/bpf/syscall.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index bb002f15b32a..242a06fbdf18 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -156,8 +156,12 @@ static void *__bpf_map_area_alloc(u64 size, int numa_node, bool mmapable)
>  	}
>  	if (mmapable) {
>  		BUG_ON(!PAGE_ALIGNED(size));
> +#ifndef CONFIG_MMU
> +		return NULL;
> +#else
>  		return vmalloc_user_node_flags(size, numa_node, GFP_KERNEL |
>  					       __GFP_RETRY_MAYFAIL | flags);
> +#endif

Typically such ifdef goes into .h. There are several examples of such
!CONFIG_MMU in vmalloc.h. May be move it there?




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux