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]
Date:   Wed, 05 Aug 2020 12:19:58 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Naresh Kamboju <naresh.kamboju@...aro.org>,
        open list <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Guenter Roeck <linux@...ck-us.net>,
        Shuah Khan <shuah@...nel.org>, patches@...nelci.org,
        Ben Hutchings <ben.hutchings@...ethink.co.uk>,
        lkft-triage@...ts.linaro.org,
        linux- stable <stable@...r.kernel.org>,
        Arnd Bergmann <arnd@...db.de>, Will Deacon <will@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>
Subject: Re: [PATCH 5.7 000/121] 5.7.13-rc2 review

On 2020-08-05 10:54, Greg Kroah-Hartman wrote:
> On Tue, Aug 04, 2020 at 10:23:06PM +0100, Marc Zyngier wrote:
>> On 2020-08-04 19:33, Linus Torvalds wrote:
>> > On Tue, Aug 4, 2020 at 1:21 AM Greg Kroah-Hartman
>> > <gregkh@...uxfoundation.org> wrote:
>> > >
>> > > So Linus's tree is also broken here.
>> >
>> > No, there's 835d1c3a9879 ("arm64: Drop unnecessary include from
>> > asm/smp.h") upstream.
>> 
>> My bet is that Greg ended up with this patch backported to
>> 5.7, but doesn't have 62a679cb2825 ("arm64: simplify ptrauth
>> initialization") as the latter isn't a fix.
>> 
>> I don't think any of these two patches are worth backporting,
>> to be honest.
> 
> I didn't have either of those patches, so I can try applying them to 
> see
> if the build errors go away.  But if you don't think they should be
> applied, what should I do?
> 
> Here's what I did have queued up:
> 
> f227e3ec3b5c ("random32: update the net random state on interrupt and 
> activity")
> aa54ea903abb ("ARM: percpu.h: fix build error")
> 1c9df907da83 ("random: fix circular include dependency on arm64 after
> addition of percpu.h")
> 83bdc7275e62 ("random32: remove net_rand_state from the latent entropy
> gcc plugin")
> c0842fbc1b18 ("random32: move the pseudo-random 32-bit definitions to
> prandom.h")

Not what I expected, then. I stand corrected.

> And that caused the builds to blow up.
> 
> So, what should I do here?

OK, this is getting hairy. I solved it by grabbing:

d0055da5266a ("arm64: remove ptrauth_keys_install_kernel sync arg")
62a679cb2825 ("arm64: simplify ptrauth initialization")

and at which point you might as well take 835d1c3a9879 despite
everything I said earlier. And backporting that further down the
line is fraught with danger.

I came up with yet another "quality" hack, which gets the job done,
see below. It is obviously much simpler, but also terribly ugly.

         M.

 From 34ee193a4a84718689cffd13f976b7f31e4c5ad4 Mon Sep 17 00:00:00 2001
 From: Marc Zyngier <maz@...nel.org>
Date: Wed, 5 Aug 2020 12:10:44 +0100
Subject: [PATCH] arm64: Workaround circular dependency in pointer_auth.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With the backport of f227e3ec3b5c ("random32: update the net random
state on interrupt and activity") and its associated fixes, the
arm64 build explodes early:

In file included from ../include/linux/smp.h:67,
                  from ../include/linux/percpu.h:7,
                  from ../include/linux/prandom.h:12,
                  from ../include/linux/random.h:118,
                  from ../arch/arm64/include/asm/pointer_auth.h:6,
                  from ../arch/arm64/include/asm/processor.h:39,
                  from ../include/linux/mutex.h:19,
                  from ../include/linux/kernfs.h:12,
                  from ../include/linux/sysfs.h:16,
                  from ../include/linux/kobject.h:20,
                  from ../include/linux/of.h:17,
                  from ../include/linux/irqdomain.h:35,
                  from ../include/linux/acpi.h:13,
                  from ../include/acpi/apei.h:9,
                  from ../include/acpi/ghes.h:5,
                  from ../include/linux/arm_sdei.h:8,
                  from ../arch/arm64/kernel/asm-offsets.c:10:
../arch/arm64/include/asm/smp.h:100:29: error: field ‘ptrauth_key’ has
incomplete type

This is due to struct ptrauth_keys_kernel not being defined before
we transitively include asm/smp.h from linux/random.h.

Paper over it by moving the inclusion of linux/random.h *after* the
type has been defined.

Signed-off-by: Marc Zyngier <maz@...nel.org>
---
  arch/arm64/include/asm/pointer_auth.h | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/pointer_auth.h 
b/arch/arm64/include/asm/pointer_auth.h
index c6b4f0603024..be7f853738e6 100644
--- a/arch/arm64/include/asm/pointer_auth.h
+++ b/arch/arm64/include/asm/pointer_auth.h
@@ -3,7 +3,6 @@
  #define __ASM_POINTER_AUTH_H

  #include <linux/bitops.h>
-#include <linux/random.h>

  #include <asm/cpufeature.h>
  #include <asm/memory.h>
@@ -34,6 +33,13 @@ struct ptrauth_keys_kernel {
  	struct ptrauth_key apia;
  };

+/*
+ * Only include random.h once ptrauth_keys_* structures are defined
+ * to avoid yet another circular include hell (random.h * ends up
+ * including asm/smp.h, which requires ptrauth_keys_kernel).
+ */
+#include <linux/random.h>
+
  static inline void ptrauth_keys_init_user(struct ptrauth_keys_user 
*keys)
  {
  	if (system_supports_address_auth()) {
-- 
2.27.0


-- 
Jazz is not dead. It just smells funny...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ