<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/security/lockdown, branch v5.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.4</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2019-10-31T08:40:21Z</updated>
<entry>
<title>efi/efi_test: Lock down /dev/efi_test and require CAP_SYS_ADMIN</title>
<updated>2019-10-31T08:40:21Z</updated>
<author>
<name>Javier Martinez Canillas</name>
<email>javierm@redhat.com</email>
</author>
<published>2019-10-29T17:37:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=359efcc2c910117d2faf704ce154e91fc976d37f'/>
<id>urn:sha1:359efcc2c910117d2faf704ce154e91fc976d37f</id>
<content type='text'>
The driver exposes EFI runtime services to user-space through an IOCTL
interface, calling the EFI services function pointers directly without
using the efivar API.

Disallow access to the /dev/efi_test character device when the kernel is
locked down to prevent arbitrary user-space to call EFI runtime services.

Also require CAP_SYS_ADMIN to open the chardev to prevent unprivileged
users to call the EFI runtime services, instead of just relying on the
chardev file mode bits for this.

The main user of this driver is the fwts [0] tool that already checks if
the effective user ID is 0 and fails otherwise. So this change shouldn't
cause any regression to this tool.

[0]: https://wiki.ubuntu.com/FirmwareTestSuite/Reference/uefivarinfo

Signed-off-by: Javier Martinez Canillas &lt;javierm@redhat.com&gt;
Signed-off-by: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Acked-by: Laszlo Ersek &lt;lersek@redhat.com&gt;
Acked-by: Matthew Garrett &lt;mjg59@google.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: linux-efi@vger.kernel.org
Link: https://lkml.kernel.org/r/20191029173755.27149-7-ardb@kernel.org
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>security: constify some arrays in lockdown LSM</title>
<updated>2019-09-10T12:27:38Z</updated>
<author>
<name>Matthew Garrett</name>
<email>matthewgarrett@google.com</email>
</author>
<published>2019-09-10T10:03:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f8a9bc623a6d178f7ecd40fb7db37eb954b6929c'/>
<id>urn:sha1:f8a9bc623a6d178f7ecd40fb7db37eb954b6929c</id>
<content type='text'>
No reason for these not to be const.

Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Suggested-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>lockdown: Print current-&gt;comm in restriction messages</title>
<updated>2019-08-20T04:54:17Z</updated>
<author>
<name>Matthew Garrett</name>
<email>matthewgarrett@google.com</email>
</author>
<published>2019-08-20T00:18:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b602614a81078bf29c82b2671bb96a63488f68d6'/>
<id>urn:sha1:b602614a81078bf29c82b2671bb96a63488f68d6</id>
<content type='text'>
Print the content of current-&gt;comm in messages generated by lockdown to
indicate a restriction that was hit.  This makes it a bit easier to find
out what caused the message.

The message now patterned something like:

        Lockdown: &lt;comm&gt;: &lt;what&gt; is restricted; see man kernel_lockdown.7

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>tracefs: Restrict tracefs when the kernel is locked down</title>
<updated>2019-08-20T04:54:17Z</updated>
<author>
<name>Matthew Garrett</name>
<email>matthewgarrett@google.com</email>
</author>
<published>2019-08-20T00:18:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ccbd54ff54e8b1880456b81c4aea352ebe208843'/>
<id>urn:sha1:ccbd54ff54e8b1880456b81c4aea352ebe208843</id>
<content type='text'>
Tracefs may release more information about the kernel than desirable, so
restrict it when the kernel is locked down in confidentiality mode by
preventing open().

(Fixed by Ben Hutchings to avoid a null dereference in
default_file_open())

Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Reviewed-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
Cc: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>debugfs: Restrict debugfs when the kernel is locked down</title>
<updated>2019-08-20T04:54:17Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:18:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5496197f9b084f086cb410dd566648b0896fcc74'/>
<id>urn:sha1:5496197f9b084f086cb410dd566648b0896fcc74</id>
<content type='text'>
Disallow opening of debugfs files that might be used to muck around when
the kernel is locked down as various drivers give raw access to hardware
through debugfs.  Given the effort of auditing all 2000 or so files and
manually fixing each one as necessary, I've chosen to apply a heuristic
instead.  The following changes are made:

 (1) chmod and chown are disallowed on debugfs objects (though the root dir
     can be modified by mount and remount, but I'm not worried about that).

 (2) When the kernel is locked down, only files with the following criteria
     are permitted to be opened:

	- The file must have mode 00444
	- The file must not have ioctl methods
	- The file must not have mmap

 (3) When the kernel is locked down, files may only be opened for reading.

Normal device interaction should be done through configfs, sysfs or a
miscdev, not debugfs.

Note that this makes it unnecessary to specifically lock down show_dsts(),
show_devs() and show_call() in the asus-wmi driver.

I would actually prefer to lock down all files by default and have the
the files unlocked by the creator.  This is tricky to manage correctly,
though, as there are 19 creation functions and ~1600 call sites (some of
them in loops scanning tables).

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: Andy Shevchenko &lt;andy.shevchenko@gmail.com&gt;
cc: acpi4asus-user@lists.sourceforge.net
cc: platform-driver-x86@vger.kernel.org
cc: Matthew Garrett &lt;mjg59@srcf.ucam.org&gt;
cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Greg KH &lt;greg@kroah.com&gt;
Cc: Rafael J. Wysocki &lt;rafael@kernel.org&gt;
Signed-off-by: Matthew Garrett &lt;matthewgarrett@google.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>lockdown: Lock down perf when in confidentiality mode</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:18:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b0c8fdc7fdb77586c3d1937050925b960743306e'/>
<id>urn:sha1:b0c8fdc7fdb77586c3d1937050925b960743306e</id>
<content type='text'>
Disallow the use of certain perf facilities that might allow userspace to
access kernel data.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Arnaldo Carvalho de Melo &lt;acme@kernel.org&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>bpf: Restrict bpf when kernel lockdown is in confidentiality mode</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:17:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d1f8be5cf42b497a3bddf1d523f2bb142e9318c'/>
<id>urn:sha1:9d1f8be5cf42b497a3bddf1d523f2bb142e9318c</id>
<content type='text'>
bpf_read() and bpf_read_str() could potentially be abused to (eg) allow
private keys in kernel memory to be leaked. Disable them if the kernel
has been locked down in confidentiality mode.

Suggested-by: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
cc: netdev@vger.kernel.org
cc: Chun-Yi Lee &lt;jlee@suse.com&gt;
cc: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Cc: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>lockdown: Lock down tracing and perf kprobes when in confidentiality mode</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:17:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a94549dd87f5ea4ca50fee493df08a2dc6256b53'/>
<id>urn:sha1:a94549dd87f5ea4ca50fee493df08a2dc6256b53</id>
<content type='text'>
Disallow the creation of perf and ftrace kprobes when the kernel is
locked down in confidentiality mode by preventing their registration.
This prevents kprobes from being used to access kernel memory to steal
crypto data, but continues to allow the use of kprobes from signed
modules.

Reported-by: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Acked-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Naveen N. Rao &lt;naveen.n.rao@linux.ibm.com&gt;
Cc: Anil S Keshavamurthy &lt;anil.s.keshavamurthy@intel.com&gt;
Cc: davem@davemloft.net
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>lockdown: Lock down /proc/kcore</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:17:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=02e935bf5b34edcc4cb0dc532dd0e1a1bfb33b51'/>
<id>urn:sha1:02e935bf5b34edcc4cb0dc532dd0e1a1bfb33b51</id>
<content type='text'>
Disallow access to /proc/kcore when the kernel is locked down to prevent
access to cryptographic data. This is limited to lockdown
confidentiality mode and is still permitted in integrity mode.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>x86/mmiotrace: Lock down the testmmiotrace module</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2019-08-20T00:17:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=906357f77a077508d160e729f917c5f0a4304f25'/>
<id>urn:sha1:906357f77a077508d160e729f917c5f0a4304f25</id>
<content type='text'>
The testmmiotrace module shouldn't be permitted when the kernel is locked
down as it can be used to arbitrarily read and write MMIO space. This is
a runtime check rather than buildtime in order to allow configurations
where the same kernel may be run in both locked down or permissive modes
depending on local policy.

Suggested-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com
Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Acked-by: Steven Rostedt (VMware) &lt;rostedt@goodmis.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
cc: Steven Rostedt &lt;rostedt@goodmis.org&gt;
cc: Ingo Molnar &lt;mingo@kernel.org&gt;
cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
cc: x86@kernel.org
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
</feed>
