Skip to content

ARM: fix hash_name() and branch predictor issues

Russell King (Oracle) linux-arm-kernel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 3 patches 11 repliesIn review

Patches in v1 No applies recorded yet

None of the 3 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchXie Yuanbin
SeriesR-b T-b R-b T-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] ARM: fix hash_name() and branch predictor issues

This series, which I'm intending to be part of my upcoming pull request for this merge window (note - will be sent before Thursday, otherwise it won't be until maybe the middle of January) fixes the recently reported hash_name() issue, and also the long standing branch predictor hardening smp_processor_id() warning which occurs due to interrupts being enabled.

Fixing this isn't trivial because there are many paths through do_page_fault() which are non-obvious.

For example, we detect page faults by the kernel attempting to execute memory that it shouldn't and print such a warning. If we introduce an early address check, we avoid that detection, making it become a plain kernel oops without the informative error message.

The first patch adds an additional check in __do_kernel_fault() to detect this condition. This patch is a non-obvious dependency for the next patch.

The second patch handles faults above the top of userspace entirely separately, meaning we have a simpler and more obvious fault path, which avoids any possibility of taking any MM mutexes, which is the cause of the hash_name() problem.

The third patch moves harden_branch_predictor() out of __do_user_fault() and to appropriate places in the parent functions. The reason this has been avoided thus far is because do_page_fault() can be a hot path (since it's used for page aging as well) but with kernel address faults being handled by an entirely separate path, this avoids adding to that overhead.

I would like to get some attributations for this - specifically tested-by.

Thanks.

 arch/arm/mm/alignment.c |  6 +++-
 arch/arm/mm/fault.c     | 74 +++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 67 insertions(+), 13 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!