Re: [PATCH] mm/mlock: fix zero-length request normalization and integer overflows
From: David Hildenbrand (Arm)
Date: Wed Sep 30 2026 - 07:43:55 EST
On 9/29/26 11:39, 박태선/컴퓨터·AI학부 wrote:
> Understood, and thank you for the feedback.
>
> I sincerely apologize for the poor code quality and flawed helper
> design. I will be much more careful with commenting and ensure future
> contributions strictly adhere to kernel guidelines.
>
> I will drop this patch.
>
> For David's question regarding reproducers and user-visible issues, in
> case it is helpful if the core team addresses this later,
> here is what is observed from a small test program wrote checking
> /proc/self/smaps on an unpatched kernel:
>
> $ ./test_mlock
> mlock(p, -1UL) : ret=0, locked=0 (silent success without actually locking)
> mlock(p + 5, 0) : ret=0, locked=1 (0-length request falsely locks 4KB page)
> munlock(p + 5, 0) : ret=0, locked=0 (0-length request falsely unlocks 4KB page)
>
> Thank you all for your time and the review.
The CI seems to complain about test failures:
# ---------------------------------------------
# running sudo -u nobody sh -c ./on-fault-limit
# ---------------------------------------------
# TAP version 13
# 1..1
# ok 1 The map failed respecting mlock limits
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
# [PASS]
ok 1 sudo -u nobody sh -c ./on-fault-limit
# ---------------------------
# running ./mlock-random-test
# ---------------------------
# TAP version 13
# 1..2
# ok 1 test_mlock_within_limit
# Bail out! mlock2() succeeds? on 0x7ffff7d2a010(393216) mlock0x7ffff7d44a72(278478)
# # Planned tests != run tests (2 != 1)
# # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
# [FAIL]
not ok 2 mlock-random-test # exit=1
So is this patch doing more harm than good?
--
Cheers,
David