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] [day] [month] [year] [list]
Date:	Tue, 10 Apr 2012 03:35:49 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Hugh Dickins <hughd@...gle.com>
Cc:	Konstantin Khlebnikov <khlebnikov@...nvz.org>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, Roland Dreier <roland@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH RFC] mm: account VMA before forced-COW via /proc/pid/mem

On 04/09, Hugh Dickins wrote:
>
> Let me reiterate here that I was off at a tangent in bringing this up,
> so sorry for any confusion I spread.

I guess it was me who added the confusion ;)

> > OTOH, if the file was opened without FMODE_WRITE, then I do not
> > really understand how (PROT_READ, MAP_SHARED) differs from
> > (PROT_READ, MAP_PRIVATE).

I meant, from gup(FOLL_FORCE|FOLL_WRITE) pov. I didn't mean mprotect/etc.

> The strange weird confusing part is that having checked that you have
> permission to write to the file, it then avoids doing so (unless the
> area currently has PROT_WRITE): it COWs pages for you instead,
> leaving unexpected anon pages in the shared area.

Yes, and we could do the same in (PROT_READ, MAP_SHARED) case.

This is what looks strange to me. We require PROT_WRITE to force-
cow, although we are not going (and shouldn't) write to the file.


But, to avoid even more confusion, I am not arguing with your
"limit the damage by making GUP write,force fail in that case"
suggestion. At least I do not think ptrace/gdb can suffer.

> > Speaking of the difference above, I'd wish I could understand
> > what VM_MAYSHARE actually means except "MAP_SHARED was used".
>
> That's precisely it: so it's very useful in /proc/pid/maps, for
> deciding whether to show an 's' or a 'p', but not so often when
> real decisions are made (where, as you've observed, private readonly
> and shared readonly are treated very similarly, without VM_SHARED).

Aha, thanks a lot.

Oleg.

--
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