Re: [PATCH v1] mm/gup: fix FOLL_FORCE COW security issue and remove FOLL_COW
From: Linus Torvalds
Date: Tue Aug 09 2022 - 14:57:48 EST
I'm still reading through this, but
STOP DOING THIS
On Mon, Aug 8, 2022 at 12:32 AM David Hildenbrand <david@xxxxxxxxxx> wrote:
>
> + VM_BUG_ON(!is_cow_mapping(vma->vm_flags));
Using BUG_ON() for debugging is simply not ok.
And saying "but it's just a VM_BUG_ON()" does not change *anything*.
At least Fedora enables that unconditionally for normal people, it is
not some kind of "only VM people do this".
Really. BUG_ON() IS NOT FOR DEBUGGING.
Stop it. Now.
If you have a condition that must not happen, you either write that
condition into the code, or - if you are convinced it cannot happen -
you make it a WARN_ON_ONCE() so that people can report it to you.
The BUG_ON() will just make the machine die.
And for the facebooks and googles of the world, the WARN_ON() will be
sufficient.
Linus