From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755763AbcIJQNF (ORCPT ); Sat, 10 Sep 2016 12:13:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37881 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755654AbcIJQND (ORCPT ); Sat, 10 Sep 2016 12:13:03 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: aneesh.kumar@linux.vnet.ibm.com From: "Aneesh Kumar K.V" To: Meelis Roos , Linux Kernel list , linuxppc-dev@lists.ozlabs.org Subject: Re: UBSAN: Undefined behaviour in arch/powerpc/kernel/cputable.c In-Reply-To: References: Date: Sat, 10 Sep 2016 21:42:55 +0530 MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16091016-0016-0000-0000-000004A2113F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005740; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00756117; UDB=6.00358218; IPR=6.00529226; BA=6.00004706; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012634; XFM=3.00000011; UTC=2016-09-10 16:13:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16091016-0017-0000-0000-000032CDE749 Message-Id: <87poobpwc8.fsf@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-10_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609100240 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Meelis Roos writes: > Got this on my PowerPC G4 (533 MHz, PowerPC 7410, PowerMac3,4 platform), > with gcc version 5.3.1 20160509 (Debian 5.3.1-19): > > [ 0.000000] ================================================================================ > [ 0.000000] UBSAN: Undefined behaviour in arch/powerpc/kernel/cputable.c:2240:25 > [ 0.000000] shift exponent 32 is too large for 32-bit type 'long unsigned int' > [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.8.0-rc5-00075-gd71f058 #106 > [ 0.000000] Call Trace: > [ 0.000000] [c0a5ff10] [c03aa588] ubsan_epilogue+0x18/0x4c (unreliable) > [ 0.000000] [c0a5ff20] [c03aab38] __ubsan_handle_shift_out_of_bounds+0xe8/0x13c > [ 0.000000] [c0a5ffa0] [c07c42d0] cpu_feature_keys_init+0xa0/0xb8 > [ 0.000000] [c0a5ffd0] [c07ca1fc] setup_feature_keys+0x14/0x24 > [ 0.000000] [c0a5ffe0] [c07c6c74] machine_init+0x18/0x58 > [ 0.000000] [c0a5fff0] [c000341c] start_here+0x38/0x78 > [ 0.000000] ================================================================================ > > Can you try diff --git a/arch/powerpc/include/asm/cpu_has_feature.h b/arch/powerpc/include/asm/cpu_has_feature.h index 2ef55f8968a2..b312b152461b 100644 --- a/arch/powerpc/include/asm/cpu_has_feature.h +++ b/arch/powerpc/include/asm/cpu_has_feature.h @@ -15,7 +15,7 @@ static inline bool early_cpu_has_feature(unsigned long feature) #ifdef CONFIG_JUMP_LABEL_FEATURE_CHECKS #include -#define NUM_CPU_FTR_KEYS 64 +#define NUM_CPU_FTR_KEYS BITS_PER_LONG extern struct static_key_true cpu_feature_keys[NUM_CPU_FTR_KEYS];