lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 7 Dec 2009 15:42:24 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Al Viro <viro@....linux.org.uk>, linux-arch@...r.kernel.org,
	torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
	Linux/m68k <linux-m68k@...r.kernel.org>
Subject: Re: [PATCH 13/19] Unify sys_mmap*

On Mon, Dec 07, 2009 at 09:32:05AM +0100, Geert Uytterhoeven wrote:
> On Mon, Dec 7, 2009 at 04:54, Al Viro <viro@....linux.org.uk> wrote:

> > ??asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
> > ?? ?? ?? ??unsigned long prot, unsigned long flags,
> > ?? ?? ?? ??unsigned long fd, unsigned long pgoff)
> > ??{
> > - ?? ?? ?? return do_mmap2(addr, len, prot, flags, fd, pgoff);
> > + ?? ?? ?? /* this is wrong for sun3, BTW */
> 
> Can you please add the why part to the comment?
> Thanks!

Try libc mmap64() with e.g. 65536 as the last argument.  On mac and sun3.
Compare the results...

Basically, sun3 has larger pages and forgets to compensate.  Corresponding
part in libc (actual libc6 m68k binary) is
	movel %d6,%d2
	moveq #20,%d0
	lsll %d0,%d2
	movel %d7,%d1
	moveq #12,%d3
	lsrl %d3,%d1
	orl %d2,%d1
	moveal %d1,%a0		/* a0 = d6d7 >> 12 */
	movel %a3,%d5
	movel %a4,%d4
	movel %a5,%d3
	movel %a2,%d2
	%fp@(8),%d1
 	moveq #63,%d0
	notb %d0		/* 256 ^ 63, i.e. 192, i.e. __NR_mmap2 */
	trap #0

It does the last argument of mmap2 in 4Kb units (as on almost all
targets; ia64 is the exception, but it's actually not used by libc -
they have mmap64 aliased to mmap and using sys_mmap, not sys_mmap2).

So sun3 ought to shift the argument down by 1 before passing it to
do_mmap_pgoff() (or sys_mmap_pgoff() with these patches) - mm/mmap.c
stuff really expects the argument in PAGE_SIZE units.

Generally I'd agree that existing behaviour is a part of ABI, however
weird it might be, but since it's actually wrong for the only libc user
of the syscall *and* differs from the behaviour on other subarchitectures...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ