public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Naresh Kamboju <naresh.kamboju@linaro.org>,
	open list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Guenter Roeck <linux@roeck-us.net>, Shuah Khan <shuah@kernel.org>,
	patches@kernelci.org,
	Ben Hutchings <ben.hutchings@codethink.co.uk>,
	lkft-triage@lists.linaro.org,
	linux- stable <stable@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Will Deacon <will@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH 5.7 000/121] 5.7.13-rc2 review
Date: Wed, 05 Aug 2020 12:19:58 +0100	[thread overview]
Message-ID: <813c64c8dbe037b9d84763f56c4dbb7d@kernel.org> (raw)
In-Reply-To: <20200805095439.GB1634853@kroah.com>

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@linuxfoundation.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@kernel.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@kernel.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...

  reply	other threads:[~2020-08-05 17:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04  7:33 [PATCH 5.7 000/121] 5.7.13-rc2 review Greg Kroah-Hartman
2020-08-04  8:16 ` Naresh Kamboju
2020-08-04  8:21   ` Greg Kroah-Hartman
2020-08-04  9:00     ` Greg Kroah-Hartman
2020-08-04 18:33     ` Linus Torvalds
2020-08-04 21:23       ` Marc Zyngier
2020-08-05  9:54         ` Greg Kroah-Hartman
2020-08-05 11:19           ` Marc Zyngier [this message]
2020-08-05 13:20             ` Greg Kroah-Hartman
2020-08-05 16:51             ` Linus Torvalds
2020-08-04 16:49   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=813c64c8dbe037b9d84763f56c4dbb7d@kernel.org \
    --to=maz@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=ben.hutchings@codethink.co.uk \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkft-triage@lists.linaro.org \
    --cc=naresh.kamboju@linaro.org \
    --cc=patches@kernelci.org \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox