]> git.baikalelectronics.ru Git - kernel.git/commit
random: fix circular include dependency on arm64 after addition of percpu.h
authorWilly Tarreau <w@1wt.eu>
Thu, 30 Jul 2020 05:59:24 +0000 (07:59 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 30 Jul 2020 16:15:17 +0000 (09:15 -0700)
commit74860c31ea585875cec50168d31689060b83b3d2
tree0ac3de1c64e2e7008b6a0b17751d81d70a88d34e
parent8f73dce1ff52e0eb8e14b623505d320048dde9f7
random: fix circular include dependency on arm64 after addition of percpu.h

Daniel Díaz and Kees Cook independently reported that commit
3129ed503bea ("random32: update the net random state on interrupt and
activity") broke arm64 due to a circular dependency on include files
since the addition of percpu.h in random.h.

The correct fix would definitely be to move all the prandom32 stuff out
of random.h but for backporting, a smaller solution is preferred.

This one replaces linux/percpu.h with asm/percpu.h, and this fixes the
problem on x86_64, arm64, arm, and mips.  Note that moving percpu.h
around didn't change anything and that removing it entirely broke
differently.  When backporting, such options might still be considered
if this patch fails to help.

[ It turns out that an alternate fix seems to be to just remove the
  troublesome <asm/pointer_auth.h> remove from the arm64 <asm/smp.h>
  that causes the circular dependency.

  But we might as well do the whole belt-and-suspenders thing, and
  minimize inclusion in <linux/random.h> too. Either will fix the
  problem, and both are good changes.   - Linus ]

Reported-by: Daniel Díaz <daniel.diaz@linaro.org>
Reported-by: Kees Cook <keescook@chromium.org>
Tested-by: Marc Zyngier <maz@kernel.org>
Fixes: 3129ed503bea
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/random.h