NACK: [SRU][B][PATCH 1/1] UBUNTU: SAUCE: selftests/memfd: fix build when F_SEAL_FUTURE_WRITE is not defined

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Aug 30 19:07:59 UTC 2021


Subject: [SRU][B][PATCH 1/1] UBUNTU: SAUCE: selftests/memfd: fix build when F_SEAL_FUTURE_WRITE is not defined

When sending a patch to B, it is interpreted to mean bionic/linux, that is,
our 4.15 kernel. As you want this to be applied to all 5.4 kernels, it
would be best to send it referring to F, that is, focal/linux, even though
you that is only needed when building on bionic.

On Mon, Aug 30, 2021 at 11:50:39AM -0700, Luke Nowakowski-Krijger wrote:
> BugLink: https://bugs.launchpad.net/bugs/1926142
> 
> Fix build issue that seems to be affects all B/5.4 kernels due to 5.4
> tests being built against headers from a previous release.
> 
> Conditionally define the entire test_seal_future_write() definition
> as opposed to just the F_SEAL_FUTURE_WRITE operations, so that if any
> calls to the test are added in the future outside of ifdef scope, it
> should result in a more clear build failure, and not a confusing failure of
> the test if just the F_SEAL_FUTURE_WRITE ops were ommited.
> 
> Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger at canonical.com>
> ---
>  tools/testing/selftests/memfd/memfd_test.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
> index bb3f8bf9b8de..8edff32c7188 100644
> --- a/tools/testing/selftests/memfd/memfd_test.c
> +++ b/tools/testing/selftests/memfd/memfd_test.c
> @@ -731,6 +731,7 @@ static void test_seal_write(void)
>   * Test SEAL_FUTURE_WRITE
>   * Test whether SEAL_FUTURE_WRITE actually prevents modifications.
>   */
> +#ifdef F_SEAL_FUTURE_WRITE
>  static void test_seal_future_write(void)
>  {
>  	int fd, fd2;
> @@ -764,6 +765,7 @@ static void test_seal_future_write(void)
>  	close(fd2);
>  	close(fd);
>  }
> +#endif
>  

I would rather keep testing the feature if the kernel supports it. So,
instead, I would do:

#ifndef F_SEAL_FUTURE_WRITE
#define F_SEAL_FUTURE_WRITE 0x0010
#endif

Cascardo.

>  /*
>   * Test SEAL_SHRINK
> @@ -1018,7 +1020,9 @@ int main(int argc, char **argv)
>  	test_basic();
>  
>  	test_seal_write();
> +#ifdef F_SEAL_FUTURE_WRITE
>  	test_seal_future_write();
> +#endif
>  	test_seal_shrink();
>  	test_seal_grow();
>  	test_seal_resize();
> -- 
> 2.30.2
> 
> 
> -- 
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



More information about the kernel-team mailing list