All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hajime Tazaki <thehajime@gmail.com>
To: ljs@kernel.org
Cc: linux-mm@kvack.org, geert@linux-m68k.org, daniel@thingy.jp
Subject: Re: [RFC PATCH 0/6] fix nommu mmap and add nommu kselftests
Date: Sat, 15 Aug 2026 07:27:52 +0900	[thread overview]
Message-ID: <m233wgqqvr.wl-thehajime@gmail.com> (raw)
In-Reply-To: <an74JAGcEuHXxr5G@lucifer>


Hello,

thank you for your time looking at this series.

On Fri, 14 Aug 2026 20:24:57 +0900,
Lorenzo Stoakes (ARM) wrote:
> 
> Note on procedure - please do just cc- everybody on everything. It's a
> total pain to pull down series

I understand, I'll do this way for future patches.

> On Thu, Aug 13, 2026 at 03:33:55PM +0900, Hajime Tazaki wrote:
> > This patchset fixes several issues on nommu mmap, munmap, and mremap
> > syscalls and add test cases on kselftests framework, which currently not
> > runnable on nommu platform.
> >
> > Fixes for nommu is to correctly handle error cases when vma shrink
> > happens, and add calling .mmap_prepare callback on private mapping
> > requests to fix the issue which we cannot MAP_PRIVATE /dev/zero file.
> >
> > One thing that I'd like to broadly ask you (thus this marks as RFC) is:
> > this fix contains a dirty check of /dev/zero using device type number.
> > Since mmap_zero_prepare() should be called before actual mapping, but
> > some of the .mmap_prepare handler should be called _after_
> > determine_vm_flags() as the .mmap_prepare handler checks the shared
> > flags, we cannot use vma_is_anonymous() in determine_vm_flags() to
> > check the file is /dev/zero or not.  So we introduced
> > is_file_anonymous() for that purpose, which I'd like to ask your inputs.
> 
> Yeah I have plans for /dev/zero which will make it truly anon soon enough
> :)
> 
> And I definitely do not want a predicate that tests for just this edge
> case.

It's good to know your /dev/zero plan, and yes, I would wait for it
before moving forward with this dirty approach.

> > And we add test cases to introduce kselftest for nommu platforms.
> >
> > Currently there are several issues if we wish to run kselftests on nommu
> > targets:
> >
> > - it cannot compile/build test binaries because the current files mainly
> >   assume to build with glibc,
> > - some of the tests are not able to run on nommu targets as there are no
> >   fork(2) syscall.
> 
> Let's fix things only where it's not too invasive.
> 
> >
> > The first issue can be avoided if we can build static PIE binaries (if
> > targets support it), but in our case (build on ubuntu/glibc and run on
> > alpine/musl-libc), it fails to invoke due to lack of the GNU ifunc
> > mechanism.  Thus, we need to cross-compile with musl toolchain, which
> > needs to be solved the first issue.
> >
> > The second issue can be simply avoided, at a glance, by globally
> > replacing the symbol `fork` with `vfork`, which is available on nommu
> > targets.  Especially the test harness helper (kselftest_harness.h) uses
> > fork(2).  But the issue is not simple: for instance, in vfork(2) case
> 
> No please don't do this, nommu is the odd one out and the tests should be
> targeted at the normal case.
> 
> vfork() has entirely different semantics than fork() and we need to assert
> fork() behaviour, not vfork() behaviour.
> 
> (Honestly it's completely bizarre that we support a version of linux that
> can't fork() in 2026)

I understand your concern on fork-less kernel.

I am aware of some of experimental work which try to introduce fork(2)
(or alike) features into nommu (or alike) kernels (links below).  some
of them require a CPU features, some of them gave up CoW, etc.  I
haven't really look into details but if these effort contain a
meaningful insight to implement in Linux mainline, I would spend more
time to study these in order to fill the current gaps between current
MMU and !MMU.

# of course this might be a surgery and should be in a long-term
  milestone, not coming very soon.

https://github.com/flexcap-project/ufork
https://sigops.org/s/conferences/hotos/2025/slides/slides414.pdf

> > parent process has to wait until children has done jobs, parent and
> > children share the memory and children may corrupt parent memory which
> > is never happened with fork(2) syscall.  `timeout` command used in
> > `runner.sh` never works for nommu platform as it uses fork(2).
> 
> Yup again this speaks to the surreal craziness of linux supporting nommu at
> all :)

ditto.

> >
> > Additionally, the lack of test cases for nommu environment will (or
> > already) become serious issues to maintain the codebase in the future.
> 
> But this has to be weighed against the maintenance headache of supporting
> nommu stuff.
> 
> It's not right for it to force everybody writing tests to have to think
> about it.

My design goal, for this nommu support on kselftest, is not like this;
preserve the way the current users (of kselftest) do, and everybody
doesn't have to care about the particular nommu case.

So if this series breaks this intention, it's a fail and I should fix
it to not affecting existing models.

> And already in the thread there's been discussion about a serious bug in
> 5.10 that nobody reported for _years_.
> 
> So testing stuff sure - but right now people (apart from you of course!)
> aren't even doing boot testing against mainline AFAICT, let alone running
> self-tests.
> 
> So I want the minimal changes that are not invasive and limited to nommu
> only as much as possible, please.

I understand.

For the next step, I would break up this series into at least 3
different series:

- split_vma fixes (may break into several patches)
- kselftest extension for nommu (also several patches)
- /dev/zero fix (will wait for your updates)

thanks again,

-- Hajime


      parent reply	other threads:[~2026-08-14 23:04 UTC|newest]

Thread overview: 39+ 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-14 22:28     ` Hajime Tazaki
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-14 22:29     ` Hajime Tazaki
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
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-14 22:29     ` Hajime Tazaki
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 22:35     ` Hajime Tazaki
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)
2026-08-14 22:27   ` Hajime Tazaki [this message]

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=m233wgqqvr.wl-thehajime@gmail.com \
    --to=thehajime@gmail.com \
    --cc=daniel@thingy.jp \
    --cc=geert@linux-m68k.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.