From: Wake Liu via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: kaleshsingh@google.com
Subject: [LTP] [PATCH v2 0/4] Don't derive kernel granularities from getpagesize()
Date: Mon, 16 Nov 2026 14:22:02 +0000 [thread overview]
Message-ID: <20261116142206.3151308-1-wakel@google.com> (raw)
In-Reply-To: <20261111093151.374731-1-wakel@google.com>
Hi,
Several tests derive kernel internal granularities from getpagesize():
the size of a pipe buffer, the granularity memory is faulted in and
cached with, or the page size reported by PROCMAP_QUERY. On mainline
kernels all of these are the same value, so the assumption never shows.
Android runs LTP on x86_64 emulators that boot a 4K kernel with the
page size emulation of the Android Common Kernels [1], enabled by
page_shift=14 on the kernel command line. It is not part of mainline.
The kernel reports a 16K page size to userspace through AT_PAGESZ and
enforces 16K alignment for mmap() and friends, while it keeps using 4K
pages internally. Interfaces that userspace commonly relies on, such as
mincore() and /proc/pid/pagemap, are emulated as well, but pipe
buffers, page fault, page cache and memcg accounting granularity, and
the KernelPageSize reported in smaps and by PROCMAP_QUERY keep
reflecting the real 4K kernel page size.
Android has carried local workarounds for these tests so far. This
series instead makes the tests rely on what the kernel reports, or
populate memory independently of the page size, so that Android can run
them unmodified. The patches are grouped by the assumption they remove.
None of them alters the behavior on kernels where both page sizes are
equal, and none adds emulation specific code to the tests.
Changes in v2:
- fcntl35: Use the pipe buffer size for the unprivileged case too, as
suggested by Kalesh. pipe-max-size can't be lower than a single pipe
buffer, so with 16K kernel pages and a 4K page size reported to
userspace, setting it to getpagesize() still allowed 16K pipes.
- Rebased on current master.
Tested on:
- x86_64 with a 4K page size (Debian, 7.1 kernel), where epoll_wait06,
ioctl10 and signal06 pass before and after the series, and all
changed tests compile without warnings with gcc and clang.
- An Android x86_64 emulator with a 4K page size (6.6 kernel), where
the results are the same before and after the series.
- An Android x86_64 Cuttlefish device running 6.18.32-android17 with
page_shift=14, where all of the patched tests fail without the series
and pass with it.
For v2, fcntl35 and epoll_wait06 were also run as root on the same
Cuttlefish device with getpagesize() and sysconf(_SC_PAGESIZE) wrapped
to return 1K, to mimic kernel pages that are larger than the page size
reported to userspace. Both fail there without the series, v1 still
fails the unprivileged case of fcntl35, and v2 passes. epoll_wait06,
ioctl10 and signal06 also pass with the series on the 4K x86_64 host
with getpagesize() interposed to return 1K or 16K.
v1: https://lore.kernel.org/ltp/20261111093151.374731-1-wakel@google.com/
[1] https://source.android.com/docs/core/architecture/16kb-page-size/getting-started-cf-x86-64-pgagnostic
Wake Liu (4):
epoll_wait06, fcntl35: Don't assume a pipe buffer is getpagesize()
memcg, userfaultfd07: Populate whole pages instead of single bytes
ioctl10: Compare vma_page_size with KernelPageSize from smaps
signal06: Allocate the alternate signal stack with mmap()
.../controllers/memcg/control/mem_process.c | 11 +++---
.../kernel/controllers/memcg/memcontrol02.c | 13 +++----
.../kernel/syscalls/epoll_wait/epoll_wait06.c | 15 +++++---
testcases/kernel/syscalls/fcntl/fcntl35.c | 21 +++++++++++-
testcases/kernel/syscalls/ioctl/ioctl10.c | 34 ++++++++++++++++++-
testcases/kernel/syscalls/signal/signal06.c | 15 +++++---
.../syscalls/userfaultfd/userfaultfd07.c | 11 ++++--
7 files changed, 96 insertions(+), 24 deletions(-)
base-commit: c4be3107083cd11e4732884c4c8c5e9c6665e729
--
2.56.0.611.g1030f0b940-goog
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-11-16 14:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 9:31 [LTP] [PATCH 0/4] Don't derive kernel granularities from getpagesize() Wake Liu via ltp
2026-11-11 9:31 ` [LTP] [PATCH 1/4] epoll_wait06, fcntl35: Don't assume a pipe buffer is getpagesize() Wake Liu via ltp
2026-11-11 9:31 ` [LTP] [PATCH 2/4] memcg, userfaultfd07: Populate whole pages instead of single bytes Wake Liu via ltp
2026-11-11 9:31 ` [LTP] [PATCH 3/4] ioctl10: Compare vma_page_size with KernelPageSize from smaps Wake Liu via ltp
2026-11-11 9:31 ` [LTP] [PATCH 4/4] signal06: Allocate the alternate signal stack with mmap() Wake Liu via ltp
2026-11-16 14:22 ` Wake Liu via ltp [this message]
2026-11-16 14:22 ` [LTP] [PATCH v2 1/4] epoll_wait06, fcntl35: Don't assume a pipe buffer is getpagesize() Wake Liu via ltp
2026-11-16 22:36 ` [LTP] " linuxtestproject.agent
2026-11-16 14:22 ` [LTP] [PATCH v2 2/4] memcg, userfaultfd07: Populate whole pages instead of single bytes Wake Liu via ltp
2026-11-16 14:22 ` [LTP] [PATCH v2 3/4] ioctl10: Compare vma_page_size with KernelPageSize from smaps Wake Liu via ltp
2026-11-16 14:22 ` [LTP] [PATCH v2 4/4] signal06: Allocate the alternate signal stack with mmap() Wake Liu via ltp
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=20261116142206.3151308-1-wakel@google.com \
--to=ltp@lists.linux.it \
--cc=kaleshsingh@google.com \
--cc=wakel@google.com \
/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.