Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3789630rwb; Tue, 16 Aug 2022 08:48:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4TvwZsm7B/GY/7IfWptffLw2pslpGlz+zKVsDd2Ir5HtIahGVoEGAYYXGbFgCj/aEZbj2A X-Received: by 2002:a17:907:7ea8:b0:731:4fa1:d034 with SMTP id qb40-20020a1709077ea800b007314fa1d034mr13945873ejc.758.1660664894904; Tue, 16 Aug 2022 08:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660664894; cv=none; d=google.com; s=arc-20160816; b=1FWIG6Xg2Bze1E0697mRVTM8/tSeifMdY2a/b8t1ZW/hxCGPcmvyessRqCjns56tea sd3B0Gopoe9crp47yjqMUOHvlCftSbOLw+KGLuwr12+Up6H5q7HL2ZbV1khiMo9bzXgW IoDu4dDFTjUTxR30pJNAFL+0HKIFLDwZznpK4Az9QzORcoMVNEsHjKYe0gt4uf7m48// JmhoJgC03obL6s68hCDO5uW8MGpW43UquKgVHbcnqCT7kQzFht8puS0oAapX5+K8f+p0 /EdMjCKi4dJHbX1N32etjvHKtSx3rqQoJ0uMuoHYw2zzY1+0jqGVpcv01yAkLvn/fBDg Oaig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1ugMil36Xtwd1/JKqCHKq4YVp/gm6cZn6rXrNAhsLYg=; b=q65XW74dSNZ28dZWRBPg17xXE5XHSDixVJapNv4UEV+YIs47FwsP/r9tq+4YZNBXaZ QVYioBd1C///hA5nBZ2OeEGa8HQNB3Ngiko0uFp+zIJf80Y1pvqBDhJptHAKxsCQUj8D UgT/h2/8deebL5PBVVDHhwhfJdety0JkZg8c5vxd+c/g/8Ibwptkdv4XS39+EURb3x5S m08c1ljI8DzNvsFiKELhT0g2KtCdSkUjX792a8MAJ8molPHLMXIMRnLx5ySxifQuc61L xv3miVLamo4DJbFSu6yz1QwyNPPHi9x2WL8pmOVHcva95YNxO3IJtzYUWMb2B/lWRcOS 6RCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=YonhW7Zs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb12-20020a170907160c00b007304e6828a8si11626002ejc.631.2022.08.16.08.47.49; Tue, 16 Aug 2022 08:48:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=YonhW7Zs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235887AbiHPPEz (ORCPT + 99 others); Tue, 16 Aug 2022 11:04:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235852AbiHPPEc (ORCPT ); Tue, 16 Aug 2022 11:04:32 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82C1595E66 for ; Tue, 16 Aug 2022 08:02:00 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-f2a4c51c45so11901018fac.9 for ; Tue, 16 Aug 2022 08:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=1ugMil36Xtwd1/JKqCHKq4YVp/gm6cZn6rXrNAhsLYg=; b=YonhW7ZsvSSq1LlU1473zmh9bn8mDEW3u3IBe61E0fEG6iCtfKHZ61zAZ9ZaQI+yvU W+uVY2FriHHxRqPHB1StJ7rHgZYPYHvmIW1PMemedTOOycvqaMNzEdpim3vX8vKmlGsD 3vQn1Za+7NBq9+e1Xz1DSVkKlIdplv+E5zhbCksYOQ+/tO4tN4e3sHq4Co/D61htJyed TArsJUh1fr0Ixfqxczvz+pYCu/+iVUOI1z8ZJ//eR5zOXnSnSd7ETu2K6X8+sxdRONBF 44eaS+/X5OgA6XllGhpd5gah5I0HB637F6aI8EB2OqViU1w6n1Q1A7OBcxRmB7u/D6JT f0Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=1ugMil36Xtwd1/JKqCHKq4YVp/gm6cZn6rXrNAhsLYg=; b=FEbiGvbWRwfvcfPaYQHBtVtI7EETVujwXJegavEaQ1fE9y2da8ZZR6R+t95jmc34xm Zf7GSOXKUmFJUGkwhtTAlysxpax/17V9WjQ50HFI5vqyNzs4LJ+G2y/ELvO8FwEzSW13 RiN+UnQmPozmIln3xv4gTCnnII4jK/N/dlPhvsqt0nfFTXi14xmHfKnBa/5UV6nNaMb0 IYsnyRfMCiOkPdBuK2VB/RIygXddTzZQbEjNzYlPxklrjYRED+lbmahvf8qa/SKfaTpx 2b0OiFP8vfPb86pHKoEY4SLk70+rQlDGrxDZjYmUYXlO7wrDcjTIgLpi7kdrsYU7tyIv S4ew== X-Gm-Message-State: ACgBeo3sejQAtSQ+SO7qObsKcCq1OwAADJJqP2sEwQnJpQVJ1+q4uE8a ysjo/aVsn28U26DytBkeMmhHGKVYa430/e0vZas7 X-Received: by 2002:a05:6870:9588:b0:101:c003:bfe6 with SMTP id k8-20020a056870958800b00101c003bfe6mr13535837oao.41.1660662119002; Tue, 16 Aug 2022 08:01:59 -0700 (PDT) MIME-Version: 1.0 References: <0000000000002c46ec05e6572415@google.com> In-Reply-To: <0000000000002c46ec05e6572415@google.com> From: Paul Moore Date: Tue, 16 Aug 2022 11:01:48 -0400 Message-ID: Subject: Re: [syzbot] KASAN: use-after-free Read in sock_has_perm To: syzbot Cc: anton@enomsg.org, bpf@vger.kernel.org, ccross@android.com, eparis@parisplace.org, keescook@chromium.org, linux-kernel@vger.kernel.org, selinux@vger.kernel.org, stephen.smalley.work@gmail.com, syzkaller-bugs@googlegroups.com, tony.luck@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 16, 2022 at 4:00 AM syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit: 200e340f2196 Merge tag 'pull-work.dcache' of git://git.ker.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=16021dfd080000 > kernel config: https://syzkaller.appspot.com/x/.config?x=f2886ebe3c7b3459 > dashboard link: https://syzkaller.appspot.com/bug?extid=2f2c6bea25b08dc06f86 > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 > > Unfortunately, I don't have any reproducer for this issue yet. > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+2f2c6bea25b08dc06f86@syzkaller.appspotmail.com > > ================================================================== > BUG: KASAN: use-after-free in sock_has_perm+0x258/0x280 security/selinux/hooks.c:4532 > Read of size 8 at addr ffff88807630e480 by task syz-executor.0/8123 > > CPU: 1 PID: 8123 Comm: syz-executor.0 Not tainted 5.19.0-syzkaller-02972-g200e340f2196 #0 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 > Call Trace: > > __dump_stack lib/dump_stack.c:88 [inline] > dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 > print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313 > print_report mm/kasan/report.c:429 [inline] > kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 > sock_has_perm+0x258/0x280 security/selinux/hooks.c:4532 > selinux_socket_setsockopt+0x3e/0x80 security/selinux/hooks.c:4913 > security_socket_setsockopt+0x50/0xb0 security/security.c:2249 > __sys_setsockopt+0x107/0x6a0 net/socket.c:2233 > __do_sys_setsockopt net/socket.c:2266 [inline] > __se_sys_setsockopt net/socket.c:2263 [inline] > __x64_sys_setsockopt+0xba/0x150 net/socket.c:2263 > do_syscall_x64 arch/x86/entry/common.c:50 [inline] > do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 > entry_SYSCALL_64_after_hwframe+0x63/0xcd > RIP: 0033:0x7f96c7289279 > Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 > RSP: 002b:00007f96c842f168 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 > RAX: ffffffffffffffda RBX: 00007f96c739c050 RCX: 00007f96c7289279 > RDX: 0000000000000007 RSI: 0000000000000103 RDI: 0000000000000004 > RBP: 00007f96c72e3189 R08: 0000000000000004 R09: 0000000000000000 > R10: 0000000020000000 R11: 0000000000000246 R12: 0000000000000000 > R13: 00007ffe7030593f R14: 00007f96c842f300 R15: 0000000000022000 > SELinux hasn't changed anything in this area for a while, and looking over everything again just now it still looks sane to me. I suspect there is something else going on with respect to socket lifetimes and SELinux just happens to be the one that catches the use-after-free first. -- paul-moore.com