lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABi2SkUnQQC4cXhwV6BN==umEFsNpFRptxMKy3bHthPUv+pXwA@mail.gmail.com>
Date: Mon, 10 Jun 2024 21:27:39 -0700
From: Jeff Xu <jeffxu@...omium.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Shuah Khan <shuah@...nel.org>, 
	Andrei Vagin <avagin@...gle.com>, Axel Rasmussen <axelrasmussen@...gle.com>, 
	Christian Brauner <brauner@...nel.org>, David Hildenbrand <david@...hat.com>, Kees Cook <kees@...nel.org>, 
	Kent Overstreet <kent.overstreet@...ux.dev>, "Liam R . Howlett" <Liam.Howlett@...cle.com>, 
	Muhammad Usama Anjum <usama.anjum@...labora.com>, Peter Xu <peterx@...hat.com>, 
	Rich Felker <dalias@...c.org>, linux-mm@...ck.org, linux-kselftest@...r.kernel.org, 
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/5] selftests/mm: mseal, self_elf: rename TEST_END_CHECK
 to REPORT_TEST_PASS

Hi

On Fri, Jun 7, 2024 at 7:10 PM John Hubbard <jhubbard@...dia.com> wrote:
>
> Now that the test macros are factored out into their final location, and
> simplified, it's time to rename TEST_END_CHECK to something that
> represents its new functionality: REPORT_TEST_PASS.
>
> Cc: Jeff Xu <jeffxu@...omium.org>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>

Reviewed-by: Jeff Xu <jeffxu@...omium.org>
Tested-by: Jeff Xu <jeffxu@...omium.org>

> ---
>  tools/testing/selftests/mm/mseal_helpers.h |  2 +-
>  tools/testing/selftests/mm/mseal_test.c    | 92 +++++++++++-----------
>  tools/testing/selftests/mm/seal_elf.c      |  2 +-
>  3 files changed, 48 insertions(+), 48 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/mseal_helpers.h b/tools/testing/selftests/mm/mseal_helpers.h
> index 8c3bf77dcf19..65ece62fdd0c 100644
> --- a/tools/testing/selftests/mm/mseal_helpers.h
> +++ b/tools/testing/selftests/mm/mseal_helpers.h
> @@ -22,7 +22,7 @@
>                 }                                                       \
>         } while (0)
>
> -#define TEST_END_CHECK() ksft_test_result_pass("%s\n", __func__)
> +#define REPORT_TEST_PASS() ksft_test_result_pass("%s\n", __func__)
>
>  #ifndef PKEY_DISABLE_ACCESS
>  #define PKEY_DISABLE_ACCESS    0x1
> diff --git a/tools/testing/selftests/mm/mseal_test.c b/tools/testing/selftests/mm/mseal_test.c
> index a29935d82027..f8e1c59f298e 100644
> --- a/tools/testing/selftests/mm/mseal_test.c
> +++ b/tools/testing/selftests/mm/mseal_test.c
> @@ -240,7 +240,7 @@ static void test_seal_addseal(void)
>         ret = sys_mseal(ptr, size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_unmapped_start(void)
> @@ -268,7 +268,7 @@ static void test_seal_unmapped_start(void)
>         ret = sys_mseal(ptr + 2 * page_size, 2 * page_size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_unmapped_middle(void)
> @@ -300,7 +300,7 @@ static void test_seal_unmapped_middle(void)
>         ret = sys_mseal(ptr + 3 * page_size, page_size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_unmapped_end(void)
> @@ -329,7 +329,7 @@ static void test_seal_unmapped_end(void)
>         ret = sys_mseal(ptr, 2 * page_size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_multiple_vmas(void)
> @@ -360,7 +360,7 @@ static void test_seal_multiple_vmas(void)
>         ret = sys_mseal(ptr, size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_split_start(void)
> @@ -385,7 +385,7 @@ static void test_seal_split_start(void)
>         ret = sys_mseal(ptr + page_size, 3 * page_size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_split_end(void)
> @@ -410,7 +410,7 @@ static void test_seal_split_end(void)
>         ret = sys_mseal(ptr, 3 * page_size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_invalid_input(void)
> @@ -445,7 +445,7 @@ static void test_seal_invalid_input(void)
>         ret = sys_mseal(ptr - page_size, 5 * page_size);
>         FAIL_TEST_IF_FALSE(ret < 0);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_zero_length(void)
> @@ -469,7 +469,7 @@ static void test_seal_zero_length(void)
>         ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_zero_address(void)
> @@ -495,7 +495,7 @@ static void test_seal_zero_address(void)
>         ret = sys_mprotect(ptr, size, PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_twice(void)
> @@ -515,7 +515,7 @@ static void test_seal_twice(void)
>         ret = sys_mseal(ptr, size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect(bool seal)
> @@ -539,7 +539,7 @@ static void test_seal_mprotect(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_start_mprotect(bool seal)
> @@ -569,7 +569,7 @@ static void test_seal_start_mprotect(bool seal)
>                         PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_end_mprotect(bool seal)
> @@ -599,7 +599,7 @@ static void test_seal_end_mprotect(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_unalign_len(bool seal)
> @@ -628,7 +628,7 @@ static void test_seal_mprotect_unalign_len(bool seal)
>                         PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_unalign_len_variant_2(bool seal)
> @@ -656,7 +656,7 @@ static void test_seal_mprotect_unalign_len_variant_2(bool seal)
>                         PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_two_vma(bool seal)
> @@ -691,7 +691,7 @@ static void test_seal_mprotect_two_vma(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_two_vma_with_split(bool seal)
> @@ -738,7 +738,7 @@ static void test_seal_mprotect_two_vma_with_split(bool seal)
>                         PROT_READ | PROT_WRITE);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_partial_mprotect(bool seal)
> @@ -764,7 +764,7 @@ static void test_seal_mprotect_partial_mprotect(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_two_vma_with_gap(bool seal)
> @@ -807,7 +807,7 @@ static void test_seal_mprotect_two_vma_with_gap(bool seal)
>         ret = sys_mprotect(ptr + 3 * page_size, page_size, PROT_READ);
>         FAIL_TEST_IF_FALSE(ret == 0);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_split(bool seal)
> @@ -844,7 +844,7 @@ static void test_seal_mprotect_split(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mprotect_merge(bool seal)
> @@ -878,7 +878,7 @@ static void test_seal_mprotect_merge(bool seal)
>         ret = sys_mprotect(ptr + 2 * page_size, 2 * page_size, PROT_READ);
>         FAIL_TEST_IF_FALSE(ret == 0);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_munmap(bool seal)
> @@ -903,7 +903,7 @@ static void test_seal_munmap(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  /*
> @@ -943,7 +943,7 @@ static void test_seal_munmap_two_vma(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  /*
> @@ -981,7 +981,7 @@ static void test_seal_munmap_vma_with_gap(bool seal)
>         ret = sys_munmap(ptr, size);
>         FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_munmap_start_freed(bool seal)
> @@ -1021,7 +1021,7 @@ static void test_munmap_start_freed(bool seal)
>                 FAIL_TEST_IF_FALSE(size == 0);
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_munmap_end_freed(bool seal)
> @@ -1051,7 +1051,7 @@ static void test_munmap_end_freed(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_munmap_middle_freed(bool seal)
> @@ -1095,7 +1095,7 @@ static void test_munmap_middle_freed(bool seal)
>                 FAIL_TEST_IF_FALSE(size == 0);
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_shrink(bool seal)
> @@ -1124,7 +1124,7 @@ static void test_seal_mremap_shrink(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_expand(bool seal)
> @@ -1156,7 +1156,7 @@ static void test_seal_mremap_expand(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_move(bool seal)
> @@ -1189,7 +1189,7 @@ static void test_seal_mremap_move(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mmap_overwrite_prot(bool seal)
> @@ -1217,7 +1217,7 @@ static void test_seal_mmap_overwrite_prot(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == ptr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mmap_expand(bool seal)
> @@ -1248,7 +1248,7 @@ static void test_seal_mmap_expand(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == ptr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mmap_shrink(bool seal)
> @@ -1276,7 +1276,7 @@ static void test_seal_mmap_shrink(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == ptr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_shrink_fixed(bool seal)
> @@ -1307,7 +1307,7 @@ static void test_seal_mremap_shrink_fixed(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == newAddr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_expand_fixed(bool seal)
> @@ -1338,7 +1338,7 @@ static void test_seal_mremap_expand_fixed(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == newAddr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_move_fixed(bool seal)
> @@ -1368,7 +1368,7 @@ static void test_seal_mremap_move_fixed(bool seal)
>         } else
>                 FAIL_TEST_IF_FALSE(ret2 == newAddr);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_move_fixed_zero(bool seal)
> @@ -1400,7 +1400,7 @@ static void test_seal_mremap_move_fixed_zero(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_move_dontunmap(bool seal)
> @@ -1429,7 +1429,7 @@ static void test_seal_mremap_move_dontunmap(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_mremap_move_dontunmap_anyaddr(bool seal)
> @@ -1463,7 +1463,7 @@ static void test_seal_mremap_move_dontunmap_anyaddr(bool seal)
>
>         }
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>
> @@ -1556,7 +1556,7 @@ static void test_seal_merge_and_split(void)
>         FAIL_TEST_IF_FALSE(size ==  22 * page_size);
>         FAIL_TEST_IF_FALSE(prot == 0x4);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_discard_ro_anon_on_rw(bool seal)
> @@ -1585,7 +1585,7 @@ static void test_seal_discard_ro_anon_on_rw(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_discard_ro_anon_on_pkey(bool seal)
> @@ -1632,7 +1632,7 @@ static void test_seal_discard_ro_anon_on_pkey(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_discard_ro_anon_on_filebacked(bool seal)
> @@ -1669,7 +1669,7 @@ static void test_seal_discard_ro_anon_on_filebacked(bool seal)
>                 FAIL_TEST_IF_FALSE(!ret);
>         close(fd);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_discard_ro_anon_on_shared(bool seal)
> @@ -1698,7 +1698,7 @@ static void test_seal_discard_ro_anon_on_shared(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  static void test_seal_discard_ro_anon(bool seal)
> @@ -1728,7 +1728,7 @@ static void test_seal_discard_ro_anon(bool seal)
>         else
>                 FAIL_TEST_IF_FALSE(!ret);
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  int main(int argc, char **argv)
> diff --git a/tools/testing/selftests/mm/seal_elf.c b/tools/testing/selftests/mm/seal_elf.c
> index 0fd129259647..131fc13cd422 100644
> --- a/tools/testing/selftests/mm/seal_elf.c
> +++ b/tools/testing/selftests/mm/seal_elf.c
> @@ -127,7 +127,7 @@ static void test_seal_elf(void)
>         FAIL_TEST_IF_FALSE(ret < 0);
>         ksft_print_msg("somestr is sealed, mprotect is rejected\n");
>
> -       TEST_END_CHECK();
> +       REPORT_TEST_PASS();
>  }
>
>  int main(int argc, char **argv)
> --
> 2.45.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ