[CRIU] [PATCH] compel: Do not loose sign of result in compat syscall
Dmitry Safonov
0x7f454c46 at gmail.com
Tue Oct 31 16:14:21 MSK 2017
2017-10-31 12:58 GMT+00:00 Cyrill Gorcunov <gorcunov at gmail.com>:
> On Tue, Oct 31, 2017 at 12:43:04PM +0000, Dmitry Safonov wrote:
>> 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.
>
> We didn't merge any into vanilla criu yet, so if you have a better
> idea -- you are more than welcome!
I know, I didn't mean to say that your idea is bad,
that looks like they are all a bit of ugly:
1. Check (map & 0xffffffff) - this one
2. The way it's done in mmap_bug_test(): (map % PAGE_SIZE)
3. Add IS_ERR_VALUE(x, compat) (the ugliest, IMHO)
--
Dmitry
More information about the CRIU
mailing list