OpenCloudOS-Kernel/include/linux/sched
Christophe Leroy 5f24d5a579 mm, hugetlb: allow for "high" userspace addresses
This is a fix for commit f6795053da ("mm: mmap: Allow for "high"
userspace addresses") for hugetlb.

This patch adds support for "high" userspace addresses that are
optionally supported on the system and have to be requested via a hint
mechanism ("high" addr parameter to mmap).

Architectures such as powerpc and x86 achieve this by making changes to
their architectural versions of hugetlb_get_unmapped_area() function.
However, arm64 uses the generic version of that function.

So take into account arch_get_mmap_base() and arch_get_mmap_end() in
hugetlb_get_unmapped_area().  To allow that, move those two macros out
of mm/mmap.c into include/linux/sched/mm.h

If these macros are not defined in architectural code then they default
to (TASK_SIZE) and (base) so should not introduce any behavioural
changes to architectures that do not define them.

For the time being, only ARM64 is affected by this change.

Catalin (ARM64) said
 "We should have fixed hugetlb_get_unmapped_area() as well when we added
  support for 52-bit VA. The reason for commit f6795053da was to
  prevent normal mmap() from returning addresses above 48-bit by default
  as some user-space had hard assumptions about this.

  It's a slight ABI change if you do this for hugetlb_get_unmapped_area()
  but I doubt anyone would notice. It's more likely that the current
  behaviour would cause issues, so I'd rather have them consistent.

  Basically when arm64 gained support for 52-bit addresses we did not
  want user-space calling mmap() to suddenly get such high addresses,
  otherwise we could have inadvertently broken some programs (similar
  behaviour to x86 here). Hence we added commit f6795053da. But we
  missed hugetlbfs which could still get such high mmap() addresses. So
  in theory that's a potential regression that should have bee addressed
  at the same time as commit f6795053da (and before arm64 enabled
  52-bit addresses)"

Link: https://lkml.kernel.org/r/ab847b6edb197bffdfe189e70fb4ac76bfe79e0d.1650033747.git.christophe.leroy@csgroup.eu
Fixes: f6795053da ("mm: mmap: Allow for "high" userspace addresses")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: <stable@vger.kernel.org>	[5.0.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-04-21 20:01:09 -07:00
..
affinity.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
autogroup.h
clock.h
cond_resched.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
coredump.h
cpufreq.h
cputime.h sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full 2021-12-02 15:08:22 +01:00
deadline.h sched/headers: Make the <linux/sched/deadline.h> header build standalone 2022-02-23 10:58:33 +01:00
debug.h
hotplug.h
idle.h sched,livepatch: Use wake_up_if_idle() 2021-10-14 13:09:25 +02:00
init.h
isolation.h sched/isolation: Use single feature type while referring to housekeeping cpumask 2022-02-16 15:57:55 +01:00
jobctl.h
loadavg.h
mm.h mm, hugetlb: allow for "high" userspace addresses 2022-04-21 20:01:09 -07:00
nohz.h
numa_balancing.h
posix-timers.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
prio.h
rseq_api.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
rt.h
sd_flags.h
signal.h signal: Move set_notify_signal and clear_notify_signal into sched/signal.h 2022-03-10 16:51:50 -06:00
smt.h
stat.h
sysctl.h Merge branch 'akpm' (patches from Andrew) 2022-03-22 16:11:53 -07:00
task.h exit: Mark do_group_exit() __noreturn 2022-03-15 10:32:43 +01:00
task_flags.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
task_stack.h fork: Move task stack accounting to do_exit() 2022-02-22 22:25:02 +01:00
thread_info_api.h sched/headers: Add initial new headers as identity mappings 2022-02-23 10:58:28 +01:00
topology.h sched/fair: Adjust the allowed NUMA imbalance when SD_NUMA spans multiple LLCs 2022-02-11 23:30:08 +01:00
types.h
user.h fs/epoll: use a per-cpu counter for user's watches count 2021-09-08 11:50:27 -07:00
wake_q.h sched/wake_q: Provide WAKE_Q_HEAD_INITIALIZER() 2021-08-17 16:57:55 +02:00
xacct.h