mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Dongliang Mu <mudongliangabcd@gmail.com>,
	allen.lkml@gmail.com, alsa-devel@alsa-project.org,
	Joe Perches <joe@perches.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	pierre-louis.bossart@linux.intel.com, romain.perier@gmail.com,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	tiwai@suse.com
Subject: Re: [syzbot] UBSAN: shift-out-of-bounds in snd_timer_user_ccallback
Date: Wed, 2 Jun 2021 16:19:13 +0200	[thread overview]
Message-ID: <5c3fbdf8-bfa3-a50e-edb9-81fbce84d9cb@perex.cz> (raw)
In-Reply-To: <CAD-N9QUDYbzkZXnDzf2P4b4Qk_kBQ_9ZVL3B4jhe9Xf2rgtpGA@mail.gmail.com>

On 02. 06. 21 15:18, Dongliang Mu wrote:
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: 5ff2756a Merge tag 'nfs-for-5.13-2' of git://git.linux-nfs..
>> git tree: upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=17872d5bd00000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=770708ea7cfd4916
>> dashboard link: https://syzkaller.appspot.com/bug?extid=d102fa5b35335a7e544e
>>
>> 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+d102fa...@syzkaller.appspotmail.com
>>
>> ================================================================================
>> UBSAN: shift-out-of-bounds in sound/core/timer.c:1376:23
>> shift exponent 105 is too large for 32-bit type 'int'
>> CPU: 1 PID: 10368 Comm: syz-executor.1 Not tainted 5.13.0-rc3-syzkaller #0
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
>> Call Trace:
>> __dump_stack lib/dump_stack.c:79 [inline]
>> dump_stack+0x141/0x1d7 lib/dump_stack.c:120
>> ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
>> __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:327
>> snd_timer_user_ccallback.cold+0x19/0x1e sound/core/timer.c:1376
>>
>> snd_timer_notify1+0x243/0x3b0 sound/core/timer.c:525
> 
> The root cause of this bug is in the snd_timer_notify1 [1]. At the end
> of this function, it calls "ts->ccallback(ts, event + 100, &tstamp,
> resolution)".
> 
> Here the variable event is 5. It adds 100 and is passed as 2nd
> argument of snd_timer_user_ccallback.
> 
>>From the variable naming, the 2nd argument should an event, and in the
> range of event enumeration. In fact, 105 (event + 100) is out of this
> range. I don't quite understand the meaning of adding 100. Any thought
> here?

It seems that the original intent was to move the event to the M... events:

     SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10,

So the added value should be 10 which should not break the shift range (8
/resume/ + 10 = 18).

					Jaroslav

> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/core/timer.c?id=5ff2756afde08b266fbb673849899fec694f39f1#n497
> 
> --
> My best regards to you.
> 
>      No System Is Safe!
>      Dongliang Mu
> 


-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

  reply	other threads:[~2021-06-02 14:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 13:18 Dongliang Mu
2021-06-02 14:19 ` Jaroslav Kysela [this message]
2021-06-02 14:24   ` Takashi Iwai
2021-06-02 14:42   ` Dongliang Mu
  -- strict thread matches above, loose matches on Subject: below --
2021-06-01 23:58 syzbot

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=5c3fbdf8-bfa3-a50e-edb9-81fbce84d9cb@perex.cz \
    --to=perex@perex.cz \
    --cc=allen.lkml@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mudongliangabcd@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=romain.perier@gmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®