Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1403479

Re: UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:115:29

From Meelis Roos <mroos@linux.ee>
Newsgroups linux.kernel
Subject Re: UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:115:29
Date 2016-05-19 09:40 +0200
Message-ID <rAqIN-5bD-13@gated-at.bofh.it> (permalink)
References <rzvUd-2fp-5@gated-at.bofh.it> <rAe4W-5wO-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> I think UBSAN has correctly identified a bug.  I looked at the code in
> v4.6.  In file arch/x86/events/core.c, in the function
> filter_events(), there is a loop starting at line 1554 that should go
> over 10 event counters.  But in file arch/x86/events/intel/p6.c, only
> 8 event counters have been declared at line 9.
> 
> I have a fix but do not for sure if its reasonable.  I think we should
> pass on the max_events for the pmu to filter_events() function and
> change the loop condition accordingly.  Can you apply the patch below
> and test again?  It compiles, but I have not tested it.

Seems to work - warning is gone, everythins is detected as before.

-- 
Meelis Roos (mroos@linux.ee)

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:115:29 Meelis Roos <mroos@linux.ee> - 2016-05-16 21:00 +0200
  Re: UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:115:29 Nilay Vaish <nilayvaish@gmail.com> - 2016-05-18 20:10 +0200
    Re: UBSAN: Undefined behaviour in  arch/x86/events/intel/p6.c:115:29 Meelis Roos <mroos@linux.ee> - 2016-05-19 09:40 +0200

csiph-web