linux/arch/arc/include/asm
Lorenzo Stoakes (Oracle) 3a6455d56b mm: convert do_brk_flags() to use vma_flags_t
In order to be able to do this, we need to change VM_DATA_DEFAULT_FLAGS
and friends and update the architecture-specific definitions also.

We then have to update some KSM logic to handle VMA flags, and introduce
VMA_STACK_FLAGS to define the vma_flags_t equivalent of VM_STACK_FLAGS.

We also introduce two helper functions for use during the time we are
converting legacy flags to vma_flags_t values - vma_flags_to_legacy() and
legacy_to_vma_flags().

This enables us to iteratively make changes to break these changes up into
separate parts.

We use these explicitly here to keep VM_STACK_FLAGS around for certain
users which need to maintain the legacy vm_flags_t values for the time
being.

We are no longer able to rely on the simple VM_xxx being set to zero if
the feature is not enabled, so in the case of VM_DROPPABLE we introduce
VMA_DROPPABLE as the vma_flags_t equivalent, which is set to
EMPTY_VMA_FLAGS if the droppable flag is not available.

While we're here, we make the description of do_brk_flags() into a kdoc
comment, as it almost was already.

We use vma_flags_to_legacy() to not need to update the vm_get_page_prot()
logic as this time.

Note that in create_init_stack_vma() we have to replace the BUILD_BUG_ON()
with a VM_WARN_ON_ONCE() as the tested values are no longer build time
available.

We also update mprotect_fixup() to use VMA flags where possible, though we
have to live with a little duplication between vm_flags_t and vma_flags_t
values for the time being until further conversions are made.

While we're here, update VM_SPECIAL to be defined in terms of
VMA_SPECIAL_FLAGS now we have vma_flags_to_legacy().

Finally, we update the VMA tests to reflect these changes.

Link: https://lkml.kernel.org/r/d02e3e45d9a33d7904b149f5604904089fd640ae.1774034900.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Acked-by: Paul Moore <paul@paul-moore.com>	[SELinux]
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: "Borislav Petkov (AMD)" <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kees Cook <kees@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Ondrej Mosnacek <omosnace@redhat.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Richard Weinberger <richard@nod.at>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Will Deacon <will@kernel.org>
Cc: xu xin <xu.xin16@zte.com.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2026-04-05 13:53:40 -07:00
..
arcregs.h mm: replace (20 - PAGE_SHIFT) with common macros for pages<->MB conversion 2025-09-13 16:54:42 -07:00
asm-offsets.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
asserts.h ARC: allow userspace DSP applications to use AGU extensions 2020-03-16 10:30:49 -07:00
atomic-llsc.h ARC: atomics: Add compiler barrier to atomic operations... 2023-08-15 17:27:26 -07:00
atomic-spinlock.h locking/atomic: arc: add preprocessor symbols 2023-06-05 09:57:14 +02:00
atomic.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
atomic64-arcv2.h ARC: atomics: Implement arch_atomic64_cmpxchg using _relaxed 2025-06-09 09:18:12 -07:00
barrier.h ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
bitops.h arc: Fix __fls() const-foldability via __builtin_clzl() 2025-09-02 19:30:51 -04:00
bug.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
cache.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
cacheflush.h percpu: 2024-01-18 15:01:28 -08:00
cachetype.h mm: introduce cpu_icache_is_aliasing() across all architectures 2024-12-18 19:04:43 -08:00
checksum.h arc: Prefer unsigned int to bare use of unsigned 2021-08-03 18:58:33 -07:00
cmpxchg.h ARC: build: Use __force to suppress per-CPU cmpxchg warnings 2024-12-10 10:12:56 -08:00
current.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
delay.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
disasm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
dma.h PCI: Move isa_dma_bridge_buggy out of asm/dma.h 2022-07-22 17:24:47 -05:00
dsp-impl.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
dsp.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
dwarf.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
elf.h ARC: elf: use right ELF_ARCH 2020-06-16 12:56:37 -07:00
entry-arcv2.h ARC: entry: SAVE_ABI_CALLEE_REG: ISA/ABI specific helper 2023-12-08 16:30:24 -08:00
entry-compact.h ARC: Fix typos 2024-04-01 18:40:39 -07:00
entry.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
exec.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
fpu.h ARC: fpu: fix randconfig build error reported by 0-day test service 2020-02-09 22:17:22 -08:00
futex.h futex: arch_futex_atomic_op_inuser() calling conventions change 2020-03-27 23:58:51 -04:00
highmem.h arc/mm/highmem: Use generic kmap atomic implementation 2020-11-06 23:14:55 +01:00
hugepage.h arch: remove mk_pmd() 2025-05-11 17:48:04 -07:00
io.h asm-generic: provide generic page_to_phys and phys_to_page implementations 2024-10-28 21:44:28 +00:00
irq.h ARC: Fix typos 2024-04-01 18:40:39 -07:00
irqflags-arcv2.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
irqflags-compact.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
irqflags.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
jump_label.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
Kbuild asm-generic: introduce text-patching.h 2024-11-07 14:25:15 -08:00
kdebug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
kgdb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
kprobes.h kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
linkage.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
mach_desc.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
mmu_context.h ARC: Fix typos 2024-04-01 18:40:39 -07:00
mmu-arcv2.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
mmu.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
module.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
page.h mm: convert do_brk_flags() to use vma_flags_t 2026-04-05 13:53:40 -07:00
pci.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
perf_event.h ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type 2022-04-26 09:35:28 -07:00
pgalloc.h asm-generic: pgalloc: provide generic __pgd_{alloc,free} 2025-01-25 20:22:24 -08:00
pgtable-bits-arcv2.h ARC fixes for 6.16 2025-06-12 08:17:56 -07:00
pgtable-levels.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
pgtable.h arch, mm: consolidate empty_zero_page 2026-04-05 13:53:01 -07:00
processor.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
ptrace.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
sections.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
serial.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
setup.h ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA 2023-08-17 20:31:59 -07:00
shmparam.h ARC: Fix typos 2024-04-01 18:40:39 -07:00
smp.h ARC: Fix typos 2024-04-01 18:40:39 -07:00
spinlock_types.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
spinlock.h ARC: [plat-eznps]: Drop support for EZChip NPS platform 2020-10-05 21:02:29 -07:00
stacktrace.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
string.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
switch_to.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
syscall.h syscall.h: introduce syscall_set_nr() 2025-05-11 17:48:15 -07:00
syscalls.h ARC: wireup clone3 syscall 2020-01-15 16:08:12 -08:00
thread_info.h ARC: Replace __ASSEMBLY__ with __ASSEMBLER__ in the non-uapi headers 2025-06-09 09:18:12 -07:00
timex.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tlb.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tlbflush.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
uaccess.h ARC: uaccess: elide unaliged handling if hardware supports 2023-08-17 12:40:26 -07:00
unistd.h arc: convert to generic syscall table 2024-07-10 14:23:38 +02:00
unwind.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
vermagic.h arch: split MODULE_ARCH_VERMAGIC definitions out to <asm/vermagic.h> 2020-04-23 10:50:26 +09:00
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00