Re: RFD: x32 ABI system call numbers

From: H.J. Lu
Date: Fri Sep 09 2011 - 17:02:13 EST


On Mon, Sep 5, 2011 at 8:11 AM, H.J. Lu <hjl.tools@xxxxxxxxx> wrote:
> On Mon, Sep 5, 2011 at 12:48 AM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>> On Sunday 04 September 2011 15:13:18 H.J. Lu wrote:
>>> On Sun, Sep 4, 2011 at 2:41 PM, Arnd Bergmann <arnd@xxxxxxxx> wrote:
>>> > On Sunday 04 September 2011 14:25:53 H.J. Lu wrote:
>>> >> >> >> #define __NR_x32_recvfrom
>>> >> >> >> #define __NR_x32_sendmsg
>>> >> >> >> #define __NR_x32_recvmsg
>>> >> >> >> #define __NR_x32_recvmmsg
>>> >> >> >> #define __NR_x32_sendmmsg
>>> >> >> >
>>> >> >> > These today use the MSG_CMSG_COMPAT flag to distinguish native and compat
>>> >> >> > calls. Do you plan to have another flag here to handle cmsg time values?
>>> >> >>
>>> >> >> I am using x86-32 calls for them.
>>> >> >
>>> >> > But isn't that broken? These all pass u64 or time_t values at some point.
>>> >> >
>>> >>
>>> >> time_t isn't a problem since time_t/timeval/timespec are identical for
>>> >> x32 and x86-64.  As for u64, I added NATIVE_LONG_TYPE, which is
>>> >> defined as long long for x32,  and use it instead of long in types for
>>> >> 64bit system calls.
>>> >
>>> > Sorry, I misread you as saying you use the compat syscalls for these.
>>> > If you use the native 64 bit syscalls, you have the opposite problem:
>>> > Some network protocols (e.g. netlink or rxrpc) use other data structures
>>> > that require conversion, e.g. 'long' members that x32 will get wrong.
>>>
>>> For those, I use x86-32 calls.
>>
>> So to ask again, what do you plan to do about SCM_TIMESTAMP*?
>>
>
> I added MSG_CMSG_COMPAT64 and new compat system calls with
> 64bit timespec/val to support it.  See the enclosed patch.
>

I decided to define

#define COMPAT_USE_64BIT_TIME \
((task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT) != 0)

instead of adding MSG_CMSG_COMPAT64. It can be used to check
64bit time_t, timespec and timeval in any system calls.

--
H.J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/