All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Ryabinin <a.ryabinin@samsung.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Michal Marek <mmarek@suse.cz>,
	Sasha Levin <sasha.levin@oracle.com>,
	x86@kernel.org, linux-kbuild@vger.kernel.org,
	linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Dmitry Vyukov <dvyukov@google.com>,
	Konstantin Khlebnikov <koct9i@gmail.com>
Subject: kernel: clockevents: shift out-of-bounds
Date: Mon, 20 Oct 2014 15:07:50 +0400	[thread overview]
Message-ID: <5444ED06.6030008@samsung.com> (raw)
In-Reply-To: <1413802499-17928-1-git-send-email-a.ryabinin@samsung.com>


On kernel with UBSan enabled I've got following:

     UBSan: Undefined behaviour in ../kernel/time/clockevents.c:75:34
     shift exponent 32 is to large for 32-bit type 'unsigned int'
     CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.17.0-rc7+ #39
     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
      0000000000000000 0000000000000000 0000000000000001 ffffffff83003db0
      ffffffff82a30940 0000000000000020 ffffffff83003dc0 ffffffff819502e9
      ffffffff83003e40 ffffffff81950735 ffff88013f003233 0000000000000000
     Call Trace:
     dump_stack (/home/andrew/linux/lib/dump_stack.c:52)
     ubsan_epilogue (/home/andrew/linux/lib/ubsan.c:122)
     __ubsan_handle_shift_out_of_bounds (/home/andrew/linux/lib/ubsan.c:390)
     ? hpet_enable (/home/andrew/linux/arch/x86/kernel/hpet.c:862)
     cev_delta2ns (/home/andrew/linux/kernel/time/clockevents.c:75 (discriminator 1))
     clockevents_config.part.2 (/home/andrew/linux/kernel/time/clockevents.c:421)
     ? __clocksource_select (/home/andrew/linux/kernel/time/clocksource.c:607 /home/andrew/linux/kernel/time/clocksource.c:631)
     clockevents_config_and_register (/home/andrew/linux/kernel/time/clockevents.c:440)
     hpet_enable (/home/andrew/linux/arch/x86/kernel/hpet.c:305 /home/andrew/linux/arch/x86/kernel/hpet.c:891)
     hpet_time_init (/home/andrew/linux/arch/x86/kernel/time.c:79)
     x86_late_time_init (/home/andrew/linux/arch/x86/kernel/time.c:87)
     start_kernel (/home/andrew/linux/init/main.c:637)
     ? early_idt_handlers (/home/andrew/linux/arch/x86/kernel/head_64.S:344)
     x86_64_start_reservations (/home/andrew/linux/arch/x86/kernel/head64.c:194)
     x86_64_start_kernel (/home/andrew/linux/arch/x86/kernel/head64.c:183)

I guess it should be 1ULL here instead of 1U:
            (!ismax || evt->mult <= (1U << evt->shift)))


  parent reply	other threads:[~2014-10-20 11:07 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 10:54 [RFC] UBSan: run-time undefined behavior sanity checker Andrey Ryabinin
2014-10-20 10:54 ` [RFC PATCH] " Andrey Ryabinin
2014-10-20 19:35   ` Sasha Levin
2014-10-21  8:03     ` Andrey Ryabinin
2014-10-24  8:31       ` y.gribov
2014-10-24 10:36         ` Andrey Ryabinin
2014-10-21  9:47   ` Peter Zijlstra
2014-10-21 10:09     ` Andrey Ryabinin
2014-10-24 10:30       ` Peter Zijlstra
2014-10-21 17:06   ` Randy Dunlap
2014-10-22  9:58   ` Rasmus Villemoes
2014-10-22 11:16     ` Andrey Ryabinin
2014-10-20 11:03 ` drivers: random: Shift out-of-bounds in _mix_pool_bytes Andrey Ryabinin
2014-10-20 12:49   ` Theodore Ts'o
2014-10-20 13:58     ` Andrey Ryabinin
2014-10-20 14:08       ` Theodore Ts'o
2014-10-20 14:09       ` Daniel Borkmann
2014-10-20 14:13         ` Sasha Levin
2014-10-20 14:16         ` Theodore Ts'o
2014-10-20 14:42           ` Andrey Ryabinin
2014-10-24 10:01           ` Peter Zijlstra
2014-10-24 10:16             ` Andrey Ryabinin
2014-10-24 13:23             ` Sasha Levin
2014-10-24 13:42               ` Peter Zijlstra
2014-10-24 15:04                 ` Sasha Levin
2014-10-24 15:10                   ` Dmitry Vyukov
2014-10-24 21:05                     ` One Thousand Gnomes
2014-10-24 22:23                       ` H. Peter Anvin
2014-10-24 22:09                     ` Andreas Dilger
2014-10-24 22:22                       ` H. Peter Anvin
2014-10-25  0:50                         ` Sasha Levin
2014-10-25 20:30                           ` One Thousand Gnomes
2014-10-25 20:49                             ` Andrey Ryabinin
2014-10-20 11:07 ` Andrey Ryabinin [this message]
2014-10-24 10:25   ` kernel: clockevents: shift out-of-bounds Peter Zijlstra
2014-10-20 11:16 ` fs: ext4: mballoc: negative shift exponent Andrey Ryabinin
2014-10-20 11:23 ` jbd2: revoke: negative shift exponent in hash() Andrey Ryabinin

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=5444ED06.6030008@samsung.com \
    --to=a.ryabinin@samsung.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=hpa@zytor.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=peterz@infradead.org \
    --cc=sasha.levin@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.