Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp805074imi; Fri, 22 Jul 2022 09:50:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vsDMnQVE8Fyz96xe8VmPHoD/fvGSZrQu2IkEprniV34yNA5/Yy61Huq5nDEwwt1s9l0aLt X-Received: by 2002:aca:ded5:0:b0:33a:66f6:5d27 with SMTP id v204-20020acaded5000000b0033a66f65d27mr7812267oig.0.1658508653643; Fri, 22 Jul 2022 09:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658508653; cv=none; d=google.com; s=arc-20160816; b=HU9FSBu5lo+58n/Xza7Kbi6po0Re41V1/ofBnKbs1s4jVwHW1sAgp/C2ioH8eUWsSi 498s3dxrbNPdQy1xMADqeDnttF7YepQ8SiY/K2WLGKu5cvaLTYGM/ztz69d3e5BRbyQC ld19U99kP5UKfrsT59JfP7jXOAd0HORsXlmfrIVzcT0Q81N6Hf9BnFZqWq1LbTcHSCXo L6w06buFeikSCtdGSZlbpueuAe62OL00Q/On0S5zbKAzbR+hPPCyl0DeM0hxl3SLoag1 q3g2q2IvTGRhPvzramN0ZVHbwZ+xKU9KJdPYp+7TChU23/N17INTdjQjggiFgzlh6ESc bxSw== 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:mime-version :dkim-signature; bh=NBunux7mrOollq5hvSvo0a9Z7T8alUFOipmy11b8qZI=; b=LQvlXjgFD+7LMA66fzUZYF+UsRa3GeHYQbvp+3W5m03f+tjQdvTEjtOSBuTQhfqvvA s94FQRA3BH0M6osxALO0qew4veFt+A7FFAeBm0IGFbadPm45J2osnqYCi4WT59fsTNWG Y5Yp81bzLKgrGW3jZRaMo/H0k81B7xTYMBvpQUWKSYO+/1NwcjGlHOrusxacPmSexkvw OAM6TFz42WjTjJRfSAWoZZAkP/Y1lPzhyG/8CXsOlTS9ymCrae2yaPX7EKIXUdMa8fTQ hiObiwkutA2d+ijXI6dM8SgXoQ2rDyDsb33+vaU0Zydy9H5WfehcVK3kmGFYu5M3P40x nWBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cUEbeCeb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a056830270400b0061cbb1f301fsi5617076otu.2.2022.07.22.09.50.37; Fri, 22 Jul 2022 09:50:53 -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=@gmail.com header.s=20210112 header.b=cUEbeCeb; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235804AbiGVQiI (ORCPT + 99 others); Fri, 22 Jul 2022 12:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiGVQiG (ORCPT ); Fri, 22 Jul 2022 12:38:06 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314159B1B1 for ; Fri, 22 Jul 2022 09:38:05 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id b11so9419887eju.10 for ; Fri, 22 Jul 2022 09:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=NBunux7mrOollq5hvSvo0a9Z7T8alUFOipmy11b8qZI=; b=cUEbeCebAbKQS1jL4ZGdvTqwDQ16U0gg1PtMxvOVjay61fi7yi78kFAf8D6B4Zq58Q LXaKfczR6cXxB6Mk7JNLOEuUaRPid6TQctJzlfIpkqsimD6mHKU7cX1GiFEgeCVl3rHl MesDi+p9StsN8j+/1JLXf4M1hzWKc7spPbu8oNhNFHBk1Ro1jdyvZy+OwLTcoPs0xdKZ 1cQSXav1b3RT1MJ+2Ez816mVDeUEdHdGHCwefUcYEz8GhDVr6Pq0dn1tv6hRzUH74R+v UxOabNcQbdY+kWjhQqh2hPY6QsjLrn6yS/FOf7qinJmo/KNCJY9E+ZZGjnPhPFcu+TkD Ue+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=NBunux7mrOollq5hvSvo0a9Z7T8alUFOipmy11b8qZI=; b=7t69h5QCWhaQpLeemrtPGwOhQUAKUGkAd0EItxpzRgRRCJgIAftTmnFF1R8KPYlJK2 zOplYQ2bs8IBDqzIOPGCp7iljbjQNjgOadCcF+BsGhywgDnIPchR1Dh1ofSS6Uy8dno9 N9YO5wxmRcePalplDDe5tmE3+nmmaZEHsR/R0By68Gs5ElKskINox9y1RPmf3GtR0ntS lv0QZhBHhjbHq38+6+5JH+wcI50UhBjv6y1VycYZ8RGtxMHlkgG1MEH7lQybE0bm7Rzj LrRzO+eSXUYMK3qNYidtkGhKhoRCUF1bSn0bCqCYobq/U01MbMEMKGZ2SF/bLbVH/eZ7 JeZg== X-Gm-Message-State: AJIora8aZcoszCtAYnUuXmaQoVxnepVicmCwl02Q4KsglMGccKNwVRk/ 3wKlloN6g4w4zFyEP0T8A28wGz3Ao+DeNklcd7o= X-Received: by 2002:a17:907:a05b:b0:72b:33f9:f927 with SMTP id gz27-20020a170907a05b00b0072b33f9f927mr561192ejc.707.1658507883630; Fri, 22 Jul 2022 09:38:03 -0700 (PDT) MIME-Version: 1.0 From: Dipanjan Das Date: Fri, 22 Jul 2022 09:37:52 -0700 Message-ID: Subject: KASAN: vmalloc-out-of-bounds Write in snd_pcm_hw_params To: perex@perex.cz, tiwai@suse.com, gregkh@linuxfoundation.org, consult.awy@gmail.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: syzkaller@googlegroups.com, fleischermarius@googlemail.com, its.priyanka.bose@gmail.com Content-Type: multipart/mixed; boundary="0000000000004323bf05e4677536" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 --0000000000004323bf05e4677536 Content-Type: text/plain; charset="UTF-8" Hi, We would like to report the following bug which has been found by our modified version of syzkaller. ====================================================== description: KASAN: vmalloc-out-of-bounds Write in snd_pcm_hw_params affected file: sound/core/pcm_native.c kernel version: 5.10.131 kernel commit: de62055f423f5dcb548f74cebd68f03c8903f73a git tree: upstream kernel config: https://syzkaller.appspot.com/x/.config?x=e49433cfed49b7d9 crash reproducer: attached ====================================================== Crash log: ====================================================== BUG: KASAN: vmalloc-out-of-bounds in memset include/linux/string.h:384 [inline] BUG: KASAN: vmalloc-out-of-bounds in snd_pcm_hw_params+0x19b0/0x1db0 sound/core/pcm_native.c:799 Write of size 2097152 at addr ffffc900113b2000 by task syz-executor.5/14437 CPU: 1 PID: 14437 Comm: syz-executor.5 Tainted: G OE 5.10.131+ #3 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:118 print_address_description.constprop.0.cold+0x5/0x4f7 mm/kasan/report.c:385 __kasan_report mm/kasan/report.c:545 [inline] kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562 check_memory_region_inline mm/kasan/generic.c:194 [inline] check_memory_region+0x187/0x1e0 mm/kasan/generic.c:200 memset+0x20/0x40 mm/kasan/common.c:85 memset include/linux/string.h:384 [inline] snd_pcm_hw_params+0x19b0/0x1db0 sound/core/pcm_native.c:799 snd_pcm_kernel_ioctl+0xd1/0x240 sound/core/pcm_native.c:3401 snd_pcm_oss_change_params_locked+0x17b6/0x3aa0 sound/core/oss/pcm_oss.c:965 snd_pcm_oss_change_params+0x76/0xd0 sound/core/oss/pcm_oss.c:1107 snd_pcm_oss_make_ready+0xb7/0x170 sound/core/oss/pcm_oss.c:1166 snd_pcm_oss_set_trigger.isra.0+0x34f/0x770 sound/core/oss/pcm_oss.c:2074 snd_pcm_oss_poll+0x679/0xb40 sound/core/oss/pcm_oss.c:2858 vfs_poll include/linux/poll.h:90 [inline] do_pollfd fs/select.c:872 [inline] do_poll fs/select.c:920 [inline] do_sys_poll+0x63c/0xe40 fs/select.c:1014 __do_sys_poll fs/select.c:1079 [inline] __se_sys_poll fs/select.c:1067 [inline] __x64_sys_poll+0x18c/0x490 fs/select.c:1067 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f095de4f4ed Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 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:00007f095bdffbe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000007 RAX: ffffffffffffffda RBX: 00007f095df6df60 RCX: 00007f095de4f4ed RDX: 0000000000000009 RSI: 0000000000000001 RDI: 00000000200000c0 RBP: 00007f095bdffc40 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000000001d R13: 00007ffff286ceff R14: 00007f095df6df60 R15: 00007f095bdffd80 Memory state around the buggy address: ffffc900115b1d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc900115b1d80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffc900115b1e00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 ^ ffffc900115b1e80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 ffffc900115b1f00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 ================================================================== -- Thanks and Regards, Dipanjan --0000000000004323bf05e4677536 Content-Type: application/octet-stream; name="repro.syz" Content-Disposition: attachment; filename="repro.syz" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5wop3q81 cjAgPSBvcGVuYXQkYWRzcDEoMHhmZmZmZmZmZmZmZmZmZjljLCAmKDB4N2YwMDAwMDAwMDQwKSwg MHgwLCAweDApCnBvbGwoJigweDdmMDAwMDAwMDBjMCk9W3tyMH1dLCAweDEsIDB4OSkgKGZhaWxf bnRoOiAxMSkK --0000000000004323bf05e4677536 Content-Type: text/x-csrc; charset="US-ASCII"; name="repro.c" Content-Disposition: attachment; filename="repro.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5wop3pn0 Ly8gYXV0b2dlbmVyYXRlZCBieSBzeXprYWxsZXIgKGh0dHBzOi8vZ2l0aHViLmNvbS9nb29nbGUv c3l6a2FsbGVyKQoKI2RlZmluZSBfR05VX1NPVVJDRSAKCiNpbmNsdWRlIDxhcnBhL2luZXQuaD4K I2luY2x1ZGUgPGVu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