From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 426Z8K1RNNzF3Tr for ; Sat, 8 Sep 2018 09:56:00 +1000 (AEST) Received: by mail-wm0-x241.google.com with SMTP id 207-v6so15947858wme.5 for ; Fri, 07 Sep 2018 16:56:00 -0700 (PDT) Date: Sat, 8 Sep 2018 01:55:54 +0200 From: Luc Van Oostenryck To: Christophe LEROY Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sparse@vger.kernel.org Subject: Re: [PATCH] perf: enum overflow in uapi/linux/perf_event.h Message-ID: <20180907235552.6a6oytkzzpn4pcgl@ltop.local> References: <20180907134246.GC24106@hirez.programming.kicks-ass.net> <20180907135817.GF24106@hirez.programming.kicks-ass.net> <7a086a56-a896-9513-7315-9d0d21b61a44@c-s.fr> <20180907184358.pg2ho4m4tc3dpwlw@ltop.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: <20180907184358.pg2ho4m4tc3dpwlw@ltop.local> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, Sep 07, 2018 at 08:43:59PM +0200, Luc Van Oostenryck wrote: > On Fri, Sep 07, 2018 at 04:15:33PM +0200, Christophe LEROY wrote: > > Le 07/09/2018 à 15:58, Peter Zijlstra a écrit : > > > On Fri, Sep 07, 2018 at 01:50:18PM +0000, Christophe Leroy wrote: > > > > > > > > > > > > On 09/07/2018 01:42 PM, Peter Zijlstra wrote: > > > > > On Fri, Sep 07, 2018 at 01:27:19PM +0000, Christophe Leroy wrote: > > > > > > On PPC32, enums are 32 bits, so __PERF_SAMPLE_CALLCHAIN_EARLY is > > > > > > out of scope. The following sparse warning is encountered: > > > > > > > > > > > > CHECK arch/powerpc/kernel/process.c > > > > > > ./include/uapi/linux/perf_event.h:147:56: warning: cast truncates bits from constant value (8000000000000000 becomes 0) > > > > > > > > > > Urgh... what compiler is that? I've not seen anything like that from the > > > > > build bots. > > > > > > > > > > > > > [root@pc16082vm linux-powerpc]# sparse --version > > > > 0.5.2 > > > > > > > > [root@pc16082vm linux-powerpc]# ppc-linux-gcc --version > > > > ppc-linux-gcc (GCC) 5.4.0 > > > > > > Ah, that's a sparse warning. But does your GCC agree? The thing is, > > > sparse uses the C enum spec, but I suspect GCC uses the C++ enum spec > > > and it all works fine. > > Sparse is a bit weird about the exact underlying type used for enums. > > > Ah yes, it seems that GCC is happy. So sparse should be fixed instead ? > > I'll investigate (I suppose the same is given on x86-32). It's definitively a bug in sparse. A relatively nasty one and which open a can of worms. Fortunately, I had already looked at these problems in May, I just didn't had the time to push the patches. -- Luc