From: Hajime Tazaki <thehajime@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-mm@kvack.org, geert@linux-m68k.org, daniel@thingy.jp,
arnd@arndb.de, willy@infradead.org, jack@suse.cz,
akpm@linux-foundation.org, liam@infradead.org, ljs@kernel.org,
vbabka@kernel.org, jannh@google.com, pfalcato@suse.de,
linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH 3/6] mm: nommu: fix an issue on map request to /dev/zero
Date: Fri, 14 Aug 2026 21:42:26 +0900 [thread overview]
Message-ID: <m27blsrhzh.wl-thehajime@gmail.com> (raw)
In-Reply-To: <2026081355-remold-sterility-84f9@gregkh>
Hello Greg,
thank you for your time to look at this patch.
On Thu, 13 Aug 2026 21:19:47 +0900,
Greg Kroah-Hartman wrote:
>
> On Thu, Aug 13, 2026 at 03:33:58PM +0900, Hajime Tazaki wrote:
> > Upon a private file mapping request to /dev/zero, it calls
> > kernel_read() in do_mmap_private(), getting a failure with the message
> > like: "kernel reads not supported for file /dev/zero", which is because
> > zero_fops defined in drivers/char/mem.c has both .read and .read_iter
> > definitions.
>
> Do you actually use a no-mmu system?
yes, and wish to use in future.
I'm going to make a long story short;
nommu kernel is originally for embedded devices but I wish to use for
virtualization.
I gave a talk to explain this motivation below (which you also had a
keynote remotely). I'm not make a summary for this talk in this
email, but am happy to explain again if needed.
https://www.netdevconf.info/0x1A/sessions/talk/improving-debuggability-of-nommu-code-with-uml.html
https://speakerdeck.com/thehajime/nommu-uml-netdev-0x1a/
> > Even fixing this issue, the map request to /dev/zero works fine without
> > errors but the allocated vma isn't marked with anonymous because
> > mmap_zero_prepare() isn't called under nommu platform, resulting
> > vma_desc_set_anonymous() isn't called either.
> >
> > This commit fixes those issues by:
> > 1) use vfs_iter_read() instead to avoid failure at kernel_read()
> > 2) calls .mmap_prepare on private mapping in do_mmap() so that required
> > preparations are done even in private mapping.
> >
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > Cc: Jan Kara <jack@suse.cz>
> > Cc: Andrew Morton <akpm@linux-foundation.org>
> > Cc: "Liam R. Howlett" <liam@infradead.org>
> > Cc: Lorenzo Stoakes <ljs@kernel.org>
> > Cc: Vlastimil Babka <vbabka@kernel.org>
> > Cc: Jann Horn <jannh@google.com>
> > Cc: Pedro Falcato <pfalcato@suse.de>
> > Cc: linux-fsdevel@vger.kernel.org
> > Cc: linux-mm@kvack.org (open list:PAGE CACHE)
> > Fixes: 4d03e3cc5982 ("fs: don't allow kernel reads and writes without iter ops")
>
> Given the age of this issue, I don't think anyone uses no-mmu systems
> anymore :(
I tend to agree; nommu systems does have less users than others.
but I believe this doesn't mean there are no users.
I should also explain more, but I found this issue via a Sashiko
review, which pointed me as a different comment, but when I tried to
reproduce that case pointed by the review, which is about the use of
check `vma->vm_file` v.s., `vma_is_anonymous(vma)`, I found that
/dev/zero is not able to map on nommu kernel.
https://sashiko.dev/#/patchset/20260710054648.924005-1-thehajime%40gmail.com
https://sashiko.dev/#/message/m2cxwvti7z.wl-thehajime%40gmail.com
The alternate path of open()=>read() of /dev/zero works fine as it
doesn't use kernel_read().
I also understand what you feel from the age of this issue (almost 6
years old), and that is exactly why I start implementing test cases in
kselftest, which is currently not able to run (even build) for nommu
platforms. This series also includes the extension to kselftest
([4,5,6/6] patches are for that).
> > - if (!file) {
> > + /* private and file mapping will be marked anonymous later (do_mmap_private()).
> > + * and /dev/zero is marked by them at .mmap_prepare,
> > + * which should be _before_ this point.
> > + */
>
> Wrong coding style for the comment, which is very typical of
> LLM-generated stuff. Always rewrite the output of these tools to
> actually be sane.
this is my fault.
As I mentioned in the Assisted-by tag, I indeed used an AI review
system (which is cubic.dev), but I wrote this comment by my hand.
Because I thought this part is not easy to follow and felt that I need
additional explanation rather than just showing diff.
since checkpatch.pl doesn't complain this, I didn't carefully look at
the style of this comment block.
I will update this (as well as bunch of comments from Sashiko).
thanks,
-- Hajime
next prev parent reply other threads:[~2026-08-14 12:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 6:33 [RFC PATCH 0/6] fix nommu mmap and add nommu kselftests Hajime Tazaki
2026-08-13 6:33 ` [RFC PATCH 1/6] mm: nommu: fix do_mremap() to correctly update internal states Hajime Tazaki
2026-08-14 11:52 ` Lorenzo Stoakes (ARM)
2026-08-13 6:33 ` [RFC PATCH 2/6] mm: nommu: use vma_is_anonymous() to check if vmas are anonymous Hajime Tazaki
2026-08-14 11:52 ` Lorenzo Stoakes (ARM)
2026-08-13 6:33 ` [RFC PATCH 3/6] mm: nommu: fix an issue on map request to /dev/zero Hajime Tazaki
2026-08-13 12:19 ` Greg Kroah-Hartman
2026-08-13 12:43 ` Daniel Palmer
2026-08-13 13:29 ` Lorenzo Stoakes (ARM)
2026-08-13 13:51 ` Daniel Palmer
2026-08-13 13:58 ` Lorenzo Stoakes (ARM)
2026-08-13 14:06 ` Greg Kroah-Hartman
2026-08-14 12:42 ` Hajime Tazaki
2026-08-14 13:02 ` Lorenzo Stoakes (ARM)
2026-08-13 14:02 ` Greg Kroah-Hartman
2026-08-13 14:10 ` Lorenzo Stoakes (ARM)
2026-08-14 9:09 ` Geert Uytterhoeven
2026-08-13 13:22 ` Matthew Wilcox
2026-08-13 13:32 ` Lorenzo Stoakes (ARM)
2026-08-13 13:43 ` Lorenzo Stoakes (ARM)
2026-08-13 14:04 ` Greg Kroah-Hartman
2026-08-14 12:42 ` Hajime Tazaki [this message]
2026-08-14 12:37 ` Lorenzo Stoakes (ARM)
2026-08-13 6:33 ` [RFC PATCH 4/6] selftests: fix build errors on alpine linux Hajime Tazaki
2026-08-14 9:34 ` Pedro Falcato
2026-08-14 12:44 ` Hajime Tazaki
2026-08-14 12:39 ` Lorenzo Stoakes (ARM)
2026-08-13 6:34 ` [RFC PATCH 5/6] selftests: run tests on nommu architecture Hajime Tazaki
2026-08-14 12:50 ` Lorenzo Stoakes (ARM)
2026-08-14 14:34 ` Mark Brown
2026-08-13 6:34 ` [RFC PATCH 6/6] selftests/mm: add nommu mmap and mremap behavior tests Hajime Tazaki
2026-08-14 13:28 ` Lorenzo Stoakes (ARM)
2026-08-14 11:24 ` [RFC PATCH 0/6] fix nommu mmap and add nommu kselftests Lorenzo Stoakes (ARM)
2026-08-14 11:26 ` Lorenzo Stoakes (ARM)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m27blsrhzh.wl-thehajime@gmail.com \
--to=thehajime@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=daniel@thingy.jp \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox