[PATCH] ARM: Remove address checking for MMUless devices

Ard Biesheuvel ardb at kernel.org
Tue Jun 11 23:43:14 PDT 2024


On Wed, 12 Jun 2024 at 03:26, Yanjun Yang <yangyj.ee at gmail.com> wrote:
>
> Hi,
> Apologies for not CCing the relevant maintainers in my previous email.
>
> On Tue, Jun 11, 2024 at 6:09 PM Yanjun Yang <yangyj.ee at gmail.com> wrote:
> >
> > Commit 169f9102f9198b ("ARM: 9350/1: fault:
> > Implement copy_from_kernel_nofault_allowed()") added the function to check
> > address before use. However, for devices without MMU, addr > TASK_SIZE
> > will always fail.

Is that true? Doesn't it depend on the physical memory layout of the
platform in question?

>  This patch move this function after the #ifdef
> > CONFIG_MMU statement.
> >
> > Also reported at https://bugzilla.kernel.org/show_bug.cgi?id=218953
> >
> > Signed-off-by: Yanjun Yang <yangyj.ee at gmail.com>

Acked-by: Ard Biesheuvel <ardb at kernel.org>

> > ---
> >  arch/arm/mm/fault.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
> > index 67c425341a95..ab01b51de559 100644
> > --- a/arch/arm/mm/fault.c
> > +++ b/arch/arm/mm/fault.c
> > @@ -25,6 +25,8 @@
> >
> >  #include "fault.h"
> >
> > +#ifdef CONFIG_MMU
> > +
> >  bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
> >  {
> >         unsigned long addr = (unsigned long)unsafe_src;
> > @@ -32,8 +34,6 @@ bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
> >         return addr >= TASK_SIZE && ULONG_MAX - addr >= size;
> >  }
> >
> > -#ifdef CONFIG_MMU
> > -
> >  /*
> >   * This is useful to dump out the page tables associated with
> >   * 'addr' in mm 'mm'.
> > --
> > 2.45.2
> >



More information about the linux-arm-kernel mailing list