[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202211061948.46D3F78@keescook>
Date: Sun, 6 Nov 2022 19:59:40 -0800
From: Kees Cook <keescook@...omium.org>
To: Pedro Falcato <pedro.falcato@...il.com>,
David Gow <davidgow@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, sam@...too.org,
Alexander Viro <viro@...iv.linux.org.uk>,
Eric Biederman <ebiederm@...ssion.com>,
linux-fsdevel@...r.kernel.org, Rich Felker <dalias@...c.org>,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com
Subject: Re: [PATCH] fs/binfmt_elf: Fix memsz > filesz handling
On Sun, Nov 06, 2022 at 02:16:57AM +0000, Pedro Falcato wrote:
> The old code for ELF interpreter loading could only handle
> 1 memsz > filesz segment. This is incorrect, as evidenced
> by the elf program loading code, which could handle multiple
> such segments.
>
> This patch fixes memsz > filesz handling for elf interpreters
> and refactors interpreter/program BSS clearing into a common
> codepath.
>
> This bug was uncovered on builds of ppc64le musl libc with
> llvm lld 15.0.0, since ppc64 does not allocate file space
> for its .plt.
>
> Cc: Rich Felker <dalias@...c.org>
> Signed-off-by: Pedro Falcato <pedro.falcato@...il.com>
Thanks for the patch! I need to triple-check this logic, as there have
been some overlapping (or out-of-order) LOAD bugs in the past too, and I
want to make sure we don't accidentally zero things that already got
loaded, etc.
David, has there been any work on adding a way to instantiate
userspace VMAs in a KUnit test? I tried to write this myself, but I
couldn't figure out how to make the userspace memory mappings appear.
Here's my fumbling attempt:
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/log/?h=devel/kunit/usercopy
I really wish KUnit had userspace mapping support -- I have a bunch of
unit tests that need to get built up around checking for regressions
here, etc.
Anyway, I'll test this patch and get it applied and likely backported
to earlier kernels in the next few days.
-Kees
--
Kees Cook
Powered by blists - more mailing lists