mbox series

[v2,0/2] exec: Avoid pathological argc, envc, and bprm->p values

Message ID 20240621204729.it.434-kees@kernel.org (mailing list archive)
Headers show
Series exec: Avoid pathological argc, envc, and bprm->p values | expand

Message

Kees Cook June 21, 2024, 8:50 p.m. UTC
Hi,

This pair of patches replaces the last patch in this[1] series.

Perform bprm argument overflow checking but only do argmin checks for MMU
systems. To avoid tripping over this again, argmin is explicitly defined
only for CONFIG_MMU. Thank you to Guenter Roeck for finding this issue
(again)!

-Kees

[1] https://lore.kernel.org/all/20240520021337.work.198-kees@kernel.org/

Kees Cook (2):
  execve: Keep bprm->argmin behind CONFIG_MMU
  exec: Avoid pathological argc, envc, and bprm->p values

 fs/exec.c               | 36 +++++++++++++++++++++++++++++-------
 fs/exec_test.c          | 30 +++++++++++++++++++++++++++++-
 include/linux/binfmts.h |  2 +-
 3 files changed, 59 insertions(+), 9 deletions(-)

Comments

Kees Cook June 27, 2024, 7:49 p.m. UTC | #1
On Fri, Jun 21, 2024 at 02:44:05PM -0700, Guenter Roeck wrote:
> On 6/21/24 13:50, Kees Cook wrote:
> > Hi,
> > 
> > This pair of patches replaces the last patch in this[1] series.
> > 
> > Perform bprm argument overflow checking but only do argmin checks for MMU
> > systems. To avoid tripping over this again, argmin is explicitly defined
> > only for CONFIG_MMU. Thank you to Guenter Roeck for finding this issue
> > (again)!
> > 
> 
> That does make me wonder: Is anyone but me testing, much less running,
> the nommu code in the kernel ?
> 
> mps2-an385 trips over the same problem, and xtensa:nommu_kc705_defconfig
> doesn't even build in linux-next right now (spoiler alert: I suspect that
> the problem is caused by "kunit: test: Add vm_mmap() allocation resource
> manager", but I did not have time to bisect it).

This has a fixed pending:
https://lore.kernel.org/lkml/202406271005.4E767DAE@keescook/

> I am kind of tired keeping those tests alive, and I would not exactly
> shed tears if nommu support would just be dropped entirely.

I haven't ever used the nommu builds, so I don't have a useful opinion
here. :)

-Kees