https://bugs.kde.org/show_bug.cgi?id=526974

--- Comment #1 from Martin Cermak <[email protected]> ---
Created attachment 197076
  --> https://bugs.kde.org/attachment.cgi?id=197076&action=edit
proposed patch against LTP

The mremap03 test underwent a rewrite comparing ltp-full-20260529 and
ltp-full-20260930.  The LTP commit is:

-------------------------------------------------8<---------------------------------------------------------------
commit 88cfde5fbc14b23f673b81855127448a519679c0
Author: Andrea Cervesato <[email protected]>
Date:   Tue Jul 21 10:37:50 2026 +0200

    mremap03: Convert to new API

    Convert the mremap03 test case from the legacy LTP API to the new
    tst_test API.

    Rewrite the test to use TST_EXP_FAIL_PTR_VOID() to verify that
    mremap() fails with MAP_FAILED and EFAULT when growing a mapping
    whose old_address refers to an unmapped region obtained via
    tst_get_bad_addr().
-------------------------------------------------8<---------------------------------------------------------------

>From the functional persp., the difference is in it's setup() function.  The
original version prepares the bad_addr like this:

bad_addr = tst_get_bad_addr(cleanup);

The rewritten version prepares the bad addr like this:

bad_addr = tst_get_bad_addr(NULL);
SAFE_MUNMAP(bad_addr, page_size);

The different arg (cleanup vs. NULL) isn't important in case mmap() inside
tst_get_bad_addr() passes.  That said, the original version generates a mapped
address which is inaccessible (PROT_NONE).  The rewritten version generates the
same kind of bad address, but unmaps it right away.  Passing the unmapped
bad_addr to to mremap() makes valgrind unhappy.  Such bad_addr seems to be too
bad :)

Commenting out the SAFE_MUNMAP() in the rewritten version of the test make
valgrind happy again.  It doesn't break the testcase either. That said, I
suspect there is a bug in the LTP test and the attached patch fixes it.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to