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]
Date:	Tue, 8 Sep 2015 17:27:39 +0200
From:	Stephane Eranian <eranian@...glemail.com>
To:	Vince Weaver <vincent.weaver@...ne.edu>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: Re: perf: fuzzer PEBS record without PEBS event! crash

On Tue, Sep 8, 2015 at 5:32 PM, Vince Weaver <vincent.weaver@...ne.edu> wrote:
> On Mon, 7 Sep 2015, Stephane Eranian wrote:
>
>> On Mon, Sep 7, 2015 at 2:44 AM, Vince Weaver <vincent.weaver@...ne.edu> wrote:
>> > On Sun, 6 Sep 2015, Stephane Eranian wrote:
>> >
>> >> > [ 1800.285152] ------------[ cut here ]------------
>> >> > [ 1800.290757] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/cpu/perf_event_intel_ds.c:1210 intel_pmu_drain_pebs_nhm+0x305/0x320()
>> >> > [ 1800.303301] PEBS record without PEBS event! status=2 pebs_enabled=1 active_mask=200000000
>> >> > [ 1800.311916] Modules linked in: binfmt_misc intel_rapl iosf_mbi x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_hdmi hmac drbg ansi_cprng i915 aesni_intel aes_x86_64 snd_hda_codec_realtek snd_hda_codec_generic lrw snd_hda_intel snd_hda_codec iTCO_wdt gf128mul drm_kms_helper snd_hda_core ppdev iTCO_vendor_support evdev glue_helper ablk_helper cryptd parport_pc snd_hwdep snd_pcm snd_timer psmouse tpm_tis tpm drm i2c_algo_bit sg parport snd pcspkr video serio_raw processor soundcore mei_me lpc_ich mfd_core mei i2c_i801 wmi button battery sr_mod sd_mod cdrom ehci_pci ehci_hcd xhci_pci xhci_hcd ahci libahci libata e1000e ptp usbcore crc32c_intel scsi_mod pps_core usb_common fan thermal
>> >> > [ 1800.390813] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W       4.2.0+ #173
>> >> > [ 1800.399488] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
>> >> > [ 1800.408243]  ffffffff81a0d828 ffff88011ea03aa8 ffffffff8169da0c ffff88011ea03af0
>> >> > [ 1800.417089]  ffff88011ea03ae0 ffffffff8106e812 0000000000000001 ffff880119000000
>> >> > [ 1800.426024]  ffff88011ea0c120 ffff88011900ffc0 ffff880119000000 ffff88011ea03b40
>> >> > [ 1800.434946] Call Trace:
>> >> > [ 1800.438453]  <IRQ>  [<ffffffff8169da0c>] dump_stack+0x44/0x55
>> >> > [ 1800.445504]  [<ffffffff8106e812>] warn_slowpath_common+0x82/0xc0
>> >> > [ 1800.452832]  [<ffffffff8106e89c>] warn_slowpath_fmt+0x4c/0x50
>> >> > [ 1800.459879]  [<ffffffff8102f7d5>] intel_pmu_drain_pebs_nhm+0x305/0x320
>> >> > [ 1800.467725]  [<ffffffff810b6b69>] ? __lock_acquire.isra.31+0x349/0xfc0
>> >> > [ 1800.475613]  [<ffffffff8102ec38>] intel_pmu_drain_pebs_buffer+0x18/0x20
>> >>
>> >>
>> >> What would help here is if you could get the source line number. You can do that
>> >> with gdb:
>> >>      gdb vmlinux
>> >>      (gdb) info line *0xffffffff8102ec38
>> >
>> > (gdb) info line *0xffffffff8102ec38
>> > Line 567 of "arch/x86/kernel/cpu/perf_event_intel_ds.c"
>> >    starts at address 0xffffffff8102ec38 <intel_pmu_drain_pebs_buffer+24>
>> >    and ends at 0xffffffff8102ec40 <release_pebs_buffer>.
>> >
>> > Line 567 isn't that helpful, it's just the last line of
>> > intel_pmu_drain_pebs_buffer() but that's possibly because I have done a
>> > git pull since the time I built the kernel so the source tree doesn't
>> > match up.
>> >
>> Do it again with the matching source tree. Addresses change all the time.
>
> I re-compiled with current git, and the source matches the kernel exactly
> now.  I managed to trigger the warning again (though it didn't trigger a
> crash yet).  Still got line 567
>
> [ 6890.067085] WARNING: CPU: 7 PID: 7 at arch/x86/kernel/cpu/perf_event_intel_ds.c:1210 intel_pmu_drain_pebs_nhm+0x305/0x320()
> [ 6890.078963] PEBS record without PEBS event! status=0 pebs_enabled=1 active_mask=200000001
> [ 6890.199394] Call Trace:
> [ 6890.202024]  [<ffffffff8169ffe0>] dump_stack+0x44/0x55
> [ 6890.207516]  [<ffffffff8106e8b2>] warn_slowpath_common+0x82/0xc0
> [ 6890.213990]  [<ffffffff8106e93c>] warn_slowpath_fmt+0x4c/0x50
> [ 6890.220128]  [<ffffffff8102f7d5>] intel_pmu_drain_pebs_nhm+0x305/0x320
> [ 6890.227092]  [<ffffffff8102ec38>] intel_pmu_drain_pebs_buffer+0x18/0x20
>
> (gdb) info line *0xffffffff8102ec38
> Line 567 of "arch/x86/kernel/cpu/perf_event_intel_ds.c"
>    starts at address 0xffffffff8102ec38 <intel_pmu_drain_pebs_buffer+24>
>    and ends at 0xffffffff8102ec40 <release_pebs_buffer>.
>
>
> which is
>
> 562:static inline void intel_pmu_drain_pebs_buffer(void)
> 563:{
> 564:        struct pt_regs regs;
> 565:
> 566:        x86_pmu.drain_pebs(&regs);
> 567: }
>
> which seems odd, though I guess because it is inlined?
>
Has to do with inlining. Make the function not inlined.

static void intel_pmu_drain_pebs_buffer(void) __attribute__((noinline));
static inline void intel_pmu_drain_pebs_buffer(void)
{
        struct pt_regs regs;

        x86_pmu.drain_pebs(&regs);
}
--
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