[PATCH v5 13/25] mm: Introduce arch_validate_flags()
Andrew Morton
akpm at linux-foundation.org
Wed Jun 24 14:37:46 EDT 2020
On Wed, 24 Jun 2020 18:52:32 +0100 Catalin Marinas <catalin.marinas at arm.com> wrote:
> Similarly to arch_validate_prot() called from do_mprotect_pkey(), an
> architecture may need to sanity-check the new vm_flags.
>
> Define a dummy function always returning true. In addition to
> do_mprotect_pkey(), also invoke it from mmap_region() prior to updating
> vma->vm_page_prot to allow the architecture code to veto potentially
> inconsistent vm_flags.
>
> ...
>
> --- a/include/linux/mman.h
> +++ b/include/linux/mman.h
> @@ -103,6 +103,19 @@ static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
> #define arch_validate_prot arch_validate_prot
> #endif
>
> +#ifndef arch_validate_flags
> +/*
> + * This is called from mmap() and mprotect() with the updated vma->vm_flags.
> + *
> + * Returns true if the VM_* flags are valid.
> + */
> +static inline bool arch_validate_flags(unsigned long flags)
> +{
> + return true;
> +}
> +#define arch_validate_flags arch_validate_flags
> +#endif
Again, please let's nail down where the arch should define this.
Otherwise, Acked-by: Andrew Morton <akpm at linux-foundation.org>
More information about the linux-arm-kernel
mailing list