[PATCH V2 2/4] riscv: mm: Fixup compat arch_get_mmap_end

Guo Ren guoren at kernel.org
Fri Dec 22 01:33:18 PST 2023


On Fri, Dec 22, 2023 at 5:00 PM David Laight <David.Laight at aculab.com> wrote:
>
> From: guoren at kernel.org <guoren at kernel.org>
> > Sent: 21 December 2023 15:47
> >
> > From: Guo Ren <guoren at linux.alibaba.com>
> >
> > When the task is in COMPAT mode, the arch_get_mmap_end should be 2GB,
> > not TASK_SIZE_64. The TASK_SIZE has contained is_compat_mode()
> > detection, so change the definition of STACK_TOP_MAX to TASK_SIZE
> > directly.
>
> Why 2G ?
>
> IIRC for 32-bit native x86 the limit is 3G, but in compat mode
> it is (just under) 4G.
>
> There is a special mmap option (for programs like wine) to
> limit mmap() to 2G.
The 2G address space seems enough for a small memory scenario, and I
agree the compat mode could support 4G, but it should be another
feature.

We limited our rv32 applications to under 2GB because we want to leave
more address space for the kernel side (Our s64ilp32 kernel needs
vmmap stack, kasan ...).


>
>         David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>


-- 
Best Regards
 Guo Ren



More information about the linux-riscv mailing list