Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Remove the assertion "searchdir != foundobj" from l...



details:   https://anonhg.NetBSD.org/src/rev/ef338e45ff09
branches:  trunk
changeset: 361111:ef338e45ff09
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Feb 10 10:59:12 2022 +0000

description:
Remove the assertion "searchdir != foundobj" from lookup_crossmount().

It will trigger whenever we lookup "." on a directory that becomes
mounted

    fd = open("/mnt")
    mount(..., "/mnt", ...)
    fd2 = openat(fd, ".")

or

    Unlocked searchdir gets mounted mounted on between
    lookup_fastforward()/lookup_once() and the test for
    foundobj->v_mountedhere.

May address syzkaller:

Reported-by: syzbot+9197ac681ce50f707d9a%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+eb4854df8ee3c9bc278d%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+3cc5b4126ab554f145d3%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+7eae48a3ea952efee8c8%syzkaller.appspotmail.com@localhost
Reported-by: syzbot+b7f662083ccf8be3e669%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/vfs_lookup.c |  6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r 70cff387bf45 -r ef338e45ff09 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Thu Feb 10 09:29:39 2022 +0000
+++ b/sys/kern/vfs_lookup.c     Thu Feb 10 10:59:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.230 2021/11/13 14:52:08 hannken Exp $ */
+/*     $NetBSD: vfs_lookup.c,v 1.231 2022/02/10 10:59:12 hannken Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.230 2021/11/13 14:52:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.231 2022/02/10 10:59:12 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -940,8 +940,6 @@
        while (foundobj->v_type == VDIR &&
            (mp = foundobj->v_mountedhere) != NULL &&
            (cnp->cn_flags & NOCROSSMOUNT) == 0) {
-               KASSERTMSG(searchdir != foundobj, "same vn %p", searchdir);
-
                /*
                 * Try the namecache first.  If that doesn't work, do
                 * it the hard way.



Home | Main Index | Thread Index | Old Index