[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm: Avoid integer overflow using MIDR_IMPLEMENTOR_MASK



Hi,

On 25/02/2022 10:59, Andrew Cooper wrote:
On 25/02/2022 10:54, Julien Grall wrote:
Hi Michal,

On 25/02/2022 08:38, Michal Orzel wrote:
Value of macro MIDR_IMPLEMENTOR_MASK exceeds the range of integer
and can lead to overflow. Currently there is no issue as it is used
in an expression implicitly casted to u32 in MIDR_IS_CPU_MODEL_RANGE.
To avoid possible problems, fix the macro.

Correct me if I am wrong, it sounds like this is only for hardening
purpose at the moment.

As this code is coming from Linux, I would prefer if we first upstream
to Linux and then port to Xen once merged.

Well.  The expression is undefined behaviour in C, because of shifting
into the sign bit.

In principle, the compiler is free to optimise is_affected_midr_range()
to "return true" as a consequence, even if compilers tend not to be that
malicious.

Are you arguing against fixing Linux first and the backport it to Xen?

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.