lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141024102539.GG12706@worktop.programming.kicks-ass.net>
Date:	Fri, 24 Oct 2014 12:25:39 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Andrey Ryabinin <a.ryabinin@...sung.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, Michal Marek <mmarek@...e.cz>,
	Sasha Levin <sasha.levin@...cle.com>, x86@...nel.org,
	linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
	Theodore Ts'o <tytso@....edu>,
	Andreas Dilger <adilger.kernel@...ger.ca>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Konstantin Khlebnikov <koct9i@...il.com>
Subject: Re: kernel: clockevents: shift out-of-bounds

On Mon, Oct 20, 2014 at 03:07:50PM +0400, Andrey Ryabinin wrote:
> 
> 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)))

Probably so indeed, clocks_calc_mult_shift() has max return value of 32,
which will indeed trigger that overflow.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ