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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 18 Aug 2022 11:55:40 -0700
From:   John Hubbard <jhubbard@...dia.com>
To:     Axel Rasmussen <axelrasmussen@...gle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Shuah Khan <shuah@...nel.org>,
        Guillaume Tucker <guillaume.tucker@...labora.com>,
        Linux MM <linux-mm@...ck.org>,
        Linuxkselftest <linux-kselftest@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] selftests/vm: fix inability to build any vm tests

On 8/18/22 10:58, Axel Rasmussen wrote:
>> 1) I recalled that hmm-tests.c in the same directory also needs
>> gup_test.h, and wondered if that was covered. And it turns out the the
>> relative "up and over" include path is done in hmm-tests.c itself,
>> instead of in the Makefile, like this:
>>
>> /*
>>    * This is a private UAPI to the kernel test module so it isn't exported
>>    * in the usual include/uapi/... directory.
>>    */
>> #include "../../../../lib/test_hmm_uapi.h"
>> #include "../../../../mm/gup_test.h"
>>
>> It would be nice (maybe follow-up polishing for someone) if this were
>> done once, instead of twice (or more?) via different (source code vs.
>> Makefile) mechanisms.
> 
> Hmm, I suppose the way to clean this up would be to have the Makefile
> compute this once, and pass in "-I $(selfdir)/../../.." to the
> compiler so we could just "#include <mm/gup_test.h>" directly?

Yes, it's better to have the Makefile know where the include paths are,
rather than each source file, so that looks better.

But hold on, now I see that selftests/vm/Makefile already uses what is
effectively a src_topdir, anyway! Here:

CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) $(KHDR_INCLUDES)

...which makes me think that real fix for the original problem should be
simply this:

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 947fc72413e9..d44c72b3abe3 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -40,6 +40,7 @@ ifeq (0,$(MAKELEVEL))
      endif
  endif
  selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
+top_srcdir = $(selfdir)/../../..

  # The following are built by lib.mk common compile rules.
  # TEST_CUSTOM_PROGS should be used by tests that require


...and then the follow up cleanup can use top_srcdir to cleanup CFLAGS and
also pull the relative paths out of the source files and into the Makefile.


thanks,
-- 
John Hubbard
NVIDIA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ