[PATCH v6 13/25] powerpc: Remove direct call to mmap2 syscall handlers

Arnd Bergmann arnd at arndb.de
Wed Sep 28 23:00:50 AEST 2022


On Wed, Sep 28, 2022, at 2:15 PM, Michael Ellerman wrote:

> But I think it makes more sense to do the same as mmap2() and pass the
> 4K offset through, and pass shift = PAGE_SHIFT - 12. I also borrowed the
> "off_4k" name from arm64. End result:
>
> #ifdef CONFIG_COMPAT
> COMPAT_SYSCALL_DEFINE6(mmap2,
> 		       unsigned long, addr, size_t, len,
> 		       unsigned long, prot, unsigned long, flags,
> 		       unsigned long, fd, unsigned long, off_4k)
> {
> 	return do_mmap2(addr, len, prot, flags, fd, off_4k, PAGE_SHIFT-12);
> }
> #endif
>
> With that my G5 boots again :)

Any chance we can instead add a working compat_sys_mmap2/sys_mmap2
in mm/mmap.c alongside the sys_mmap_pgoff implementation?

While sys_mmap_pgoff() was meant to replace the various sys_mmap2()
implementations, I think it was ultimately a mistake, and we later
converged on the sys_mmap2() calling conventions with 12 bits
offset for almost all 32-bit architectures.

   Arnd


More information about the Linuxppc-dev mailing list