Re: [PATCH v2] mm/gup: Allow real explicit breaking of COW

From: Linus Torvalds
Date: Mon Aug 10 2020 - 17:00:06 EST


On Mon, Aug 10, 2020 at 1:51 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> See? That's the whole point. It doesn't _matter_ if you're only
> reading the data, without the COW you may be reading the _wrong_ data.

Example safe users:

- if you hold the mmap_sem the whole time, you're fine

- if you only look up the page mapping for some tracing reasons, you're fine

- if you can explain some other reason why you don't care that some
other process might be changing the data from under you, you might be
fine.

But the point is, you need to _explain_ it. Not just say "I don't want COW".

Linus