Skip to content

Commit

Permalink
Revert "mm: add arch hook to validate mmap() prot flags"
Browse files Browse the repository at this point in the history
This reverts commit cb1a393.

Since the arm64 WXN patch has been reverted, remove this hook as it
would not have any users.

Signed-off-by: Catalin Marinas <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
ctmarinas committed Mar 13, 2024
1 parent 69ebc01 commit 1ef21fc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
15 changes: 0 additions & 15 deletions include/linux/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,6 @@ static inline bool arch_validate_flags(unsigned long flags)
#define arch_validate_flags arch_validate_flags
#endif

#ifndef arch_validate_mmap_prot
/*
* This is called from mmap(), which ignores unknown prot bits so the default
* is to accept anything.
*
* Returns true if the prot flags are valid
*/
static inline bool arch_validate_mmap_prot(unsigned long prot,
unsigned long addr)
{
return true;
}
#define arch_validate_mmap_prot arch_validate_mmap_prot
#endif

/*
* Optimisation macro. It is equivalent to:
* (x & bit1) ? bit2 : 0
Expand Down
3 changes: 0 additions & 3 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,6 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
if (!(file && path_noexec(&file->f_path)))
prot |= PROT_EXEC;

if (!arch_validate_mmap_prot(prot, addr))
return -EACCES;

/* force arch specific MAP_FIXED handling in get_unmapped_area */
if (flags & MAP_FIXED_NOREPLACE)
flags |= MAP_FIXED;
Expand Down

0 comments on commit 1ef21fc

Please sign in to comment.