- 05 10月, 2019 2 次提交
-
-
由 Masahiro Yamada 提交于
The ima/ and evm/ sub-directories contain built-in objects, so obj-$(CONFIG_...) is the correct way to descend into them. subdir-$(CONFIG_...) is redundant. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
-
由 Masahiro Yamada 提交于
I guess commit 15ea0e1e ("efi: Import certificates from UEFI Secure Boot") attempted to add -fshort-wchar for building load_uefi.o, but it has never worked as intended. load_uefi.o is created in the platform_certs/ sub-directory. If you really want to add -fshort-wchar, the correct code is: $(obj)/platform_certs/load_uefi.o: KBUILD_CFLAGS += -fshort-wchar But, you do not need to fix it. Commit 8c97023c ("Kbuild: use -fshort-wchar globally") had already added -fshort-wchar globally. This code was unneeded in the first place. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
-
- 25 9月, 2019 1 次提交
-
-
由 Roberto Sassu 提交于
Commit 0b6cf6b9 ("tpm: pass an array of tpm_extend_digest structures to tpm_pcr_extend()") modifies tpm_pcr_extend() to accept a digest for each PCR bank. After modification, tpm_pcr_extend() expects that digests are passed in the same order as the algorithms set in chip->allocated_banks. This patch fixes two issues introduced in the last iterations of the patch set: missing initialization of the TPM algorithm ID in the tpm_digest structures passed to tpm_pcr_extend() by the trusted key module, and unreleased locks in the TPM driver due to returning from tpm_pcr_extend() without calling tpm_put_ops(). Cc: stable@vger.kernel.org Fixes: 0b6cf6b9 ("tpm: pass an array of tpm_extend_digest structures to tpm_pcr_extend()") Signed-off-by: NRoberto Sassu <roberto.sassu@huawei.com> Suggested-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: NJerry Snitselaar <jsnitsel@redhat.com> Reviewed-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
-
- 18 9月, 2019 1 次提交
-
-
由 Micah Morton 提交于
The first time a rule set is configured for SafeSetID, we shouldn't be trying to release the previously configured ruleset, since there isn't one. Currently, the pointer that would point to a previously configured ruleset is uninitialized on first rule set configuration, leading to a crash when we try to call release_ruleset with that pointer. Acked-by: NJann Horn <jannh@google.com> Signed-off-by: NMicah Morton <mortonm@chromium.org>
-
- 10 9月, 2019 1 次提交
-
-
由 Matthew Garrett 提交于
No reason for these not to be const. Signed-off-by: NMatthew Garrett <mjg59@google.com> Suggested-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NJames Morris <jmorris@namei.org>
-
- 06 9月, 2019 1 次提交
-
-
由 Hillf Danton 提交于
If a request_key authentication token key gets revoked, there's a window in which request_key_auth_describe() can see it with a NULL payload - but it makes no check for this and something like the following oops may occur: BUG: Kernel NULL pointer dereference at 0x00000038 Faulting instruction address: 0xc0000000004ddf30 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [...] request_key_auth_describe+0x90/0xd0 LR [...] request_key_auth_describe+0x54/0xd0 Call Trace: [...] request_key_auth_describe+0x54/0xd0 (unreliable) [...] proc_keys_show+0x308/0x4c0 [...] seq_read+0x3d0/0x540 [...] proc_reg_read+0x90/0x110 [...] __vfs_read+0x3c/0x70 [...] vfs_read+0xb4/0x1b0 [...] ksys_read+0x7c/0x130 [...] system_call+0x5c/0x70 Fix this by checking for a NULL pointer when describing such a key. Also make the read routine check for a NULL pointer to be on the safe side. [DH: Modified to not take already-held rcu lock and modified to also check in the read routine] Fixes: 04c567d9 ("[PATCH] Keys: Fix race between two instantiators of a key") Reported-by: NSachin Sant <sachinp@linux.vnet.ibm.com> Signed-off-by: NHillf Danton <hdanton@sina.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Tested-by: NSachin Sant <sachinp@linux.vnet.ibm.com> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 05 9月, 2019 5 次提交
-
-
由 Stephen Smalley 提交于
We need to use selinux_cred() to fetch the SELinux cred blob instead of directly using current->security or current_security(). There were a couple of lingering uses of current_security() in the SELinux code that were apparently missed during the earlier conversions. IIUC, this would only manifest as a bug if multiple security modules including SELinux are enabled and SELinux is not first in the lsm order. After this change, there appear to be no other users of current_security() in-tree; perhaps we should remove it altogether. Fixes: bbd3662a ("Infrastructure management of the cred security blob") Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov> Acked-by: NCasey Schaufler <casey@schaufler-ca.com> Reviewed-by: NJames Morris <jamorris@linux.microsoft.com> Signed-off-by: NPaul Moore <paul@paul-moore.com>
-
由 Eric Biggers 提交于
inode_smack::smk_lock is taken during smack_d_instantiate(), which is called during a filesystem transaction when creating a file on ext4. Therefore to avoid a deadlock, all code that takes this lock must use GFP_NOFS, to prevent memory reclaim from waiting for the filesystem transaction to complete. Reported-by: syzbot+0eefc1e06a77d327a056@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Signed-off-by: NEric Biggers <ebiggers@google.com> Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
-
由 Jia-Ju Bai 提交于
In smack_socket_sock_rcv_skb(), there is an if statement on line 3920 to check whether skb is NULL: if (skb && skb->secmark != 0) This check indicates skb can be NULL in some cases. But on lines 3931 and 3932, skb is used: ad.a.u.net->netif = skb->skb_iif; ipv6_skb_to_auditdata(skb, &ad.a, NULL); Thus, possible null-pointer dereferences may occur when skb is NULL. To fix these possible bugs, an if statement is added to check skb. These bugs are found by a static analysis tool STCheck written by us. Signed-off-by: NJia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
-
由 luanshi 提交于
Fix/add kernel-doc notation and fix typos in security/smack/. Signed-off-by: NLiguang Zhang <zhangliguang@linux.alibaba.com> Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
-
由 Jann Horn 提交于
There is a logic bug in the current smack_bprm_set_creds(): If LSM_UNSAFE_PTRACE is set, but the ptrace state is deemed to be acceptable (e.g. because the ptracer detached in the meantime), the other ->unsafe flags aren't checked. As far as I can tell, this means that something like the following could work (but I haven't tested it): - task A: create task B with fork() - task B: set NO_NEW_PRIVS - task B: install a seccomp filter that makes open() return 0 under some conditions - task B: replace fd 0 with a malicious library - task A: attach to task B with PTRACE_ATTACH - task B: execve() a file with an SMACK64EXEC extended attribute - task A: while task B is still in the middle of execve(), exit (which destroys the ptrace relationship) Make sure that if any flags other than LSM_UNSAFE_PTRACE are set in bprm->unsafe, we reject the execve(). Cc: stable@vger.kernel.org Fixes: 5663884c ("Smack: unify all ptrace accesses in the smack") Signed-off-by: NJann Horn <jannh@google.com> Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
-
- 31 8月, 2019 1 次提交
-
-
由 Eric Biggers 提交于
If check_cached_key() returns a non-NULL value, we still need to call key_type::match_free() to undo key_type::match_preparse(). Fixes: 7743c48e ("keys: Cache result of request_key*() temporarily in task_struct") Signed-off-by: NEric Biggers <ebiggers@google.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
-
- 30 8月, 2019 2 次提交
-
-
由 Gustavo A. R. Silva 提交于
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct ima_template_entry { ... struct ima_field_data template_data[0]; /* template related data */ }; instance = kzalloc(sizeof(struct ima_template_entry) + count * sizeof(struct ima_field_data), GFP_NOFS); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, entry, count), GFP_NOFS); This code was detected with the help of Coccinelle. Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
-
由 Gustavo A. R. Silva 提交于
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
-
- 29 8月, 2019 1 次提交
-
-
由 Thiago Jung Bauermann 提交于
If we can't parse the PKCS7 in the appended modsig, we will free the modsig structure and then access one of its members to determine the error value. Fixes: 39b07096 ("ima: Implement support for module-style appended signatures") Reported-by: Nkbuild test robot <lkp@intel.com> Reported-by: NJulia Lawall <julia.lawall@lip6.fr> Reported-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NThiago Jung Bauermann <bauerman@linux.ibm.com> Reviewed-by: NGustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
-
- 28 8月, 2019 1 次提交
-
-
由 Ondrej Mosnacek 提交于
As noted in Documentation/atomic_t.txt, if we don't need the RMW atomic operations, we should only use READ_ONCE()/WRITE_ONCE() + smp_rmb()/smp_wmb() where necessary (or the combined variants smp_load_acquire()/smp_store_release()). This patch converts the sidtab code to use regular u32 for the counter and reverse lookup cache and use the appropriate operations instead of atomic_get()/atomic_set(). Note that when reading/updating the reverse lookup cache we don't need memory barriers as it doesn't need to be consistent or accurate. We can now also replace some atomic ops with regular loads (when under spinlock) and stores (for conversion target fields that are always accessed under the master table's spinlock). We can now also bump SIDTAB_MAX to U32_MAX as we can use the full u32 range again. Suggested-by: NJann Horn <jannh@google.com> Signed-off-by: NOndrej Mosnacek <omosnace@redhat.com> Reviewed-by: NJann Horn <jannh@google.com> Signed-off-by: NPaul Moore <paul@paul-moore.com>
-
- 20 8月, 2019 24 次提交
-
-
由 Matthew Garrett 提交于
Print the content of current->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: <comm>: <what> is restricted; see man kernel_lockdown.7 Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
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: NMatthew Garrett <mjg59@google.com> Reviewed-by: NSteven Rostedt (VMware) <rostedt@goodmis.org> Cc: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
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: NDavid Howells <dhowells@redhat.com> cc: Andy Shevchenko <andy.shevchenko@gmail.com> cc: acpi4asus-user@lists.sourceforge.net cc: platform-driver-x86@vger.kernel.org cc: Matthew Garrett <mjg59@srcf.ucam.org> cc: Thomas Gleixner <tglx@linutronix.de> Cc: Greg KH <greg@kroah.com> Cc: Rafael J. Wysocki <rafael@kernel.org> Signed-off-by: NMatthew Garrett <matthewgarrett@google.com> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
Systems in lockdown mode should block the kexec of untrusted kernels. For x86 and ARM we can ensure that a kernel is trustworthy by validating a PE signature, but this isn't possible on other architectures. On those platforms we can use IMA digital signatures instead. Add a function to determine whether IMA has or will verify signatures for a given event type, and if so permit kexec_file() even if the kernel is otherwise locked down. This is restricted to cases where CONFIG_INTEGRITY_TRUSTED_KEYRING is set in order to prevent an attacker from loading additional keys at runtime. Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NMimi Zohar <zohar@linux.ibm.com> Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com> Cc: linux-integrity@vger.kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
Disallow the use of certain perf facilities that might allow userspace to access kernel data. Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
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: NAlexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: netdev@vger.kernel.org cc: Chun-Yi Lee <jlee@suse.com> cc: Alexei Starovoitov <alexei.starovoitov@gmail.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
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: NAlexei Starovoitov <alexei.starovoitov@gmail.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NMasami Hiramatsu <mhiramat@kernel.org> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: Naveen N. Rao <naveen.n.rao@linux.ibm.com> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: davem@davemloft.net Cc: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
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: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
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: NThomas Gleixner <tglx@linutronix.de> Signed-off-by: David Howells <dhowells@redhat.com Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org> Reviewed-by: NKees Cook <keescook@chromium.org> cc: Thomas Gleixner <tglx@linutronix.de> cc: Steven Rostedt <rostedt@goodmis.org> cc: Ingo Molnar <mingo@kernel.org> cc: "H. Peter Anvin" <hpa@zytor.com> cc: x86@kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
Provided an annotation for module parameters that specify hardware parameters (such as io ports, iomem addresses, irqs, dma channels, fixed dma buffers and other types). Suggested-by: NAlan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: Jessica Yu <jeyu@kernel.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
Lock down TIOCSSERIAL as that can be used to change the ioport and irq settings on a serial port. This only appears to be an issue for the serial drivers that use the core serial code. All other drivers seem to either ignore attempts to change port/irq or give an error. Reported-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
Prohibit replacement of the PCMCIA Card Information Structure when the kernel is locked down. Suggested-by: NDominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
custom_method effectively allows arbitrary access to system memory, making it possible for an attacker to circumvent restrictions on module loading. Disable it if the kernel is locked down. Signed-off-by: NMatthew Garrett <mjg59@google.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: linux-acpi@vger.kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
Writing to MSRs should not be allowed if the kernel is locked down, since it could lead to execution of arbitrary code in kernel mode. Based on a patch by Kees Cook. Signed-off-by: NMatthew Garrett <mjg59@google.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Acked-by: NKees Cook <keescook@chromium.org> Reviewed-by: NThomas Gleixner <tglx@linutronix.de> cc: x86@kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
IO port access would permit users to gain access to PCI configuration registers, which in turn (on a lot of hardware) give access to MMIO register space. This would potentially permit root to trigger arbitrary DMA, so lock it down by default. This also implicitly locks down the KDADDIO, KDDELIO, KDENABIO and KDDISABIO console ioctls. Signed-off-by: NMatthew Garrett <mjg59@google.com> Signed-off-by: NDavid Howells <dhowells@redhat.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: x86@kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
Any hardware that can potentially generate DMA has to be locked down in order to avoid it being possible for an attacker to modify kernel code, allowing them to circumvent disabled module loading or module signing. Default to paranoid - in future we can potentially relax this for sufficiently IOMMU-isolated devices. Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NBjorn Helgaas <bhelgaas@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: linux-pci@vger.kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Josh Boyer 提交于
There is currently no way to verify the resume image when returning from hibernate. This might compromise the signed modules trust model, so until we can work with signed hibernate images we disable it when the kernel is locked down. Signed-off-by: NJosh Boyer <jwboyer@fedoraproject.org> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: rjw@rjwysocki.net Cc: pavel@ucw.cz cc: linux-pm@vger.kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Jiri Bohac 提交于
This is a preparatory patch for kexec_file_load() lockdown. A locked down kernel needs to prevent unsigned kernel images from being loaded with kexec_file_load(). Currently, the only way to force the signature verification is compiling with KEXEC_VERIFY_SIG. This prevents loading usigned images even when the kernel is not locked down at runtime. This patch splits KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE. Analogous to the MODULE_SIG and MODULE_SIG_FORCE for modules, KEXEC_SIG turns on the signature verification but allows unsigned images to be loaded. KEXEC_SIG_FORCE disallows images without a valid signature. Signed-off-by: NJiri Bohac <jbohac@suse.cz> Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> cc: kexec@lists.infradead.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
The kexec_load() syscall permits the loading and execution of arbitrary code in ring 0, which is something that lock-down is meant to prevent. It makes sense to disable kexec_load() in this situation. This does not affect kexec_file_load() syscall which can check for a signature on the image to be booted. Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NDave Young <dyoung@redhat.com> Reviewed-by: NKees Cook <keescook@chromium.org> cc: kexec@lists.infradead.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
Allowing users to read and write to core kernel memory makes it possible for the kernel to be subverted, avoiding module loading restrictions, and also to steal cryptographic information. Disallow /dev/mem and /dev/kmem from being opened this when the kernel has been locked down to prevent this. Also disallow /dev/port from being opened to prevent raw ioport access and thus DMA from being used to accomplish the same thing. Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: x86@kernel.org Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 David Howells 提交于
If the kernel is locked down, require that all modules have valid signatures that we can verify. I have adjusted the errors generated: (1) If there's no signature (ENODATA) or we can't check it (ENOPKG, ENOKEY), then: (a) If signatures are enforced then EKEYREJECTED is returned. (b) If there's no signature or we can't check it, but the kernel is locked down then EPERM is returned (this is then consistent with other lockdown cases). (2) If the signature is unparseable (EBADMSG, EINVAL), the signature fails the check (EKEYREJECTED) or a system error occurs (eg. ENOMEM), we return the error we got. Note that the X.509 code doesn't check for key expiry as the RTC might not be valid or might not have been transferred to the kernel's clock yet. [Modified by Matthew Garrett to remove the IMA integration. This will be replaced with integration with the IMA architecture policy patchset.] Signed-off-by: NDavid Howells <dhowells@redhat.com> Signed-off-by: NMatthew Garrett <matthewgarrett@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: Jessica Yu <jeyu@kernel.org> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
While existing LSMs can be extended to handle lockdown policy, distributions generally want to be able to apply a straightforward static policy. This patch adds a simple LSM that can be configured to reject either integrity or all lockdown queries, and can be configured at runtime (through securityfs), boot time (via a kernel parameter) or build time (via a kconfig option). Based on initial code by David Howells. Signed-off-by: NMatthew Garrett <mjg59@google.com> Reviewed-by: NKees Cook <keescook@chromium.org> Cc: David Howells <dhowells@redhat.com> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
Add a mechanism to allow LSMs to make a policy decision around whether kernel functionality that would allow tampering with or examining the runtime state of the kernel should be permitted. Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NKees Cook <keescook@chromium.org> Acked-by: NCasey Schaufler <casey@schaufler-ca.com> Signed-off-by: NJames Morris <jmorris@namei.org>
-
由 Matthew Garrett 提交于
The lockdown module is intended to allow for kernels to be locked down early in boot - sufficiently early that we don't have the ability to kmalloc() yet. Add support for early initialisation of some LSMs, and then add them to the list of names when we do full initialisation later. Early LSMs are initialised in link order and cannot be overridden via boot parameters, and cannot make use of kmalloc() (since the allocator isn't initialised yet). (Fixed by Stephen Rothwell to include a stub to fix builds when !CONFIG_SECURITY) Signed-off-by: NMatthew Garrett <mjg59@google.com> Acked-by: NKees Cook <keescook@chromium.org> Acked-by: NCasey Schaufler <casey@schaufler-ca.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: NJames Morris <jmorris@namei.org>
-