[RFC,1/2] sparc32: Mark sendmsg and recvmsg system calls as unsupported

Message ID 1478012867-6031-2-git-send-email-andreas@gaisler.com
State New, archived
Headers

Commit Message

Andreas Larsson Nov. 1, 2016, 3:07 p.m. UTC
  This fixes a bug introduced by abf29edd4a3918 that missed fixing up
sparc32 in the change.

	* sysdeps/unix/sysv/linux/sparc/kernel-features.h: Undefine
	__ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL for 32-bit
	sparcv8
---
 sysdeps/unix/sysv/linux/sparc/kernel-features.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Adhemerval Zanella Netto Nov. 1, 2016, 5:28 p.m. UTC | #1
On 01/11/2016 13:07, Andreas Larsson wrote:
> This fixes a bug introduced by abf29edd4a3918 that missed fixing up
> sparc32 in the change.
> 
> 	* sysdeps/unix/sysv/linux/sparc/kernel-features.h: Undefine
> 	__ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL for 32-bit
> 	sparcv8
> ---
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index 69c9c7c..db3f5cd 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -32,8 +32,10 @@
>  #include_next <kernel-features.h>
>  
>  /* 32-bit SPARC kernels do not support
> -   futex_atomic_cmpxchg_inatomic.  */
> +   futex_atomic_cmpxchg_inatomic or sendmsg/recvmsg.  */
>  #if !defined __arch64__ && !defined __sparc_v9__
>  # undef __ASSUME_REQUEUE_PI
>  # undef __ASSUME_SET_ROBUST_LIST
> +# undef __ASSUME_SENDMSG_SYSCALL
> +# undef __ASSUME_RECVMSG_SYSCALL
>  #endif
> 

At least the kernel headers for Linux 3.2 on sparc defined both __NR_recvmsg
and __NR_sendmsg.  Also, checking 'arch/sparc/kernel/sys32.S' on 3.2 does
seems that sparc32 have both recvmsg and sendmsg wire-up.  Am I missing
something here?
  
Andreas Larsson Nov. 2, 2016, 11:35 a.m. UTC | #2
On 2016-11-01 18:28, Adhemerval Zanella wrote:
>
>
> On 01/11/2016 13:07, Andreas Larsson wrote:
>> This fixes a bug introduced by abf29edd4a3918 that missed fixing up
>> sparc32 in the change.
>>
>> 	* sysdeps/unix/sysv/linux/sparc/kernel-features.h: Undefine
>> 	__ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL for 32-bit
>> 	sparcv8
>> ---
>>   sysdeps/unix/sysv/linux/sparc/kernel-features.h |    4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> index 69c9c7c..db3f5cd 100644
>> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>> @@ -32,8 +32,10 @@
>>   #include_next <kernel-features.h>
>>
>>   /* 32-bit SPARC kernels do not support
>> -   futex_atomic_cmpxchg_inatomic.  */
>> +   futex_atomic_cmpxchg_inatomic or sendmsg/recvmsg.  */
>>   #if !defined __arch64__ && !defined __sparc_v9__
>>   # undef __ASSUME_REQUEUE_PI
>>   # undef __ASSUME_SET_ROBUST_LIST
>> +# undef __ASSUME_SENDMSG_SYSCALL
>> +# undef __ASSUME_RECVMSG_SYSCALL
>>   #endif
>>
>
> At least the kernel headers for Linux 3.2 on sparc defined both __NR_recvmsg
> and __NR_sendmsg.  Also, checking 'arch/sparc/kernel/sys32.S' on 3.2 does
> seems that sparc32 have both recvmsg and sendmsg wire-up.  Am I missing
> something here?

[resent to correct topic - I should apparently stay away from my mail 
client today]

Linux kernel commit 8b30ca73b7cc7f2177cfc4e8274d2ebdba328cd5 added
sys_sendmsg and sys_recvmsg to the sys_call_table in
arch/sparc/kernel/systbls_32.S. So sparc32 kernels prior to Linux 4.4 do
not support them as straight up system calls.

Best regards,
Andreas Larsson
  
Adhemerval Zanella Netto Nov. 2, 2016, 12:49 p.m. UTC | #3
On 02/11/2016 09:35, Andreas Larsson wrote:
> On 2016-11-01 18:28, Adhemerval Zanella wrote:
>>
>>
>> On 01/11/2016 13:07, Andreas Larsson wrote:
>>> This fixes a bug introduced by abf29edd4a3918 that missed fixing up
>>> sparc32 in the change.
>>>
>>>     * sysdeps/unix/sysv/linux/sparc/kernel-features.h: Undefine
>>>     __ASSUME_SENDMSG_SYSCALL and __ASSUME_RECVMSG_SYSCALL for 32-bit
>>>     sparcv8
>>> ---
>>>   sysdeps/unix/sysv/linux/sparc/kernel-features.h |    4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>>> index 69c9c7c..db3f5cd 100644
>>> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>>> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
>>> @@ -32,8 +32,10 @@
>>>   #include_next <kernel-features.h>
>>>
>>>   /* 32-bit SPARC kernels do not support
>>> -   futex_atomic_cmpxchg_inatomic.  */
>>> +   futex_atomic_cmpxchg_inatomic or sendmsg/recvmsg.  */
>>>   #if !defined __arch64__ && !defined __sparc_v9__
>>>   # undef __ASSUME_REQUEUE_PI
>>>   # undef __ASSUME_SET_ROBUST_LIST
>>> +# undef __ASSUME_SENDMSG_SYSCALL
>>> +# undef __ASSUME_RECVMSG_SYSCALL
>>>   #endif
>>>
>>
>> At least the kernel headers for Linux 3.2 on sparc defined both __NR_recvmsg
>> and __NR_sendmsg.  Also, checking 'arch/sparc/kernel/sys32.S' on 3.2 does
>> seems that sparc32 have both recvmsg and sendmsg wire-up.  Am I missing
>> something here?
> 
> [resent to correct topic - I should apparently stay away from my mail client today]
> 
> Linux kernel commit 8b30ca73b7cc7f2177cfc4e8274d2ebdba328cd5 added
> sys_sendmsg and sys_recvmsg to the sys_call_table in
> arch/sparc/kernel/systbls_32.S. So sparc32 kernels prior to Linux 4.4 do
> not support them as straight up system calls.
> 
> Best regards,
> Andreas Larsson

Right, so it is advertise to userland through __SYS/__NR macros even though
it is not really supported?

Even though, I think a better solution would be:

/* All direct socketcalls are available only with kernel 4.4.  */
#if __LINUX_KERNEL_VERSION < 0x040400
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
#endif
  
David Miller Nov. 4, 2016, 6:36 p.m. UTC | #4
From: Andreas Larsson <andreas@gaisler.com>
Date: Tue,  1 Nov 2016 16:07:46 +0100

> @@ -32,8 +32,10 @@
>  #include_next <kernel-features.h>
>  
>  /* 32-bit SPARC kernels do not support
> -   futex_atomic_cmpxchg_inatomic.  */
> +   futex_atomic_cmpxchg_inatomic or sendmsg/recvmsg.  */
>  #if !defined __arch64__ && !defined __sparc_v9__
>  # undef __ASSUME_REQUEUE_PI
>  # undef __ASSUME_SET_ROBUST_LIST
> +# undef __ASSUME_SENDMSG_SYSCALL
> +# undef __ASSUME_RECVMSG_SYSCALL
>  #endif

As mentioned elsewhere, these are available on 4.4. and later kernels.
  

Patch

diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 69c9c7c..db3f5cd 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -32,8 +32,10 @@ 
 #include_next <kernel-features.h>
 
 /* 32-bit SPARC kernels do not support
-   futex_atomic_cmpxchg_inatomic.  */
+   futex_atomic_cmpxchg_inatomic or sendmsg/recvmsg.  */
 #if !defined __arch64__ && !defined __sparc_v9__
 # undef __ASSUME_REQUEUE_PI
 # undef __ASSUME_SET_ROBUST_LIST
+# undef __ASSUME_SENDMSG_SYSCALL
+# undef __ASSUME_RECVMSG_SYSCALL
 #endif