Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742713 > unrolled thread

[kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options

Started by"Tobin C. Harding" <me@tobin.cc>
First post2017-10-01 02:10 +0200
Last post2017-10-01 02:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options "Tobin C. Harding" <me@tobin.cc> - 2017-10-01 02:10 +0200
    Re: [kernel-hardening] [RFC V2 0/6] add more kernel pointer filter  options "Tobin C. Harding" <me@tobin.cc> - 2017-10-01 02:20 +0200

#1742713 — [kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options

From"Tobin C. Harding" <me@tobin.cc>
Date2017-10-01 02:10 +0200
Subject[kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options
Message-ID<uvzZv-2ZT-3@gated-at.bofh.it>
Version 2 of Greg's patch series with changes made as suggested by comments to V1.

Applies on top of Linus' current development tree

a8c964eacb21288b2dbfa9d80cee5968a3b8fb21

V1 cover letter:

Here's a short patch series from Chris Fries and Dave Weinstein that
implements some new restrictions when printing out kernel pointers, as
well as the ability to whitelist kernel pointers where needed.

These patches are based on work from William Roberts, and also are
inspired by grsecurity's %pP to specifically whitelist a kernel pointer,
where it is always needed, like the last patch in the series shows, in
the UIO drivers (UIO requires that you know the address, it's a hardware
address, nothing wrong with seeing that...)

I haven't done much to this patch series, only forward porting it from
an older kernel release (4.4) and a few minor tweaks. [snip]

V1 -> V2:

* Renamed function kptr_restrict_always_cleanse_pointers() to
  kptr_restrict_cleanse_kernel_pointers() (as suggested by Petr Mladek).

* Re-ordered switch statement (within pointer()) to place default at the end
  of the statement (as suggested by Petr Mladek).

* Updated Documentation/printk-formats.txt (as suggested by Joe Perches).

* Updated Documentation/sysctl/kernel.txt (as suggested by Petr Mladek).

Suggestion by Ian Campbell to add comments on the threat model being mitigated
by use of %pa vs %paP etc is not implemented because I do not know the threat
model (I'm only the janitor). Happy to add them if someone writes them.

thanks,
Tobin.

Tobin C. Harding (6):
  lib: vsprintf: additional kernel pointer filtering options
  lib: vsprintf: whitelist stack traces
  lib: vsprintf: physical address kernel pointer filtering options
  lib: vsprintf: default kptr_restrict to the maximum value
  lib: vsprintf: add "%paP", "%papP", and "%padP" specifiers
  drivers: uio: un-restrict sysfs pointers for UIO

 Documentation/printk-formats.txt |  27 ++++++++--
 Documentation/sysctl/kernel.txt  |   9 ++++
 arch/arm64/kernel/traps.c        |   4 +-
 drivers/uio/uio.c                |   4 +-
 kernel/printk/printk.c           |   2 +-
 kernel/sysctl.c                  |   2 +-
 lib/vsprintf.c                   | 114 +++++++++++++++++++++++++++++----------
 scripts/checkpatch.pl            |   2 +-
 8 files changed, 124 insertions(+), 40 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1742714 — Re: [kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options

From"Tobin C. Harding" <me@tobin.cc>
Date2017-10-01 02:20 +0200
SubjectRe: [kernel-hardening] [RFC V2 0/6] add more kernel pointer filter options
Message-ID<uvA9b-33q-3@gated-at.bofh.it>
In reply to#1742713
On Sun, Oct 01, 2017 at 11:06:44AM +1100, Tobin C. Harding wrote:
> Version 2 of Greg's patch series with changes made as suggested by comments to V1.

Patch set tested by setting /proc/sys/kernel/kptr_restrict and inserting the following module

#include <linux/init.h>
#include <linux/module.h>

#define DRIVER_AUTHOR "Tobin C. Harding <me@tobin.cc>"
#define DRIVER_DESC "Testing module"

static void test_printk(void)
{
	char *ptr = "";

	pr_alert("printing with p: %p\n", ptr);
	pr_alert("printing with pK: %pK\n", ptr);
	pr_alert("printing with pP: %pP\n", ptr);

	pr_alert("printing with pa: %pa\n", ptr);
	pr_alert("printing with pad: %pad\n", ptr);
	pr_alert("printing with pap: %pap\n", ptr);

	pr_alert("printing with paP: %paP\n", ptr);
	pr_alert("printing with padP: %padP\n", ptr);
	pr_alert("printing with papP: %papP\n", ptr);

	pr_alert("printing with pr: %pr\n", ptr);
	pr_alert("printing with pR: %pR\n", ptr);
}

static int hello_init(void)
{
	pr_alert("Hello, world\n");

	test_printk();

	return 0;
}
module_init(hello_init);

static void hello_exit(void)
{
	pr_alert("Goodbye, world\n");
}
module_exit(hello_exit);

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_LICENSE("GPL");

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web