[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJO+LYbUmOc71jzxpHsmUXoOw0kU7393m74J2iy1u2hCA@mail.gmail.com>
Date: Thu, 2 Apr 2020 19:46:19 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: KP Singh <kpsingh@...omium.org>
Cc: LKML <linux-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH bpf] bpf, lsm: Fix the file_mprotect LSM test.
On Thu, Apr 2, 2020 at 1:07 PM KP Singh <kpsingh@...omium.org> wrote:
>
> From: KP Singh <kpsingh@...gle.com>
>
> The test was previously using an mprotect on the heap memory allocated
> using malloc and was expecting the allocation to be always using
> sbrk(2). This is, however, not always true and in certain conditions
> malloc may end up using anonymous mmaps for heap alloctions. This means
> that the following condition that is used in the "lsm/file_mprotect"
> program is not sufficent to detect all mprotect calls done on heap
> memory:
>
> is_heap = (vma->vm_start >= vma->vm_mm->start_brk &&
> vma->vm_end <= vma->vm_mm->brk);
>
> The test is updated to use an mprotect on memory allocated on the stack.
> While this would result in the splitting of the vma, this happens only
> after the security_file_mprotect hook. So, the condition used in the BPF
> program holds true.
>
> Signed-off-by: KP Singh <kpsingh@...gle.com>
> Reported-by: Alexei Starovoitov <ast@...nel.org>
> Fixes: 03e54f100d57 ("bpf: lsm: Add selftests for BPF_PROG_TYPE_LSM")
Applied. Thanks
Powered by blists - more mailing lists