[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1401261335400.26515@chino.kir.corp.google.com>
Date: Sun, 26 Jan 2014 13:38:34 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Ren Qiaowei <qiaowei.ren@...el.com>
cc: "H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/4] x86, mpx: extend siginfo structure to include
bound violation information
On Sun, 26 Jan 2014, Ren Qiaowei wrote:
> > arch/x86/kernel/mpx.c: In function ‘do_mpx_bounds’:
> > arch/x86/kernel/mpx.c:407:3: warning: cast to pointer from integer of
> > different size [-Wint-to-pointer-cast]
> > arch/x86/kernel/mpx.c:409:3: warning: cast to pointer from integer of
> > different size [-Wint-to-pointer-cast]
> >
> > and the documentation says you explicitly want to support this config.
> >
> > These types of warnings are usually indicative of real problems when
> > you're storing upper and lower bits in 32-bit fields after casting them
> > from 64-bit values.
> >
> > I'm also not sure if the added fields to the generic struct siginfo can be
> > justified for this.
> >
> According to MPX spec, for 32-bit case, the upper 32-bits of 64-bits bound
> register are ignored, and so casting to pointer from 64-bit values should be
> not produce any problems.
>
Ok, so this is intended per the spec which nobody reading the code is
going to know and people who report the compile warnings are going to
continue to question it.
How are you planning on suppressing the warnings? It will probably
require either
- separate 64-bit and 32-bit helper functions to do_mpx_bounds() to
do appropriate casts before casting to a pointer, or
- a macro defined as a no-op for 64-bit and as a cast to 32-bit value
for 32-bit configs that will be used in do_mpx_bounds() and casted
to the pointer.
Powered by blists - more mailing lists