linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: linux-arm-kernel@lists.infradead.org,
	Tomas Paukrt <tomas.paukrt@advantech.cz>
Cc: Will Deacon <will@kernel.org>, Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 0/3] Fix uaccess kernel protection on ARMv5 and earlier
Date: Mon, 4 May 2020 14:34:35 +0100	[thread overview]
Message-ID: <20200504133435.GD1551@shell.armlinux.org.uk> (raw)

Hi,

This series fixes a problem with the ability for the user accessors to
access kernel space in a very specific circumstance.  I'm greatful to
Tomas Paukrt for having the patience to track down the problem.

This only happens when the following conditions are met:

- ARMv5 or earlier CPU
- Software PAN is disabled
- Nested exceptions that want to use user accessors to touch kernel
  space (implying use of the set_fs() function.)

The result is that the domain register is not preserved across the
nested exception, but instead is reset to prevent kernel accesses
while we are inside a region that should be permitting them.

Further technical details can be found in patch 3.

Patch 1 consolidates the uaccess macros into a new include file.
Patch 2 integrates the address limit save/reset/restore into this
 file, moving it from entry-armv.S, since we need to integrate this
 with the domain register manipulations.
Patch 3 ensures that the domain register is always saved and restored
 not only if we are using software PAN, but if we're using CPU domains
 for kernel memory protection.

 arch/arm/include/asm/assembler.h   |  75 +-----------------------
 arch/arm/include/asm/uaccess-asm.h | 117 +++++++++++++++++++++++++++++++++++++
 arch/arm/kernel/entry-armv.S       |  11 +---
 arch/arm/kernel/entry-header.S     |   9 +--
 4 files changed, 123 insertions(+), 89 deletions(-)
 create mode 100644 arch/arm/include/asm/uaccess-asm.h

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-05-04 13:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-04 13:34 Russell King - ARM Linux admin [this message]
2020-05-04 13:34 ` [PATCH 1/3] ARM: uaccess: consolidate uaccess asm to asm/uaccess-asm.h Russell King
2020-05-04 13:35 ` [PATCH 2/3] ARM: uaccess: integrate uaccess_save and uaccess_restore Russell King
2020-05-04 13:35 ` [PATCH 3/3] ARM: uaccess: fix DACR mismatch with nested exceptions Russell King

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=20200504133435.GD1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=tomas.paukrt@advantech.cz \
    --cc=viro@zeniv.linux.org.uk \
    --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;
as well as URLs for NNTP newsgroup(s).