On Wed, Apr 13, 2022 at 02:22:00PM -0600, Theo de Raadt wrote: > I think we should fix the bug and/or DELETE the message entirely
I don't see the bug. The message was added in the initial NetBSD uvm commit. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/uvm/uvm_vnode.c?annotate=1.1 With a major refactoring the whole function with the message disappeared in 2001. http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/uvm/uvm_vnode.c#rev1.52 If I understand correctly, the problem is that writing to memory of an mmap(2)ed file has no error handling. If the file system is full, userland cannot be informed. So someone invented this message in the kernel. What is the correct behavior? Should close(2) after munmap(2) fail? According to ktrace close returns 0 and ld exits with 0. It does not see any error although newbsd was not written correctly. This is the output when ld fails: ../GENERIC# make newbsd LD="ld" sh makegap.sh 0xcccccccc gapdummy.o ld -T ld.script -X --warn-common -nopie -o newbsd ${SYSTEM_HEAD} vers.o ${OBJS} /usr: write failed, file system is full text data bss dec hex 0 0 0 0 0 mv newbsd newbsd.gdb ctfstrip -S -o newbsd newbsd.gdb strip: there are no sections to be copied! rm -f bsd.gdb mv -f newbsd bsd mv: newbsd: No such file or directory *** Error 1 in /usr/share/relink/kernel/GENERIC (Makefile:1934 'newbsd') The "/usr: write failed, file system is full" message is printed by ffs to the controlling tty with rate limiting. So error reporting happens. Deleting uvm message is easy. While there use __func__ for easier function grepping. bluhm Index: uvm/uvm_vnode.c =================================================================== RCS file: /data/mirror/openbsd/cvs/src/sys/uvm/uvm_vnode.c,v retrieving revision 1.121 diff -u -p -r1.121 uvm_vnode.c --- uvm/uvm_vnode.c 15 Dec 2021 12:53:53 -0000 1.121 +++ uvm/uvm_vnode.c 14 Apr 2022 17:34:01 -0000 @@ -744,7 +744,7 @@ ReTry: */ #ifdef DIAGNOSTIC if (flags & PGO_SYNCIO) - panic("uvn_flush: PGO_SYNCIO return 'try again' error (impossible)"); + panic("%s: PGO_SYNCIO return 'try again' error (impossible)", __func__); #endif flags |= PGO_SYNCIO; if (flags & PGO_FREE) @@ -807,17 +807,8 @@ ReTry: } } else if (flags & PGO_FREE && result != VM_PAGER_PEND) { - if (result != VM_PAGER_OK) { - printf("uvn_flush: obj=%p, " - "offset=0x%llx. error " - "during pageout.\n", - pp->uobject, - (long long)pp->offset); - printf("uvn_flush: WARNING: " - "changes to page may be " - "lost!\n"); + if (result != VM_PAGER_OK) retval = FALSE; - } pmap_page_protect(ptmp, PROT_NONE); uvm_pageclean(ptmp); TAILQ_INSERT_TAIL(&dead, ptmp, pageq);