Skip to content

iomap: enforce DIO alignment check in iomap]#949

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1109391=>linus-master
Open

iomap: enforce DIO alignment check in iomap]#949
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1109391=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown

Pull request for series with
subject: iomap: enforce DIO alignment check in iomap]
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1109391

@blktests-ci

blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: acb7500
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci

blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: 9716c08
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from 5c01bcc to 49966b2 Compare June 10, 2026 20:49
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c3a084b to 5f78e5d Compare June 12, 2026 22:27
@blktests-ci

blktests-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 2a2974b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from 49966b2 to d12b2d3 Compare June 12, 2026 22:31
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5f78e5d to e48f9db Compare June 13, 2026 01:19
@blktests-ci

blktests-ci Bot commented Jun 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from d12b2d3 to e9dad41 Compare June 13, 2026 01:22
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e48f9db to 199644a Compare June 17, 2026 11:41
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 5b33fc6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from e9dad41 to bfce834 Compare June 17, 2026 11:46
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 199644a to e6d9eb8 Compare June 17, 2026 12:02
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from bfce834 to ae9bcf5 Compare June 17, 2026 12:11
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from ae9bcf5 to 510d1f6 Compare June 24, 2026 01:37
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7d8604f to 4cc45a3 Compare June 26, 2026 08:14
@blktests-ci

blktests-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: 4edcdef
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from 510d1f6 to 7da2c3f Compare June 26, 2026 08:57
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 4cc45a3 to 90ffd56 Compare June 29, 2026 17:14
Sorry, I screwed up two addresses, bouncing them to the right addresses
to avoid spamming the lists again.

----- Forwarded message from cem@kernel.org -----

Date: Wed, 10 Jun 2026 16:52:11 +0200
From: cem@kernel.org
To: brauner@vger.kernel.org
Cc: linux-block@vger.kernel.devel, linux-fsdevel@vger.kernel.org,
  linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, Carlos Maiolino
 <cem@kernel.org>,  Keith Busch <kbusch@kernel.org>, Hannes Reinecke
 <hare@suse.de>,  "Martin K. Petersen" <martin.petersen@oracle.com>,
 Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Subject: [PATCH] iomap: enforce DIO alignment check in iomap
Message-ID: <20260610145218.141369-1-cem@kernel.org>
X-Mailer: git-send-email 2.54.0
Tags: sent

From: Carlos Maiolino <cem@kernel.org>

The DIO alignment check has been lifted from iomap layer to rely on the
block layer to enforce proper alignment when issuing direct IO
operations. This though, depending on the IO size and buffer address
passed to the IO operation may lead to user-visible behavior change.

This has been caught initially by LTP test diotest4 running on
PPC architecture, where the test fails because a read() operation
with a supposedly misaligned buffer succeeds instead of an expected
-EINVAL.
This has no direct relationship with PPC, but seems to do with the
IO size crossing page borders or not.

The test allocates a 4k buffer, and then increments the buffer pointer
by a single byte to enforce a misaligned address. It then issues a 4k
read() using such buffer. The read is supposed to return an -EINVAL but
it ends up succeeding.

The allocated buffer is at least a single page, so the read() size being
smaller will end up most of the time within the very same page initially
allocated which seems to suffice the block layer to accept the IO.

On x86 though, the same 4k read will end up crossing page boundaries
causing a bio_split which ends up properly checking the address and
rejecting it due to misalignment.
The test itself is buggy (which seems by design) because it ends up
attempting to read 4096 bytes into a 4095, but I believe the test
expected the address to be rejected prior to any write attempt.

The problematic behavior is reproducible on x86 by reducing the IO size
to something < PAGE_SIZE, so the misaligned read()s will also be accepted
by the block layer.

Fixing this is just a matter of enforcing daddr and memory
alignment back into iomap.

This behavior is reproducible in ext4 and xfs due to both relying on
iomap layer, btrfs does not present this behavior change as it does its
own DIO alignment checking.

Fixes: 7eac331 ("iomap: simplify direct io validity check")
Cc: Keith Busch <kbusch@kernel.org>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
@blktests-ci

blktests-ci Bot commented Jun 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: dc59e4f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1109391
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1109391=>linus-master branch from 7da2c3f to 75e9a60 Compare June 29, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant