ima: don't access a file's integrity status before an IMA policy is loaded
Subsystems (4)
Mimi Zohar
maintainerRFC PATCH 1/2 ima: don't access a file's integrity status before an IMA policy is loaded
From: Test <[email protected]>
Only after an IMA policy is loaded, check, save, or update the cached file's integrity status.
--- security/integrity/ima/ima_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
security/integrity/ima/ima_main.c +6 -0
@@ -606,6 +606,9 @@ void ima_post_create_tmpfile(struct user_namespace *mnt_userns,struct integrity_iint_cache *iint;int must_appraise; +if (!ima_policy_flag || !S_ISREG (inode->i_mode)) +return ; + must_appraise =ima_must_appraise (mnt_userns, inode,MAY_ACCESS ,FILE_CHECK );if (!must_appraise)
@@ -636,6 +639,9 @@ void ima_post_path_mknod(struct user_namespace *mnt_userns,struct inode *inode = dentry->d_inode;int must_appraise; +if (!ima_policy_flag || !S_ISREG (inode->i_mode)) +return ; + must_appraise =ima_must_appraise (mnt_userns, inode,MAY_ACCESS ,FILE_CHECK );if (!must_appraise)
Signature · 1 line
2.27.0
Mimi Zohar
maintainerRFC PATCH 2/2 integrity: double check iint_cache was initialized
From: Test <[email protected]>
The integrity's "iint_cache" is initialized at security_init(). Only after an IMA policy is loaded, which is initialized at late_initcall, is a file's integrity status stored in the "iint_cache".
All integrity_inode_get() callers first verify that the IMA policy has been loaded, before calling it. Yet for some reason, it is still being called, causing a NULL pointer dereference.
As reported by Dmitry Vyukov:
in qemu:
qemu-system-x86_64 -enable-kvm -machine q35,nvdimm -cpu
max,migratable=off -smp 4 -m 4G,slots=4,maxmem=16G -hda
wheezy.img -kernel arch/x86/boot/bzImage -nographic -vga std
-soundhw all -usb -usbdevice tablet -bt hci -bt device:keyboard
-net user,host=10.0.2.10,hostfwd=tcp::10022-:22 -net
nic,model=virtio-net-pci -object
memory-backend-file,id=pmem1,share=off,mem-path=/dev/zero,size=64M
-device nvdimm,id=nvdimm1,memdev=pmem1 -append "console=ttyS0
root=/dev/sda earlyprintk=serial rodata=n oops=panic panic_on_warn=1
panic=86400 lsm=smack numa=fake=2 nopcid dummy_hcd.num=8" -pidfilevm_pid -m 2G -cpu host
But it crashes on NULL deref in integrity_inode_get during boot:
Run /sbin/init as init process
BUG: kernel NULL pointer dereference, address: 000000000000001c PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP KASAN CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc2+ #97 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-44-g88ab0c15525c-prebuilt.qemu.org 04/01/2014 RIP: 0010:kmem_cache_alloc+0x2b/0x370 mm/slub.c:2920 Code: 57 41 56 41 55 41 54 41 89 f4 55 48 89 fd 53 48 83 ec 10 44 8b 3d d9 1f 90 0b 65 48 8b 04 25 28 00 00 00 48 89 44 24 08 31 c0 <8b> 5f 1c 4cf RSP: 0000:ffffc9000032f9d8 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff888017fc4f00 RCX: 0000000000000000 RDX: ffff888040220000 RSI: 0000000000000c40 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: ffff888019263627 R10: ffffffff83937cd1 R11: 0000000000000000 R12: 0000000000000c40 R13: ffff888019263538 R14: 0000000000000000 R15: 0000000000ffffff FS: 0000000000000000(0000) GS:ffff88802d180000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000000000001c CR3: 000000000b48e000 CR4: 0000000000750ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: integrity_inode_get+0x47/0x260 security/integrity/iint.c:105 process_measurement+0x33d/0x17e0 security/integrity/ima/ima_main.c:237 ima_bprm_check+0xde/0x210 security/integrity/ima/ima_main.c:474 security_bprm_check+0x7d/0xa0 security/security.c:845 search_binary_handler fs/exec.c:1708 [inline] exec_binprm fs/exec.c:1761 [inline] bprm_execve fs/exec.c:1830 [inline] bprm_execve+0x764/0x19a0 fs/exec.c:1792 kernel_execve+0x370/0x460 fs/exec.c:1973 try_to_run_init_process+0x14/0x4e init/main.c:1366 kernel_init+0x11d/0x1b8 init/main.c:1477 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Modules linked in: CR2: 000000000000001c ---[ end trace 22d601a500de7d79 ]---
Before calling kmem_cache_alloc(), check that the iint_cache has been initialized.
--- security/integrity/iint.c | 9 +++++++++ 1 file changed, 9 insertions(+)
security/integrity/iint.c +9 -0
@@ -97,6 +97,15 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)struct rb_node **p;struct rb_node *node, *parent =NULL ;struct integrity_iint_cache *iint, *test_iint; +static int once =0 ; + +if (!iint_cache) {/* shouldn't get here */ +if (!once) { +dump_stack (); + once =1 ; + } +return NULL ; + } iint =integrity_iint_find (inode);if (iint)
Signature · 1 line
2.27.0
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 8 lines · Mimi Zohar
The integrity's "
iint_cache" is initialized atsecurity_init(). Only after an IMA policy is loaded, which is initialized atlate_initcall, is a file's integrity status stored in the "iint_cache".All
integrity_inode_get()callers first verify that the IMA policy has been loaded, before calling it. Yet for some reason, it is still being called, causing a NULL pointer dereference.
Quoted 14 lines
As reported by Dmitry Vyukov:
in qemu:
qemu-system-x86_64 -enable-kvm -machine q35,nvdimm -cpu
max,migratable=off -smp 4 -m 4G,slots=4,maxmem=16G -hda
wheezy.img -kernelarch/x86/boot/bzImage-nographic -vga std
-soundhw all -usb -usbdevice tablet -bt hci -bt device:keyboard
-net user,host=10.0.2.10,hostfwd=tcp::10022-:22 -net
nic,model=virtio-net-pci -object
memory-backend-file,id=pmem1,share=off,mem-path=/dev/zero,size=64M
-device nvdimm,id=nvdimm1,memdev=pmem1 -append "console=ttyS0
root=/dev/sda earlyprintk=serial rodata=n oops=panic panic_on_warn=1
panic=86400 lsm=smack numa=fake=2 nopcid dummy_hcd.num=8" -pidfilevm_pid-m 2G -cpu host
I tried similar command line (without "-enable-kvm" and without "-cpu host" as I'm running from VMware, without "-soundhw all", without "-machine q35,nvdimm" and "-device nvdimm,id=nvdimm1,memdev=pmem1" etc.) on 5.12-rc4. While I was finally able to hit similar crash when I used "-smp 1" instead of "-smp 4", I suspect this is not a integrity module's problem but a memory initialization/corruption problem, for I got various different crashes (INT3) at memory allocation when I was trimming command line options trying to reproduce the same crash.
Dmitry, do you get different crashes by changing command line arguments?
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 33 lines · Tetsuo Handa
Quoted 8 lines · Mimi Zohar
The integrity's "
iint_cache" is initialized atsecurity_init(). Only after an IMA policy is loaded, which is initialized atlate_initcall, is a file's integrity status stored in the "iint_cache".All
integrity_inode_get()callers first verify that the IMA policy has been loaded, before calling it. Yet for some reason, it is still being called, causing a NULL pointer dereference.Quoted 14 lines
As reported by Dmitry Vyukov:
in qemu:
qemu-system-x86_64 -enable-kvm -machine q35,nvdimm -cpu
max,migratable=off -smp 4 -m 4G,slots=4,maxmem=16G -hda
wheezy.img -kernelarch/x86/boot/bzImage-nographic -vga std
-soundhw all -usb -usbdevice tablet -bt hci -bt device:keyboard
-net user,host=10.0.2.10,hostfwd=tcp::10022-:22 -net
nic,model=virtio-net-pci -object
memory-backend-file,id=pmem1,share=off,mem-path=/dev/zero,size=64M
-device nvdimm,id=nvdimm1,memdev=pmem1 -append "console=ttyS0
root=/dev/sda earlyprintk=serial rodata=n oops=panic panic_on_warn=1
panic=86400 lsm=smack numa=fake=2 nopcid dummy_hcd.num=8" -pidfilevm_pid-m 2G -cpu hostI tried similar command line (without "-enable-kvm" and without "-cpu host" as I'm running from VMware, without "-soundhw all", without "-machine q35,nvdimm" and "-device nvdimm,id=nvdimm1,memdev=pmem1" etc.) on 5.12-rc4. While I was finally able to hit similar crash when I used "-smp 1" instead of "-smp 4", I suspect this is not a integrity module's problem but a memory initialization/corruption problem, for I got various different crashes (INT3) at memory allocation when I was trimming command line options trying to reproduce the same crash.
Quoted 1 line
Dmitry, do you get different crashes by changing command line arguments?
No, I have not seen any other crashes, one the reported one.
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 9 lines · Mimi Zohar
The integrity's "
iint_cache" is initialized atsecurity_init(). Only after an IMA policy is loaded, which is initialized atlate_initcall, is a file's integrity status stored in the "iint_cache".All
integrity_inode_get()callers first verify that the IMA policy has been loaded, before calling it. Yet for some reason, it is still being called, causing a NULL pointer dereference.qemu-system-x86_64 (...snipped...) lsm=smack (...snipped...)
Hmm, why are you using lsm=smack instead of security=smack ?
Since use of lsm= overrides CONFIG_LSM="lockdown,yama,safesetid,integrity,tomoyo,smack,bpf" settings, only smack is activated, which means that integrity_iintcache_init() will not be called by
DEFINE_LSM(integrity) = {
.name = "integrity",
.init = integrity_iintcache_init,
};declaration. That's the reason iint_cache == NULL when integrity_inode_get() is called.
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 15 lines · Tetsuo Handa
Quoted 9 lines · Mimi Zohar
The integrity's "
iint_cache" is initialized atsecurity_init(). Only after an IMA policy is loaded, which is initialized atlate_initcall, is a file's integrity status stored in the "iint_cache".All
integrity_inode_get()callers first verify that the IMA policy has been loaded, before calling it. Yet for some reason, it is still being called, causing a NULL pointer dereference.qemu-system-x86_64 (...snipped...) lsm=smack (...snipped...)
Hmm, why are you using lsm=smack instead of security=smack ?
Since use of lsm= overridesCONFIG_LSM="lockdown,yama,safesetid,integrity,tomoyo,smack,bpf" settings, only smack is activated, which means thatintegrity_iintcache_init()will not be called by
Quoted 6 lines
DEFINE_LSM(integrity) = { .name = "integrity", .init = integrity_iintcache_init, };declaration. That's the reason
iint_cache== NULL whenintegrity_inode_get()is called.
That's exactly the problem, but since we don't control how the system is configured or which parameters are supplied on the boot command line, the kernel needs to at least provide some explanation instead of dereferencing a NULL pointer.
FYI, "security=" is being deprecated. From Documentation/admin-guide/kernel-parameters.txt:
security= [SECURITY] Choose a legacy "major" security module to
enable at boot. This has been deprecated by the "lsm=" parameter.
Please take a look at the newer version of this patch. Do you want to
add any tags?
thanks,
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 2 lines · Mimi Zohar
Please take a look at the newer version of this patch. Do you want to
add any tags?
Oh, I didn't know that you already posted the newer version.
Quoted 6 lines
security/integrity/iint.c +0
-0@@ -98,6 +98,14 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)struct rb_node *node, *parent =NULL ;
security/integrity/iint.c struct integrity_iint_cache *integrity_inode_get(struct inode *inode) · line 108
Quoted 10 lines
security/integrity/iint.c +8
-0struct integrity_iint_cache *iint, *test_iint; +/* +* The integrity's "iint_cache" is initialized at security_init(), +* unless it is not included in the ordered list of LSMs enabled +* on the boot command line. +*/ +if (!iint_cache) +panic ("%s: lsm=integrity required.\n" , __func__); +
This looks strange. If "lsm=" parameter must include "integrity", it implies that nobody is allowed to disable "integrity" at boot. Then, why not unconditionally call integrity_iintcache_init() by not counting on DEFINE_LSM(integrity) declaration?
Quoted 4 lines
security/integrity/iint.c +0
-0iint =integrity_iint_find (inode);if (iint)return iint;
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 14 lines · Tetsuo Handa
Quoted 2 lines · Mimi Zohar
Please take a look at the newer version of this patch. Do you want to
add any tags?Oh, I didn't know that you already posted the newer version.
Quoted 8 lines
security/integrity/iint.c +0
-0@@ -98,6 +98,14 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)struct rb_node *node, *parent =NULL ;struct integrity_iint_cache *iint, *test_iint;
Quoted 13 lines
security/integrity/iint.c struct integrity_iint_cache *integrity_inode_get(struct inode *inode) · line 108
Quoted 8 lines
security/integrity/iint.c +8
-0+/* +* The integrity's "iint_cache" is initialized at security_init(), +* unless it is not included in the ordered list of LSMs enabled +* on the boot command line. +*/ +if (!iint_cache) +panic ("%s: lsm=integrity required.\n" , __func__); +This looks strange. If "lsm=" parameter must include "integrity", it implies that nobody is allowed to disable "integrity" at boot. Then, why not unconditionally call
integrity_iintcache_init()by not counting onDEFINE_LSM(integrity)declaration?
Or, I think below one is also possible.
security/integrity/iint.c +27 -17
@@ -19,6 +19,7 @@#include <linux/uaccess.h> #include <linux/security.h> #include <linux/lsm_hooks.h> +#include <linux/sched/mm.h> #include "integrity.h" static struct rb_root integrity_iint_tree =RB_ROOT ;
@@ -85,6 +86,20 @@ static void iint_free(struct integrity_iint_cache *iint)kmem_cache_free (iint_cache, iint); } +static void init_once (void *foo) +{ +struct integrity_iint_cache *iint = foo; + +memset (iint,0 ,sizeof (*iint)); + iint->ima_file_status =INTEGRITY_UNKNOWN ; + iint->ima_mmap_status =INTEGRITY_UNKNOWN ; + iint->ima_bprm_status =INTEGRITY_UNKNOWN ; + iint->ima_read_status =INTEGRITY_UNKNOWN ; + iint->ima_creds_status =INTEGRITY_UNKNOWN ; + iint->evm_status =INTEGRITY_UNKNOWN ; +mutex_init (&iint->mutex); +} +/** * integrity_inode_get - find or allocate an iint associated with an inode * @inode: pointer to the inode
@@ -102,6 +117,18 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)if (iint)return iint; +if (!iint_cache) { +static DEFINE_MUTEX (lock); +unsigned int flags =memalloc_nofs_save (); + +mutex_lock (&lock); +if (!iint_cache) + iint_cache =kmem_cache_create ("iint_cache" , +sizeof (struct integrity_iint_cache ), +0 ,SLAB_PANIC , init_once); +mutex_unlock (&lock); +memalloc_nofs_restore (flags); + } iint =kmem_cache_alloc (iint_cache,GFP_NOFS );if (!iint)return NULL ;
@@ -150,25 +177,8 @@ void integrity_inode_free(struct inode *inode)iint_free (iint); } -static void init_once (void *foo) -{ -struct integrity_iint_cache *iint = foo; - -memset (iint,0 ,sizeof (*iint)); - iint->ima_file_status =INTEGRITY_UNKNOWN ; - iint->ima_mmap_status =INTEGRITY_UNKNOWN ; - iint->ima_bprm_status =INTEGRITY_UNKNOWN ; - iint->ima_read_status =INTEGRITY_UNKNOWN ; - iint->ima_creds_status =INTEGRITY_UNKNOWN ; - iint->evm_status =INTEGRITY_UNKNOWN ; -mutex_init (&iint->mutex); -} -static int __init integrity_iintcache_init (void ) { - iint_cache = -kmem_cache_create ("iint_cache" ,sizeof (struct integrity_iint_cache ), -0 ,SLAB_PANIC , init_once);return 0 ; }DEFINE_LSM (integrity) = {
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 15 lines · Tetsuo Handa
Quoted 14 lines · Tetsuo Handa
Quoted 2 lines · Mimi Zohar
Please take a look at the newer version of this patch. Do you want to
add any tags?Oh, I didn't know that you already posted the newer version.
Quoted 8 lines
security/integrity/iint.c +0
-0@@ -98,6 +98,14 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)struct rb_node *node, *parent =NULL ;struct integrity_iint_cache *iint, *test_iint;
Quoted 11 lines
Quoted 11 lines
security/integrity/iint.c struct integrity_iint_cache *integrity_inode_get(struct inode *inode) · line 108
Quoted 8 lines
security/integrity/iint.c +8
-0+/* +* The integrity's "iint_cache" is initialized at security_init(), +* unless it is not included in the ordered list of LSMs enabled +* on the boot command line. +*/ +if (!iint_cache) +panic ("%s: lsm=integrity required.\n" , __func__); +This looks strange. If "lsm=" parameter must include "integrity", it implies that nobody is allowed to disable "integrity" at boot.
Integrity isn't always required. Only when something tries to use it, does it need to be enabled. Since both integrity and the integrity caller are runtime dependent, it is up to the user/admin to specify "integrity" as an "lsm=" option.
Quoted 2 lines
Quoted 2 lines
Then, why not unconditionally call
integrity_iintcache_init()by not counting onDEFINE_LSM(integrity)declaration?
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.
Do we think calling panic() as "fix the NULL pointer dereferencing" ?
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 6 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Do we think calling
panic()as "fix the NULL pointer dereferencing" ?
Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.
Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.
What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling panic() does not cause DoS attack vector.
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 23 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 31 lines · Mimi Zohar
Quoted 23 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.
Quoted 3 lines
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
OK. Then, I expect that the system boots instead of calling panic(). That user is explicitly asking for disabling "integrity" for some reason.
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 33 lines · Tetsuo Handa
Quoted 31 lines · Mimi Zohar
Quoted 29 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.
Quoted 6 lines
Quoted 3 lines
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
OK. Then, I expect that the system boots instead of calling
panic(). That user is explicitly asking for disabling "integrity" for some reason.
That was actually my intention. The prebuilt kernel that I use for things has all LSMs enabled, but then I needed to try some workload with only 1 specific LSM, so I gave a different lsm= argument.
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 39 lines · Dmitry Vyukov
Quoted 37 lines · Tetsuo Handa
Quoted 34 lines · Mimi Zohar
Quoted 23 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
Quoted 6 lines
Quoted 2 lines
OK. Then, I expect that the system boots instead of calling
panic(). That user is explicitly asking for disabling "integrity" for some reason.That was actually my intention. The prebuilt kernel that I use for things has all LSMs enabled, but then I needed to try some workload with only 1 specific LSM, so I gave a different lsm= argument.
IMA/EVM is dependent on "integrity". Was your intention to also disable IMA and EVM? If so, when disabling "integrity", don't load an IMA policy.
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 44 lines · Mimi Zohar
Quoted 42 lines · Dmitry Vyukov
Quoted 39 lines · Tetsuo Handa
Quoted 31 lines · Mimi Zohar
Quoted 23 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.Quoted 3 lines
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
OK. Then, I expect that the system boots instead of calling
panic(). That user is explicitly asking for disabling "integrity" for some reason.
Quoted 6 lines
Quoted 3 lines
That was actually my intention. The prebuilt kernel that I use for things has all LSMs enabled, but then I needed to try some workload with only 1 specific LSM, so I gave a different lsm= argument.
IMA/EVM is dependent on "integrity". Was your intention to also disable IMA and EVM?
I think, yes... or not sure. I was trying to test a bug that requires a different major LSM and all minor LSMs are presumably irrelevant. I dropped existing lsm= arg and added something like lsm=apparmor.
Quoted 2 lines
If so, when disabling "integrity", don't load an
IMA policy.
I don't really know what this means. I guess it simply comes from the image? If so, there was no easy way to avoid loading.
Mimi Zohar
maintainerRe: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
Quoted 56 lines · Dmitry Vyukov
Quoted 44 lines · Mimi Zohar
Quoted 42 lines · Dmitry Vyukov
Quoted 39 lines · Tetsuo Handa
Quoted 31 lines · Mimi Zohar
Quoted 23 lines · Tetsuo Handa
Quoted 6 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Quoted 7 lines
Quoted 1 line
Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.Quoted 3 lines
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
OK. Then, I expect that the system boots instead of calling
panic(). That user is explicitly asking for disabling "integrity" for some reason.Quoted 6 lines
Quoted 3 lines
That was actually my intention. The prebuilt kernel that I use for things has all LSMs enabled, but then I needed to try some workload with only 1 specific LSM, so I gave a different lsm= argument.
IMA/EVM is dependent on "integrity". Was your intention to also disable IMA and EVM?
I think, yes... or not sure. I was trying to test a bug that requires a different major LSM and all minor LSMs are presumably irrelevant. I dropped existing lsm= arg and added something like lsm=apparmor.
Quoted 5 lines
Quoted 2 lines
If so, when disabling "integrity", don't load an
IMA policy.I don't really know what this means. I guess it simply comes from the image? If so, there was no easy way to avoid loading.
There are a couple of builtin IMA policies, which may be loaded on boot
by specifying on the boot command line "ima_policy=". Unless the boot
command line "ima_policy=" option is specified, no policy will loaded.
A custom IMA policy may subsequently be loaded, normally in the initramfs, by echo'ing the file pathname to /sys/kernel/security/ima/policy.
Mimi
Re: [RFC PATCH 2/2] integrity: double check iint_cache was initialized
In reply to Dmitry VyukovQuoted 37 lines · Dmitry Vyukov
Quoted 36 lines · Mimi Zohar
Quoted 35 lines · Dmitry Vyukov
Quoted 33 lines · Tetsuo Handa
Quoted 27 lines · Mimi Zohar
Quoted 20 lines · Tetsuo Handa
Quoted 11 lines · Mimi Zohar
Quoted 5 lines · Tetsuo Handa
Quoted 3 lines · Mimi Zohar
Initially I also questioned making "integrity" an LSM. Perhaps it's
time to reconsider. For now, it makes sense to just fix the NULL
pointer dereferencing.Do we think calling
panic()as "fix the NULL pointer dereferencing" ?Not supplying "integrity" as an "lsm=" option is a user error. There
are only two options - allow or deny the caller to proceed. If the
user is expecting the integrity subsystem to be properly working, returning a NULL and allowing the system to boot (RFC patch version)
does not make sense. Better to fail early.What does the "user" mean? Those who load the vmlinux? Only the "root" user (so called administrators)? Any users including other than "root" user?
If the user means those who load the vmlinux, that user is explicitly asking for disabling "integrity" for some reason. In that case, it is a bug if booting with "integrity" disabled is impossible.
Quoted 6 lines
If the user means something other than those who load the vmlinux, is there a possibility that that user (especially non "root" users) is allowed to try to use "integrity" ? If processes other than global init process can try to use "integrity", wouldn't it be a DoS attack vector? Please explain in the descripotion why calling
panic()does not cause DoS attack vector.Quoted 3 lines
User in this case, is anyone rebooting the system and is intentionally changing the default values, dropping the "integrity" option on the boot command line.
OK. Then, I expect that the system boots instead of calling
panic(). That user is explicitly asking for disabling "integrity" for some reason.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
That was actually my intention. The prebuilt kernel that I use for things has all LSMs enabled, but then I needed to try some workload with only 1 specific LSM, so I gave a different lsm= argument.
IMA/EVM is dependent on "integrity". Was your intention to also disable IMA and EVM?
I think, yes... or not sure. I was trying to test a bug that requires a different major LSM and all minor LSMs are presumably irrelevant. I dropped existing lsm= arg and added something like lsm=apparmor.
This is the legacy case that security= supports. If you specify security=apparmor you will get all the "minor" LSMs you have compiled in and the "major" LSM you've specified, AppArmor in this case. This is exactly the behavior you used to get before lsm= was introduced.
Quoted 5 lines
Quoted 3 lines
If so, when disabling "integrity", don't load an
IMA policy.I don't really know what this means. I guess it simply comes from the image? If so, there was no easy way to avoid loading.