From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753848AbcESHgP (ORCPT ); Thu, 19 May 2016 03:36:15 -0400 Received: from smtp1.it.da.ut.ee ([193.40.5.66]:55768 "EHLO smtp1.it.da.ut.ee" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752550AbcESHgO (ORCPT ); Thu, 19 May 2016 03:36:14 -0400 Date: Thu, 19 May 2016 10:36:09 +0300 (EEST) From: Meelis Roos To: Nilay Vaish cc: Linux Kernel list , x86@kernel.org Subject: Re: UBSAN: Undefined behaviour in arch/x86/events/intel/p6.c:115:29 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LRH 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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)