From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757145AbcBCLjf (ORCPT ); Wed, 3 Feb 2016 06:39:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:57566 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751952AbcBCLjd (ORCPT ); Wed, 3 Feb 2016 06:39:33 -0500 Date: Wed, 03 Feb 2016 12:39:31 +0100 Message-ID: From: Takashi Iwai To: "Dmitry Vyukov" Cc: , "Jaroslav Kysela" , "LKML" , "Alexander Potapenko" , "Kostya Serebryany" , "syzkaller" , "Sasha Levin" Subject: Re: sound: out-of-bounds write in snd_rawmidi_kernel_write1 In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 03 Feb 2016 10:41:14 +0100, Takashi Iwai wrote: > > On Wed, 03 Feb 2016 10:35:14 +0100, > Takashi Iwai wrote: > > > > On Wed, 03 Feb 2016 09:57:50 +0100, > > Dmitry Vyukov wrote: > > > > > > Hello, > > > > > > The following program triggers an out-of-bounds write in > > > snd_rawmidi_kernel_write1 (run in parallel loop). It seems to try to > > > copy -1 bytes (aka 4GB) from user space into kernel smashing all on > > > its way. > > > > What card is /dev/midi3? Please check /proc/asound/cards. > > Is it MTPAV? > > In anyway the patch below should paper over it. But it's still > strange that it gets a negative value there. Could you put > > WARN_ON(count1 < 0) > > before the newly added check? > > I tried it locally with virmidi but it didn't appear, so far. Maybe > my setup is too slow and has fewer CPUs than yours. Scratch my previous patch, I could reproduce the issue on a faster machine in my office now :) Will work on it. Takashi