From: Casey Schaufler <casey@schaufler-ca.com>
To: Stephen Smalley <sds@tycho.nsa.gov>,
casey.schaufler@intel.com, jmorris@namei.org,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org
Cc: keescook@chromium.org, john.johansen@canonical.com,
penguin-kernel@i-love.sakura.ne.jp, paul@paul-moore.com,
Casey Schaufler <casey@schaufler-ca.com>
Subject: Re: [PATCH v14 00/23] LSM: Module stacking for AppArmor
Date: Fri, 24 Jan 2020 13:49:56 -0800 [thread overview]
Message-ID: <6b717a13-3586-5854-0eee-617798f92d34@schaufler-ca.com> (raw)
In-Reply-To: <22585291-b7e0-5a22-6682-168611d902fa@tycho.nsa.gov>
On 1/24/2020 1:04 PM, Stephen Smalley wrote:
> On 1/23/20 7:22 PM, Casey Schaufler wrote:
>> This patchset provides the changes required for
>> the AppArmor security module to stack safely with any other.
>>
>> v14: Rebase to 5.5-rc5
>> Incorporate feedback from v13
>> - Use an array of audit rules (patch 0002)
>> - Significant change, removed Acks (patch 0002)
>> - Remove unneeded include (patch 0013)
>> - Use context.len correctly (patch 0015)
>> - Reorder code to be more sensible (patch 0016)
>> - Drop SO_PEERCONTEXT as it's not needed yet (patch 0023)
>
> I don't know for sure if this is your bug, but it happens every time I boot with your patches applied and not at all on stock v5.5-rc5 so here it is. Will try to bisect as time permits but not until next week. Trigger seems to be loading the tun driver.
Thanks. I will have a look as well.
>
> [ 67.726834] tun: Universal TUN/TAP device driver, 1.6
> [ 67.736657] ==================================================================
> [ 67.741335] BUG: KASAN: slab-out-of-bounds in sock_init_data+0x14a/0x5a0
> [ 67.745037] Read of size 4 at addr ffff88870afe8928 by task libvirtd/1238
>
> [ 67.751861] CPU: 4 PID: 1238 Comm: libvirtd Tainted: G T 5.5.0-rc5+ #54
> [ 67.756250] Call Trace:
> [ 67.759510] dump_stack+0xb8/0x110
> [ 67.761604] print_address_description.constprop.0+0x1f/0x280
> [ 67.763768] __kasan_report.cold+0x75/0x8f
> [ 67.765895] ? sock_init_data+0x14a/0x5a0
> [ 67.768282] kasan_report+0xe/0x20
> [ 67.770397] sock_init_data+0x14a/0x5a0
> [ 67.772511] tun_chr_open+0x1de/0x280 [tun]
> [ 67.774644] misc_open+0x1cb/0x210
> [ 67.776820] chrdev_open+0x15b/0x350
> [ 67.778917] ? cdev_put.part.0+0x30/0x30
> [ 67.781030] do_dentry_open+0x2cb/0x800
> [ 67.783135] ? cdev_put.part.0+0x30/0x30
> [ 67.785225] ? devcgroup_check_permission+0x11a/0x260
> [ 67.787321] ? __x64_sys_fchdir+0xf0/0xf0
> [ 67.789418] ? security_inode_permission+0x5b/0x70
> [ 67.791513] path_openat+0x858/0x14a0
> [ 67.793589] ? path_mountpoint+0x5e0/0x5e0
> [ 67.795719] ? mark_lock+0xb8/0xb00
> [ 67.797786] do_filp_open+0x11e/0x1b0
> [ 67.799840] ? may_open_dev+0x60/0x60
> [ 67.801871] ? match_held_lock+0x1b/0x240
> [ 67.803968] ? lock_downgrade+0x360/0x360
> [ 67.805997] ? do_raw_spin_lock+0x119/0x1d0
> [ 67.808041] ? rwlock_bug.part.0+0x60/0x60
> [ 67.810099] ? do_raw_spin_unlock+0xa3/0x130
> [ 67.812244] ? _raw_spin_unlock+0x1f/0x30
> [ 67.814287] ? __alloc_fd+0x143/0x2f0
> [ 67.816324] do_sys_open+0x1f0/0x2d0
> [ 67.818358] ? filp_open+0x50/0x50
> [ 67.820404] ? trace_hardirqs_on_thunk+0x1a/0x1c
> [ 67.822447] ? lockdep_hardirqs_off+0xbe/0x100
> [ 67.824473] ? mark_held_locks+0x24/0x90
> [ 67.826484] do_syscall_64+0x74/0xd0
> [ 67.828480] entry_SYSCALL_64_after_hwframe+0x49/0xbe
> [ 67.830478] RIP: 0033:0x7f1a2cce6074
> [ 67.832495] Code: 24 20 eb 8f 66 90 44 89 54 24 0c e8 86 f4 ff ff 44 8b 54 24 0c 44 89 e2 48 89 ee 41 89 c0 bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 32 44 89 c7 89 44 24 0c e8 b8 f4 ff ff 8b 44
> [ 67.834760] RSP: 002b:00007f19e4af46d0 EFLAGS: 00000293 ORIG_RAX: 0000000000000101
> [ 67.837032] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1a2cce6074
> [ 67.839318] RDX: 0000000000000002 RSI: 00007f1a2d0bfb67 RDI: 00000000ffffff9c
> [ 67.841598] RBP: 00007f1a2d0bfb67 R08: 0000000000000000 R09: 00007f19e4af4914
> [ 67.843941] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002
> [ 67.846283] R13: 000000000000000d R14: 00007f19e4af4920 R15: 00007f1a2d0bfb67
>
> [ 67.850936] Allocated by task 1238:
> [ 67.853241] save_stack+0x1b/0x80
> [ 67.855533] __kasan_kmalloc.constprop.0+0xc2/0xd0
> [ 67.857935] sk_prot_alloc+0x115/0x170
> [ 67.860235] sk_alloc+0x2f/0xa10
> [ 67.862541] tun_chr_open+0x4d/0x280 [tun]
> [ 67.864894] misc_open+0x1cb/0x210
> [ 67.867164] chrdev_open+0x15b/0x350
> [ 67.869448] do_dentry_open+0x2cb/0x800
> [ 67.871768] path_openat+0x858/0x14a0
> [ 67.874041] do_filp_open+0x11e/0x1b0
> [ 67.876328] do_sys_open+0x1f0/0x2d0
> [ 67.878592] do_syscall_64+0x74/0xd0
> [ 67.880899] entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> [ 67.885431] Freed by task 726:
> [ 67.887689] save_stack+0x1b/0x80
> [ 67.889967] __kasan_slab_free+0x12c/0x170
> [ 67.892197] kfree+0xff/0x430
> [ 67.894444] uevent_show+0x176/0x1b0
> [ 67.896709] dev_attr_show+0x37/0x70
> [ 67.898940] sysfs_kf_seq_show+0x119/0x210
> [ 67.901159] seq_read+0x29d/0x720
> [ 67.903367] vfs_read+0xf9/0x1f0
> [ 67.905538] ksys_read+0xc9/0x160
> [ 67.907736] do_syscall_64+0x74/0xd0
> [ 67.909889] entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> [ 67.914100] The buggy address belongs to the object at ffff88870afe8000
> which belongs to the cache kmalloc-4k of size 4096
> [ 67.918357] The buggy address is located 2344 bytes inside of
> 4096-byte region [ffff88870afe8000, ffff88870afe9000)
> [ 67.922562] The buggy address belongs to the page:
> [ 67.924725] page:ffffea001c2bfa00 refcount:1 mapcount:0 mapping:ffff88881f00de00 index:0x0 compound_mapcount: 0
> [ 67.926926] raw: 0017ffe000010200 ffffea001c167a00 0000000200000002 ffff88881f00de00
> [ 67.929144] raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
> [ 67.931362] page dumped because: kasan: bad access detected
>
> [ 67.936192] Memory state around the buggy address:
> [ 67.938438] ffff88870afe8800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> [ 67.941078] ffff88870afe8880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> [ 67.943393] >ffff88870afe8900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> [ 67.945709] ^
> [ 67.948000] ffff88870afe8980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> [ 67.950311] ffff88870afe8a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> [ 67.952629] ==================================================================
next prev parent reply other threads:[~2020-01-24 21:50 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200124002306.3552-1-casey.ref@schaufler-ca.com>
2020-01-24 0:22 ` [PATCH v14 00/23] LSM: Module stacking for AppArmor Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 01/23] LSM: Infrastructure management of the sock security Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 02/23] LSM: Create and manage the lsmblob data structure Casey Schaufler
2020-01-24 14:21 ` Stephen Smalley
2020-01-24 0:22 ` [PATCH v14 03/23] LSM: Use lsmblob in security_audit_rule_match Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 04/23] LSM: Use lsmblob in security_kernel_act_as Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 05/23] net: Prepare UDS for security module stacking Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 06/23] Use lsmblob in security_secctx_to_secid Casey Schaufler
2020-01-24 14:29 ` Stephen Smalley
2020-01-24 0:22 ` [PATCH v14 07/23] LSM: Use lsmblob in security_secid_to_secctx Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 08/23] LSM: Use lsmblob in security_ipc_getsecid Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 09/23] LSM: Use lsmblob in security_task_getsecid Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 10/23] LSM: Use lsmblob in security_inode_getsecid Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 11/23] LSM: Use lsmblob in security_cred_getsecid Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 12/23] IMA: Change internal interfaces to use lsmblobs Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 13/23] LSM: Specify which LSM to display Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 14/23] LSM: Ensure the correct LSM context releaser Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 15/23] LSM: Use lsmcontext in security_secid_to_secctx Casey Schaufler
2020-01-24 0:22 ` [PATCH v14 16/23] LSM: Use lsmcontext in security_inode_getsecctx Casey Schaufler
2020-01-24 0:23 ` [PATCH v14 17/23] LSM: security_secid_to_secctx in netlink netfilter Casey Schaufler
2020-01-24 0:23 ` [PATCH v14 18/23] NET: Store LSM netlabel data in a lsmblob Casey Schaufler
2020-01-24 14:36 ` Stephen Smalley
2020-01-24 0:23 ` [PATCH v14 19/23] LSM: Verify LSM display sanity in binder Casey Schaufler
2020-01-24 0:23 ` [PATCH v14 20/23] Audit: Add subj_LSM fields when necessary Casey Schaufler
2020-01-24 0:23 ` [PATCH v14 21/23] Audit: Include object data for all security modules Casey Schaufler
2020-01-24 0:23 ` [PATCH v14 22/23] LSM: Add /proc attr entry for full LSM context Casey Schaufler
2020-01-24 14:42 ` Stephen Smalley
2020-01-24 16:20 ` Stephen Smalley
2020-01-24 19:28 ` Casey Schaufler
2020-01-24 20:16 ` Stephen Smalley
2020-01-27 20:05 ` Simon McVittie
2020-02-03 20:54 ` John Johansen
2020-01-27 22:49 ` Casey Schaufler
2020-01-31 22:10 ` Casey Schaufler
2020-02-03 18:54 ` Stephen Smalley
2020-02-03 19:37 ` Stephen Smalley
2020-02-03 21:39 ` Casey Schaufler
2020-02-04 13:37 ` Stephen Smalley
2020-02-04 17:14 ` Casey Schaufler
2020-02-10 11:56 ` Simon McVittie
2020-02-10 13:25 ` Stephen Smalley
2020-02-10 14:55 ` Stephen Smalley
2020-02-10 18:32 ` Casey Schaufler
2020-02-10 19:00 ` John Johansen
2020-02-11 15:59 ` Stephen Smalley
2020-02-11 17:58 ` John Johansen
2020-02-11 18:35 ` Casey Schaufler
2020-02-11 19:11 ` John Johansen
2020-02-10 18:56 ` John Johansen
2020-02-03 21:02 ` John Johansen
2020-02-03 21:43 ` Casey Schaufler
2020-02-03 22:49 ` John Johansen
2020-02-03 20:59 ` John Johansen
2020-01-24 0:23 ` [PATCH v14 23/23] AppArmor: Remove the exclusive flag Casey Schaufler
2020-01-24 15:05 ` [PATCH v14 00/23] LSM: Module stacking for AppArmor Stephen Smalley
2020-01-24 21:04 ` Stephen Smalley
2020-01-24 21:49 ` Casey Schaufler [this message]
2020-01-27 16:14 ` Stephen Smalley
2020-01-27 16:56 ` KASAN slab-out-of-bounds in tun_chr_open/sock_init_data (Was: Re: [PATCH v14 00/23] LSM: Module stacking for AppArmor) Stephen Smalley
2020-01-27 17:34 ` Casey Schaufler
2020-01-27 17:16 ` [PATCH v14 00/23] LSM: Module stacking for AppArmor Casey Schaufler
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=6b717a13-3586-5854-0eee-617798f92d34@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=casey.schaufler@intel.com \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=keescook@chromium.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=sds@tycho.nsa.gov \
--cc=selinux@vger.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).