general protection fault in smack_socket_sendmsg

Casey Schaufler casey at schaufler-ca.com
Tue Sep 3 23:17:58 UTC 2019


On 8/30/2019 10:33 PM, Hillf Danton wrote:
> On Fri, 30 Aug 2019 12:40:07 -0700
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit:    6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
>> git tree:       upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=11486cea600000
>> kernel config:  https://syzkaller.appspot.com/x/.config?x=58485246ad14eafe
>> dashboard link: https://syzkaller.appspot.com/bug?extid=5fd781d646d4fcbdfeb0
>> compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
>> 80fee25776c2fb61e74c1ecb1a523375c2500b69)
>>
>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+5fd781d646d4fcbdfeb0 at syzkaller.appspotmail.com
>>
>> kasan: CONFIG_KASAN_INLINE enabled
>> kasan: GPF could be caused by NULL-ptr deref or user memory access
>> general protection fault: 0000 [#1] PREEMPT SMP KASAN
>> CPU: 0 PID: 11983 Comm: kworker/0:0 Not tainted 5.3.0-rc6+ #94
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
>> Google 01/01/2011
>> Workqueue: krxrpcd rxrpc_peer_keepalive_worker
>> RIP: 0010:smack_socket_sendmsg+0x5b/0x480 security/smack/smack_lsm.c:3677
>> Code: e8 6a 07 71 fe 4c 89 e8 48 c1 e8 03 42 80 3c 38 00 74 08 4c 89 ef e8  
>> b4 ff a9 fe 4d 8b 65 00 48 83 c3 18 48 89 d8 48 c1 e8 03 <42> 80 3c 38 00  
>> 74 08 48 89 df e8 96 ff a9 fe 4c 8b 33 49 8d 9e 08
>> RSP: 0018:ffff8881daa1f9c8 EFLAGS: 00010206
>> RAX: 0000000000000003 RBX: 0000000000000018 RCX: ffff888048882500
>> RDX: 0000000000000000 RSI: ffff8881daa1fb18 RDI: 0000000000000000
>> RBP: ffff8881daa1fa80 R08: ffffffff8350cc90 R09: ffff8881daa1fb86
>> R10: ffffed103b543f72 R11: 0000000000000000 R12: ffff88803704c594
>> R13: ffff8881daa1fb18 R14: dffffc0000000000 R15: dffffc0000000000
>> FS:  0000000000000000(0000) GS:ffff8880aea00000(0000) knlGS:0000000000000000
>> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>> CR2: 00007f7d4f2b5028 CR3: 000000005e835000 CR4: 00000000001426f0
>> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>> Call Trace:
>>   security_socket_sendmsg+0x6c/0xd0 security/security.c:1973
>>   sock_sendmsg net/socket.c:654 [inline]
>>   kernel_sendmsg+0x77/0x140 net/socket.c:677
>>   rxrpc_send_keepalive+0x254/0x3c0 net/rxrpc/output.c:655
>>   rxrpc_peer_keepalive_dispatch net/rxrpc/peer_event.c:369 [inline]
>>   rxrpc_peer_keepalive_worker+0x76e/0xb40 net/rxrpc/peer_event.c:430
>>   process_one_work+0x7ef/0x10e0 kernel/workqueue.c:2269
>>   worker_thread+0xc01/0x1630 kernel/workqueue.c:2415
>>   kthread+0x332/0x350 kernel/kthread.c:255
>>   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
>> Modules linked in:
>> ---[ end trace 61235a384085b26a ]---

If you want to add a description and signed-off-by I will take this.

>  
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -3674,7 +3674,7 @@ static int smack_socket_sendmsg(struct s
>  	struct sockaddr_in6 *sap = (struct sockaddr_in6 *) msg->msg_name;
>  #endif
>  #ifdef SMACK_IPV6_SECMARK_LABELING
> -	struct socket_smack *ssp = sock->sk->sk_security;
> +	struct socket_smack *ssp;
>  	struct smack_known *rsp;
>  #endif
>  	int rc = 0;
> @@ -3684,6 +3684,15 @@ static int smack_socket_sendmsg(struct s
>  	 */
>  	if (sip == NULL)
>  		return 0;
> +	/*
> +	 * Fine if sock reaped
> +	 */
> +	if (!READ_ONCE(sock->sk))
> +		return 0;
> +
> +#ifdef SMACK_IPV6_SECMARK_LABELING
> +	ssp = sock->sk->sk_security;
> +#endif
>  
>  	switch (sock->sk->sk_family) {
>  	case AF_INET:
>



More information about the Linux-security-module-archive mailing list