Commit 31defc3
userfaultfd: remove (VM_)BUG_ON()s
BUG_ON() is deprecated [1]. Convert all the BUG_ON()s and VM_BUG_ON()s to
use VM_WARN_ON_ONCE().
There are a few additional cases that are converted or modified:
- Convert the printk(KERN_WARNING ...) in handle_userfault() to use
pr_warn().
- Convert the WARN_ON_ONCE()s in move_pages() to use VM_WARN_ON_ONCE(),
as the relevant conditions are already checked in validate_range() in
move_pages()'s caller.
- Convert the VM_WARN_ON()'s in move_pages() to VM_WARN_ON_ONCE(). These
cases should never happen and are similar to those in mfill_atomic()
and mfill_atomic_hugetlb(), which were previously BUG_ON()s.
move_pages() was added later than those functions and makes use of
VM_WARN_ON() as a replacement for the deprecated BUG_ON(), but.
VM_WARN_ON_ONCE() is likely a better direct replacement.
- Convert the WARN_ON() for !VM_MAYWRITE in userfaultfd_unregister() and
userfaultfd_register_range() to VM_WARN_ON_ONCE(). This condition is
enforced in userfaultfd_register() so it should never happen, and can
be converted to a debug check.
[1] https://www.kernel.org/doc/html/v6.15/process/coding-style.html#use-warn-rather-than-bug
Link: https://lkml.kernel.org/r/20250619-uffd-fixes-v3-3-a7274d3bd5e4@columbia.edu
Signed-off-by: Tal Zussman <tz2294@columbia.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 23ec90e commit 31defc3
2 files changed
+62
-65
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | | - | |
| 391 | + | |
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
414 | | - | |
| 414 | + | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
418 | | - | |
419 | | - | |
| 417 | + | |
| 418 | + | |
420 | 419 | | |
421 | 420 | | |
422 | 421 | | |
| |||
602 | 601 | | |
603 | 602 | | |
604 | 603 | | |
605 | | - | |
| 604 | + | |
606 | 605 | | |
607 | 606 | | |
608 | 607 | | |
| |||
710 | 709 | | |
711 | 710 | | |
712 | 711 | | |
713 | | - | |
| 712 | + | |
714 | 713 | | |
715 | 714 | | |
716 | 715 | | |
| |||
1317 | 1316 | | |
1318 | 1317 | | |
1319 | 1318 | | |
1320 | | - | |
1321 | | - | |
| 1319 | + | |
| 1320 | + | |
1322 | 1321 | | |
1323 | 1322 | | |
1324 | 1323 | | |
| |||
1372 | 1371 | | |
1373 | 1372 | | |
1374 | 1373 | | |
1375 | | - | |
| 1374 | + | |
1376 | 1375 | | |
1377 | 1376 | | |
1378 | 1377 | | |
| |||
1464 | 1463 | | |
1465 | 1464 | | |
1466 | 1465 | | |
1467 | | - | |
1468 | | - | |
| 1466 | + | |
| 1467 | + | |
1469 | 1468 | | |
1470 | 1469 | | |
1471 | 1470 | | |
| |||
1487 | 1486 | | |
1488 | 1487 | | |
1489 | 1488 | | |
1490 | | - | |
| 1489 | + | |
1491 | 1490 | | |
1492 | 1491 | | |
1493 | 1492 | | |
| |||
1504 | 1503 | | |
1505 | 1504 | | |
1506 | 1505 | | |
1507 | | - | |
| 1506 | + | |
1508 | 1507 | | |
1509 | 1508 | | |
1510 | 1509 | | |
| |||
1569 | 1568 | | |
1570 | 1569 | | |
1571 | 1570 | | |
1572 | | - | |
| 1571 | + | |
1573 | 1572 | | |
1574 | 1573 | | |
1575 | 1574 | | |
| |||
1626 | 1625 | | |
1627 | 1626 | | |
1628 | 1627 | | |
1629 | | - | |
| 1628 | + | |
1630 | 1629 | | |
1631 | 1630 | | |
1632 | 1631 | | |
| |||
1681 | 1680 | | |
1682 | 1681 | | |
1683 | 1682 | | |
1684 | | - | |
| 1683 | + | |
1685 | 1684 | | |
1686 | 1685 | | |
1687 | 1686 | | |
| |||
1793 | 1792 | | |
1794 | 1793 | | |
1795 | 1794 | | |
1796 | | - | |
| 1795 | + | |
1797 | 1796 | | |
1798 | 1797 | | |
1799 | 1798 | | |
| |||
1850 | 1849 | | |
1851 | 1850 | | |
1852 | 1851 | | |
1853 | | - | |
| 1852 | + | |
1854 | 1853 | | |
1855 | 1854 | | |
1856 | 1855 | | |
| |||
2111 | 2110 | | |
2112 | 2111 | | |
2113 | 2112 | | |
2114 | | - | |
| 2113 | + | |
2115 | 2114 | | |
2116 | 2115 | | |
2117 | 2116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
564 | | - | |
| 564 | + | |
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
| 605 | + | |
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
| 617 | + | |
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | | - | |
640 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
715 | | - | |
| 714 | + | |
| 715 | + | |
716 | 716 | | |
717 | 717 | | |
718 | | - | |
719 | | - | |
| 718 | + | |
| 719 | + | |
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| |||
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
778 | | - | |
| 778 | + | |
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
821 | | - | |
| 821 | + | |
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | | - | |
| 835 | + | |
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
855 | | - | |
856 | | - | |
857 | | - | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| |||
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
943 | | - | |
944 | | - | |
| 943 | + | |
| 944 | + | |
945 | 945 | | |
946 | 946 | | |
947 | | - | |
| 947 | + | |
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
| |||
1738 | 1738 | | |
1739 | 1739 | | |
1740 | 1740 | | |
1741 | | - | |
1742 | | - | |
1743 | | - | |
1744 | | - | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1745 | 1744 | | |
1746 | 1745 | | |
1747 | | - | |
1748 | | - | |
1749 | | - | |
| 1746 | + | |
| 1747 | + | |
1750 | 1748 | | |
1751 | 1749 | | |
1752 | 1750 | | |
| |||
1896 | 1894 | | |
1897 | 1895 | | |
1898 | 1896 | | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
1902 | 1900 | | |
1903 | 1901 | | |
1904 | 1902 | | |
| |||
1985 | 1983 | | |
1986 | 1984 | | |
1987 | 1985 | | |
1988 | | - | |
1989 | | - | |
1990 | | - | |
1991 | | - | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
1992 | 1990 | | |
1993 | 1991 | | |
1994 | 1992 | | |
| |||
2064 | 2062 | | |
2065 | 2063 | | |
2066 | 2064 | | |
2067 | | - | |
2068 | | - | |
| 2065 | + | |
| 2066 | + | |
2069 | 2067 | | |
2070 | 2068 | | |
2071 | 2069 | | |
| |||
0 commit comments