[CRIU] [PATCH] compel: Do not loose sign of result in compat syscall

Dmitry Safonov 0x7f454c46 at gmail.com
Tue Oct 31 15:43:04 MSK 2017


2017-10-31 12:33 GMT+00:00 Cyrill Gorcunov <gorcunov at gmail.com>:
> On Tue, Oct 31, 2017 at 12:08:11PM +0000, Dmitry Safonov wrote:
>> >
>> > Not exactly. We could generate a mask from it but I think it's not that required,
>> > at least by now.
>>
>> Wait, I kind of don't get it:
>> How map can be > 4 bytes if you get it from (user_regs_struct32::ax), which is
>> 4 bytes (u32) for compat tasks?
>> We may insert BUG_ON(map & 0xffffffff00000000) or something.
>
> Because we convert uint -> int -> long, and the sing of int get
> propagated to upper bits. The map can't be more than 4 bytes but
> we use signed long to keep the result.

Ok, I see, the sign extension.
It's not a very lovely solution but should work.

-- 
             Dmitry


More information about the CRIU mailing list