2016-10-22 12:14:26

by Yury Norov

[permalink] [raw]
Subject: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

The newer prlimit64 syscall provides all the functionality provided by
the getrlimit and setrlimit syscalls and adds the pid of target process,
so future architectures won't need to include getrlimit and setrlimit.

Therefore drop getrlimit and setrlimit syscalls from the generic syscall
list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
unistd.h prior to including asm-generic/unistd.h, and adjust all
architectures using the generic syscall list to define it so that no
in-tree architectures are affected.

Cc: Vineet Gupta <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: Richard Kuo <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Ley Foon Tan <[email protected]>
Cc: Jonas Bonn <[email protected]>
Cc: Chen Liqin <[email protected]>
Cc: Lennox Wu <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Guan Xuetao <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Andrew Pinski <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Yury Norov <[email protected]>

---
arch/arc/include/uapi/asm/unistd.h | 1 +
arch/arm64/include/uapi/asm/unistd.h | 1 +
arch/c6x/include/uapi/asm/unistd.h | 1 +
arch/h8300/include/uapi/asm/unistd.h | 1 +
arch/hexagon/include/uapi/asm/unistd.h | 1 +
arch/metag/include/uapi/asm/unistd.h | 1 +
arch/nios2/include/uapi/asm/unistd.h | 1 +
arch/openrisc/include/uapi/asm/unistd.h | 1 +
arch/score/include/uapi/asm/unistd.h | 1 +
arch/tile/include/uapi/asm/unistd.h | 1 +
arch/unicore32/include/uapi/asm/unistd.h | 1 +
include/uapi/asm-generic/unistd.h | 5 +++++
12 files changed, 16 insertions(+)

diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
index 41fa2ec..928546d 100644
--- a/arch/arc/include/uapi/asm/unistd.h
+++ b/arch/arc/include/uapi/asm/unistd.h
@@ -16,6 +16,7 @@
#define _UAPI_ASM_ARC_UNISTD_H

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
index 043d17a..48355a6 100644
--- a/arch/arm64/include/uapi/asm/unistd.h
+++ b/arch/arm64/include/uapi/asm/unistd.h
@@ -15,5 +15,6 @@
*/

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT

#include <asm-generic/unistd.h>
diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
index 12d73d9..f676231 100644
--- a/arch/c6x/include/uapi/asm/unistd.h
+++ b/arch/c6x/include/uapi/asm/unistd.h
@@ -15,6 +15,7 @@
*/

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#define __ARCH_WANT_SYS_CLONE

/* Use the standard ABI for syscalls. */
diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
index 7dd20ef..2f98394 100644
--- a/arch/h8300/include/uapi/asm/unistd.h
+++ b/arch/h8300/include/uapi/asm/unistd.h
@@ -1,5 +1,6 @@
#define __ARCH_NOMMU

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT

#include <asm-generic/unistd.h>
diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
index 2151760..52d585c 100644
--- a/arch/hexagon/include/uapi/asm/unistd.h
+++ b/arch/hexagon/include/uapi/asm/unistd.h
@@ -28,6 +28,7 @@

#define sys_mmap2 sys_mmap_pgoff
#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#define __ARCH_WANT_SYS_EXECVE
#define __ARCH_WANT_SYS_CLONE
#define __ARCH_WANT_SYS_VFORK
diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h
index 459b6ec..16b5cb3 100644
--- a/arch/metag/include/uapi/asm/unistd.h
+++ b/arch/metag/include/uapi/asm/unistd.h
@@ -8,6 +8,7 @@
*/

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT

/* Use the standard ABI for syscalls. */
#include <asm-generic/unistd.h>
diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
index 51a32c7..b0dda4d 100644
--- a/arch/nios2/include/uapi/asm/unistd.h
+++ b/arch/nios2/include/uapi/asm/unistd.h
@@ -18,6 +18,7 @@
#define sys_mmap2 sys_mmap_pgoff

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT

/* Use the standard ABI for syscalls */
#include <asm-generic/unistd.h>
diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
index 471905b..6812d81 100644
--- a/arch/openrisc/include/uapi/asm/unistd.h
+++ b/arch/openrisc/include/uapi/asm/unistd.h
@@ -21,6 +21,7 @@
#define sys_mmap2 sys_mmap_pgoff

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#define __ARCH_WANT_SYS_FORK
#define __ARCH_WANT_SYS_CLONE

diff --git a/arch/score/include/uapi/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h
index d4008c3..7ad1bdc 100644
--- a/arch/score/include/uapi/asm/unistd.h
+++ b/arch/score/include/uapi/asm/unistd.h
@@ -1,6 +1,7 @@
#define __ARCH_HAVE_MMU

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#define __ARCH_WANT_SYSCALL_NO_AT
#define __ARCH_WANT_SYSCALL_NO_FLAGS
#define __ARCH_WANT_SYSCALL_OFF_T
diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
index 24e9187..cf0505f 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -13,6 +13,7 @@
*/

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT
#if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
/* Use the flavor of this syscall that matches the 32-bit API better. */
#define __ARCH_WANT_SYNC_FILE_RANGE2
diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
index 1f63c47..ef25aec 100644
--- a/arch/unicore32/include/uapi/asm/unistd.h
+++ b/arch/unicore32/include/uapi/asm/unistd.h
@@ -11,6 +11,7 @@
*/

#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_SET_GET_RLIMIT

/* Use the standard ABI for syscalls. */
#include <asm-generic/unistd.h>
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 9b1462e..bbaeac0 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -465,10 +465,15 @@ __SYSCALL(__NR_uname, sys_newuname)
__SYSCALL(__NR_sethostname, sys_sethostname)
#define __NR_setdomainname 162
__SYSCALL(__NR_setdomainname, sys_setdomainname)
+
+#ifdef __ARCH_WANT_SET_GET_RLIMIT
+/* getrlimit and setrlimit are superseded with prlimit64 */
#define __NR_getrlimit 163
__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
#define __NR_setrlimit 164
__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
+#endif
+
#define __NR_getrusage 165
__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
#define __NR_umask 166
--
2.7.4


2016-10-23 20:57:33

by Vineet Gupta

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On 10/22/2016 05:14 AM, Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
>
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all
> architectures using the generic syscall list to define it so that no
> in-tree architectures are affected.
>
> Cc: Vineet Gupta <[email protected]>

Acked-by: Vineet Gupta <[email protected]> #arch/arc bits

Thx,
-Vineet

2016-10-24 09:09:37

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Sat, Oct 22, 2016 at 03:14:04PM +0300, Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
>
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all
> architectures using the generic syscall list to define it so that no
> in-tree architectures are affected.
>
> Cc: Vineet Gupta <[email protected]>
> Cc: Catalin Marinas <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Mark Salter <[email protected]>
> Cc: Aurelien Jacquiot <[email protected]>
> Cc: Yoshinori Sato <[email protected]>
> Cc: Richard Kuo <[email protected]>
> Cc: James Hogan <[email protected]>
> Cc: Ley Foon Tan <[email protected]>
> Cc: Jonas Bonn <[email protected]>
> Cc: Chen Liqin <[email protected]>
> Cc: Lennox Wu <[email protected]>
> Cc: Chris Metcalf <[email protected]>
> Cc: Guan Xuetao <[email protected]>
> Cc: Arnd Bergmann <[email protected]>
> Cc: Andrew Pinski <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Yury Norov <[email protected]>
>
> ---
> arch/arc/include/uapi/asm/unistd.h | 1 +
> arch/arm64/include/uapi/asm/unistd.h | 1 +
> arch/c6x/include/uapi/asm/unistd.h | 1 +
> arch/h8300/include/uapi/asm/unistd.h | 1 +
> arch/hexagon/include/uapi/asm/unistd.h | 1 +
> arch/metag/include/uapi/asm/unistd.h | 1 +

Acked-by: James Hogan <[email protected]> [metag]

Cheers
James

> arch/nios2/include/uapi/asm/unistd.h | 1 +
> arch/openrisc/include/uapi/asm/unistd.h | 1 +
> arch/score/include/uapi/asm/unistd.h | 1 +
> arch/tile/include/uapi/asm/unistd.h | 1 +
> arch/unicore32/include/uapi/asm/unistd.h | 1 +
> include/uapi/asm-generic/unistd.h | 5 +++++
> 12 files changed, 16 insertions(+)
>
> diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
> index 41fa2ec..928546d 100644
> --- a/arch/arc/include/uapi/asm/unistd.h
> +++ b/arch/arc/include/uapi/asm/unistd.h
> @@ -16,6 +16,7 @@
> #define _UAPI_ASM_ARC_UNISTD_H
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #define __ARCH_WANT_SYS_EXECVE
> #define __ARCH_WANT_SYS_CLONE
> #define __ARCH_WANT_SYS_VFORK
> diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
> index 043d17a..48355a6 100644
> --- a/arch/arm64/include/uapi/asm/unistd.h
> +++ b/arch/arm64/include/uapi/asm/unistd.h
> @@ -15,5 +15,6 @@
> */
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
>
> #include <asm-generic/unistd.h>
> diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
> index 12d73d9..f676231 100644
> --- a/arch/c6x/include/uapi/asm/unistd.h
> +++ b/arch/c6x/include/uapi/asm/unistd.h
> @@ -15,6 +15,7 @@
> */
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #define __ARCH_WANT_SYS_CLONE
>
> /* Use the standard ABI for syscalls. */
> diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
> index 7dd20ef..2f98394 100644
> --- a/arch/h8300/include/uapi/asm/unistd.h
> +++ b/arch/h8300/include/uapi/asm/unistd.h
> @@ -1,5 +1,6 @@
> #define __ARCH_NOMMU
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
>
> #include <asm-generic/unistd.h>
> diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
> index 2151760..52d585c 100644
> --- a/arch/hexagon/include/uapi/asm/unistd.h
> +++ b/arch/hexagon/include/uapi/asm/unistd.h
> @@ -28,6 +28,7 @@
>
> #define sys_mmap2 sys_mmap_pgoff
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #define __ARCH_WANT_SYS_EXECVE
> #define __ARCH_WANT_SYS_CLONE
> #define __ARCH_WANT_SYS_VFORK
> diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h
> index 459b6ec..16b5cb3 100644
> --- a/arch/metag/include/uapi/asm/unistd.h
> +++ b/arch/metag/include/uapi/asm/unistd.h
> @@ -8,6 +8,7 @@
> */
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
>
> /* Use the standard ABI for syscalls. */
> #include <asm-generic/unistd.h>
> diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
> index 51a32c7..b0dda4d 100644
> --- a/arch/nios2/include/uapi/asm/unistd.h
> +++ b/arch/nios2/include/uapi/asm/unistd.h
> @@ -18,6 +18,7 @@
> #define sys_mmap2 sys_mmap_pgoff
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
>
> /* Use the standard ABI for syscalls */
> #include <asm-generic/unistd.h>
> diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
> index 471905b..6812d81 100644
> --- a/arch/openrisc/include/uapi/asm/unistd.h
> +++ b/arch/openrisc/include/uapi/asm/unistd.h
> @@ -21,6 +21,7 @@
> #define sys_mmap2 sys_mmap_pgoff
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #define __ARCH_WANT_SYS_FORK
> #define __ARCH_WANT_SYS_CLONE
>
> diff --git a/arch/score/include/uapi/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h
> index d4008c3..7ad1bdc 100644
> --- a/arch/score/include/uapi/asm/unistd.h
> +++ b/arch/score/include/uapi/asm/unistd.h
> @@ -1,6 +1,7 @@
> #define __ARCH_HAVE_MMU
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #define __ARCH_WANT_SYSCALL_NO_AT
> #define __ARCH_WANT_SYSCALL_NO_FLAGS
> #define __ARCH_WANT_SYSCALL_OFF_T
> diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
> index 24e9187..cf0505f 100644
> --- a/arch/tile/include/uapi/asm/unistd.h
> +++ b/arch/tile/include/uapi/asm/unistd.h
> @@ -13,6 +13,7 @@
> */
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
> #if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
> /* Use the flavor of this syscall that matches the 32-bit API better. */
> #define __ARCH_WANT_SYNC_FILE_RANGE2
> diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
> index 1f63c47..ef25aec 100644
> --- a/arch/unicore32/include/uapi/asm/unistd.h
> +++ b/arch/unicore32/include/uapi/asm/unistd.h
> @@ -11,6 +11,7 @@
> */
>
> #define __ARCH_WANT_RENAMEAT
> +#define __ARCH_WANT_SET_GET_RLIMIT
>
> /* Use the standard ABI for syscalls. */
> #include <asm-generic/unistd.h>
> diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
> index 9b1462e..bbaeac0 100644
> --- a/include/uapi/asm-generic/unistd.h
> +++ b/include/uapi/asm-generic/unistd.h
> @@ -465,10 +465,15 @@ __SYSCALL(__NR_uname, sys_newuname)
> __SYSCALL(__NR_sethostname, sys_sethostname)
> #define __NR_setdomainname 162
> __SYSCALL(__NR_setdomainname, sys_setdomainname)
> +
> +#ifdef __ARCH_WANT_SET_GET_RLIMIT
> +/* getrlimit and setrlimit are superseded with prlimit64 */
> #define __NR_getrlimit 163
> __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
> #define __NR_setrlimit 164
> __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
> +#endif
> +
> #define __NR_getrusage 165
> __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
> #define __NR_umask 166
> --
> 2.7.4
>


Attachments:
(No filename) (7.64 kB)
signature.asc (801.00 B)
Digital signature
Download all attachments

2016-10-25 00:47:54

by Ley Foon Tan

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Mon, Oct 24, 2016 at 5:09 PM, James Hogan <[email protected]> wrote:
> On Sat, Oct 22, 2016 at 03:14:04PM +0300, Yury Norov wrote:
>> The newer prlimit64 syscall provides all the functionality provided by
>> the getrlimit and setrlimit syscalls and adds the pid of target process,
>> so future architectures won't need to include getrlimit and setrlimit.
>>
>> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
>> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
>> unistd.h prior to including asm-generic/unistd.h, and adjust all
>> architectures using the generic syscall list to define it so that no
>> in-tree architectures are affected.
>>
>> Cc: Vineet Gupta <[email protected]>
>> Cc: Catalin Marinas <[email protected]>
>> Cc: Will Deacon <[email protected]>
>> Cc: Mark Salter <[email protected]>
>> Cc: Aurelien Jacquiot <[email protected]>
>> Cc: Yoshinori Sato <[email protected]>
>> Cc: Richard Kuo <[email protected]>
>> Cc: James Hogan <[email protected]>
>> Cc: Ley Foon Tan <[email protected]>
>> Cc: Jonas Bonn <[email protected]>
>> Cc: Chen Liqin <[email protected]>
>> Cc: Lennox Wu <[email protected]>
>> Cc: Chris Metcalf <[email protected]>
>> Cc: Guan Xuetao <[email protected]>
>> Cc: Arnd Bergmann <[email protected]>
>> Cc: Andrew Pinski <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Cc: [email protected]
>> Signed-off-by: Yury Norov <[email protected]>
>>
>> ---
>> arch/arc/include/uapi/asm/unistd.h | 1 +
>> arch/arm64/include/uapi/asm/unistd.h | 1 +
>> arch/c6x/include/uapi/asm/unistd.h | 1 +
>> arch/h8300/include/uapi/asm/unistd.h | 1 +
>> arch/hexagon/include/uapi/asm/unistd.h | 1 +
>> arch/metag/include/uapi/asm/unistd.h | 1 +
>
> Acked-by: James Hogan <[email protected]> [metag]
>
> Cheers
> James
>
>> arch/nios2/include/uapi/asm/unistd.h | 1 +
Acked-by: Ley Foon Tan <[email protected]> [nios2]


>> arch/openrisc/include/uapi/asm/unistd.h | 1 +
>> arch/score/include/uapi/asm/unistd.h | 1 +
>> arch/tile/include/uapi/asm/unistd.h | 1 +
>> arch/unicore32/include/uapi/asm/unistd.h | 1 +
>> include/uapi/asm-generic/unistd.h | 5 +++++
>> 12 files changed, 16 insertions(+)
>>
>> diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
>> index 41fa2ec..928546d 100644
>> --- a/arch/arc/include/uapi/asm/unistd.h
>> +++ b/arch/arc/include/uapi/asm/unistd.h
>> @@ -16,6 +16,7 @@
>> #define _UAPI_ASM_ARC_UNISTD_H
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #define __ARCH_WANT_SYS_EXECVE
>> #define __ARCH_WANT_SYS_CLONE
>> #define __ARCH_WANT_SYS_VFORK
>> diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
>> index 043d17a..48355a6 100644
>> --- a/arch/arm64/include/uapi/asm/unistd.h
>> +++ b/arch/arm64/include/uapi/asm/unistd.h
>> @@ -15,5 +15,6 @@
>> */
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>
>> #include <asm-generic/unistd.h>
>> diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
>> index 12d73d9..f676231 100644
>> --- a/arch/c6x/include/uapi/asm/unistd.h
>> +++ b/arch/c6x/include/uapi/asm/unistd.h
>> @@ -15,6 +15,7 @@
>> */
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #define __ARCH_WANT_SYS_CLONE
>>
>> /* Use the standard ABI for syscalls. */
>> diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
>> index 7dd20ef..2f98394 100644
>> --- a/arch/h8300/include/uapi/asm/unistd.h
>> +++ b/arch/h8300/include/uapi/asm/unistd.h
>> @@ -1,5 +1,6 @@
>> #define __ARCH_NOMMU
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>
>> #include <asm-generic/unistd.h>
>> diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
>> index 2151760..52d585c 100644
>> --- a/arch/hexagon/include/uapi/asm/unistd.h
>> +++ b/arch/hexagon/include/uapi/asm/unistd.h
>> @@ -28,6 +28,7 @@
>>
>> #define sys_mmap2 sys_mmap_pgoff
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #define __ARCH_WANT_SYS_EXECVE
>> #define __ARCH_WANT_SYS_CLONE
>> #define __ARCH_WANT_SYS_VFORK
>> diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h
>> index 459b6ec..16b5cb3 100644
>> --- a/arch/metag/include/uapi/asm/unistd.h
>> +++ b/arch/metag/include/uapi/asm/unistd.h
>> @@ -8,6 +8,7 @@
>> */
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>
>> /* Use the standard ABI for syscalls. */
>> #include <asm-generic/unistd.h>
>> diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
>> index 51a32c7..b0dda4d 100644
>> --- a/arch/nios2/include/uapi/asm/unistd.h
>> +++ b/arch/nios2/include/uapi/asm/unistd.h
>> @@ -18,6 +18,7 @@
>> #define sys_mmap2 sys_mmap_pgoff
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>
>> /* Use the standard ABI for syscalls */
>> #include <asm-generic/unistd.h>
>> diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
>> index 471905b..6812d81 100644
>> --- a/arch/openrisc/include/uapi/asm/unistd.h
>> +++ b/arch/openrisc/include/uapi/asm/unistd.h
>> @@ -21,6 +21,7 @@
>> #define sys_mmap2 sys_mmap_pgoff
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #define __ARCH_WANT_SYS_FORK
>> #define __ARCH_WANT_SYS_CLONE
>>
>> diff --git a/arch/score/include/uapi/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h
>> index d4008c3..7ad1bdc 100644
>> --- a/arch/score/include/uapi/asm/unistd.h
>> +++ b/arch/score/include/uapi/asm/unistd.h
>> @@ -1,6 +1,7 @@
>> #define __ARCH_HAVE_MMU
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #define __ARCH_WANT_SYSCALL_NO_AT
>> #define __ARCH_WANT_SYSCALL_NO_FLAGS
>> #define __ARCH_WANT_SYSCALL_OFF_T
>> diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
>> index 24e9187..cf0505f 100644
>> --- a/arch/tile/include/uapi/asm/unistd.h
>> +++ b/arch/tile/include/uapi/asm/unistd.h
>> @@ -13,6 +13,7 @@
>> */
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>> #if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
>> /* Use the flavor of this syscall that matches the 32-bit API better. */
>> #define __ARCH_WANT_SYNC_FILE_RANGE2
>> diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
>> index 1f63c47..ef25aec 100644
>> --- a/arch/unicore32/include/uapi/asm/unistd.h
>> +++ b/arch/unicore32/include/uapi/asm/unistd.h
>> @@ -11,6 +11,7 @@
>> */
>>
>> #define __ARCH_WANT_RENAMEAT
>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>
>> /* Use the standard ABI for syscalls. */
>> #include <asm-generic/unistd.h>
>> diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
>> index 9b1462e..bbaeac0 100644
>> --- a/include/uapi/asm-generic/unistd.h
>> +++ b/include/uapi/asm-generic/unistd.h
>> @@ -465,10 +465,15 @@ __SYSCALL(__NR_uname, sys_newuname)
>> __SYSCALL(__NR_sethostname, sys_sethostname)
>> #define __NR_setdomainname 162
>> __SYSCALL(__NR_setdomainname, sys_setdomainname)
>> +
>> +#ifdef __ARCH_WANT_SET_GET_RLIMIT
>> +/* getrlimit and setrlimit are superseded with prlimit64 */
>> #define __NR_getrlimit 163
>> __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
>> #define __NR_setrlimit 164
>> __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
>> +#endif
>> +
>> #define __NR_getrusage 165
>> __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
>> #define __NR_umask 166
>> --
>> 2.7.4
>>

2016-10-25 12:51:24

by Stafford Horne

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list



On Tue, 25 Oct 2016, Ley Foon Tan wrote:

> On Mon, Oct 24, 2016 at 5:09 PM, James Hogan <[email protected]> wrote:
>> On Sat, Oct 22, 2016 at 03:14:04PM +0300, Yury Norov wrote:
>>> The newer prlimit64 syscall provides all the functionality provided by
>>> the getrlimit and setrlimit syscalls and adds the pid of target process,
>>> so future architectures won't need to include getrlimit and setrlimit.
>>>
>>> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
>>> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
>>> unistd.h prior to including asm-generic/unistd.h, and adjust all
>>> architectures using the generic syscall list to define it so that no
>>> in-tree architectures are affected.
>>>
>>> Cc: Vineet Gupta <[email protected]>
>>> Cc: Catalin Marinas <[email protected]>
>>> Cc: Will Deacon <[email protected]>
>>> Cc: Mark Salter <[email protected]>
>>> Cc: Aurelien Jacquiot <[email protected]>
>>> Cc: Yoshinori Sato <[email protected]>
>>> Cc: Richard Kuo <[email protected]>
>>> Cc: James Hogan <[email protected]>
>>> Cc: Ley Foon Tan <[email protected]>
>>> Cc: Jonas Bonn <[email protected]>
>>> Cc: Chen Liqin <[email protected]>
>>> Cc: Lennox Wu <[email protected]>
>>> Cc: Chris Metcalf <[email protected]>
>>> Cc: Guan Xuetao <[email protected]>
>>> Cc: Arnd Bergmann <[email protected]>
>>> Cc: Andrew Pinski <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Signed-off-by: Yury Norov <[email protected]>
>>>
>>> ---
>>> arch/arc/include/uapi/asm/unistd.h | 1 +
>>> arch/arm64/include/uapi/asm/unistd.h | 1 +
>>> arch/c6x/include/uapi/asm/unistd.h | 1 +
>>> arch/h8300/include/uapi/asm/unistd.h | 1 +
>>> arch/hexagon/include/uapi/asm/unistd.h | 1 +
>>> arch/metag/include/uapi/asm/unistd.h | 1 +
>>
>> Acked-by: James Hogan <[email protected]> [metag]
>>
>> Cheers
>> James
>>
>>> arch/nios2/include/uapi/asm/unistd.h | 1 +
> Acked-by: Ley Foon Tan <[email protected]> [nios2]
>
>
>>> arch/openrisc/include/uapi/asm/unistd.h | 1 +

Acked-by: Stafford Horne <[email protected]> [openrisc]

>>> arch/score/include/uapi/asm/unistd.h | 1 +
>>> arch/tile/include/uapi/asm/unistd.h | 1 +
>>> arch/unicore32/include/uapi/asm/unistd.h | 1 +
>>> include/uapi/asm-generic/unistd.h | 5 +++++
>>> 12 files changed, 16 insertions(+)
>>>
>>> diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h
>>> index 41fa2ec..928546d 100644
>>> --- a/arch/arc/include/uapi/asm/unistd.h
>>> +++ b/arch/arc/include/uapi/asm/unistd.h
>>> @@ -16,6 +16,7 @@
>>> #define _UAPI_ASM_ARC_UNISTD_H
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #define __ARCH_WANT_SYS_EXECVE
>>> #define __ARCH_WANT_SYS_CLONE
>>> #define __ARCH_WANT_SYS_VFORK
>>> diff --git a/arch/arm64/include/uapi/asm/unistd.h b/arch/arm64/include/uapi/asm/unistd.h
>>> index 043d17a..48355a6 100644
>>> --- a/arch/arm64/include/uapi/asm/unistd.h
>>> +++ b/arch/arm64/include/uapi/asm/unistd.h
>>> @@ -15,5 +15,6 @@
>>> */
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>>
>>> #include <asm-generic/unistd.h>
>>> diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
>>> index 12d73d9..f676231 100644
>>> --- a/arch/c6x/include/uapi/asm/unistd.h
>>> +++ b/arch/c6x/include/uapi/asm/unistd.h
>>> @@ -15,6 +15,7 @@
>>> */
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #define __ARCH_WANT_SYS_CLONE
>>>
>>> /* Use the standard ABI for syscalls. */
>>> diff --git a/arch/h8300/include/uapi/asm/unistd.h b/arch/h8300/include/uapi/asm/unistd.h
>>> index 7dd20ef..2f98394 100644
>>> --- a/arch/h8300/include/uapi/asm/unistd.h
>>> +++ b/arch/h8300/include/uapi/asm/unistd.h
>>> @@ -1,5 +1,6 @@
>>> #define __ARCH_NOMMU
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>>
>>> #include <asm-generic/unistd.h>
>>> diff --git a/arch/hexagon/include/uapi/asm/unistd.h b/arch/hexagon/include/uapi/asm/unistd.h
>>> index 2151760..52d585c 100644
>>> --- a/arch/hexagon/include/uapi/asm/unistd.h
>>> +++ b/arch/hexagon/include/uapi/asm/unistd.h
>>> @@ -28,6 +28,7 @@
>>>
>>> #define sys_mmap2 sys_mmap_pgoff
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #define __ARCH_WANT_SYS_EXECVE
>>> #define __ARCH_WANT_SYS_CLONE
>>> #define __ARCH_WANT_SYS_VFORK
>>> diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h
>>> index 459b6ec..16b5cb3 100644
>>> --- a/arch/metag/include/uapi/asm/unistd.h
>>> +++ b/arch/metag/include/uapi/asm/unistd.h
>>> @@ -8,6 +8,7 @@
>>> */
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>>
>>> /* Use the standard ABI for syscalls. */
>>> #include <asm-generic/unistd.h>
>>> diff --git a/arch/nios2/include/uapi/asm/unistd.h b/arch/nios2/include/uapi/asm/unistd.h
>>> index 51a32c7..b0dda4d 100644
>>> --- a/arch/nios2/include/uapi/asm/unistd.h
>>> +++ b/arch/nios2/include/uapi/asm/unistd.h
>>> @@ -18,6 +18,7 @@
>>> #define sys_mmap2 sys_mmap_pgoff
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>>
>>> /* Use the standard ABI for syscalls */
>>> #include <asm-generic/unistd.h>
>>> diff --git a/arch/openrisc/include/uapi/asm/unistd.h b/arch/openrisc/include/uapi/asm/unistd.h
>>> index 471905b..6812d81 100644
>>> --- a/arch/openrisc/include/uapi/asm/unistd.h
>>> +++ b/arch/openrisc/include/uapi/asm/unistd.h
>>> @@ -21,6 +21,7 @@
>>> #define sys_mmap2 sys_mmap_pgoff
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #define __ARCH_WANT_SYS_FORK
>>> #define __ARCH_WANT_SYS_CLONE
>>>
>>> diff --git a/arch/score/include/uapi/asm/unistd.h b/arch/score/include/uapi/asm/unistd.h
>>> index d4008c3..7ad1bdc 100644
>>> --- a/arch/score/include/uapi/asm/unistd.h
>>> +++ b/arch/score/include/uapi/asm/unistd.h
>>> @@ -1,6 +1,7 @@
>>> #define __ARCH_HAVE_MMU
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #define __ARCH_WANT_SYSCALL_NO_AT
>>> #define __ARCH_WANT_SYSCALL_NO_FLAGS
>>> #define __ARCH_WANT_SYSCALL_OFF_T
>>> diff --git a/arch/tile/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
>>> index 24e9187..cf0505f 100644
>>> --- a/arch/tile/include/uapi/asm/unistd.h
>>> +++ b/arch/tile/include/uapi/asm/unistd.h
>>> @@ -13,6 +13,7 @@
>>> */
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>> #if !defined(__LP64__) || defined(__SYSCALL_COMPAT)
>>> /* Use the flavor of this syscall that matches the 32-bit API better. */
>>> #define __ARCH_WANT_SYNC_FILE_RANGE2
>>> diff --git a/arch/unicore32/include/uapi/asm/unistd.h b/arch/unicore32/include/uapi/asm/unistd.h
>>> index 1f63c47..ef25aec 100644
>>> --- a/arch/unicore32/include/uapi/asm/unistd.h
>>> +++ b/arch/unicore32/include/uapi/asm/unistd.h
>>> @@ -11,6 +11,7 @@
>>> */
>>>
>>> #define __ARCH_WANT_RENAMEAT
>>> +#define __ARCH_WANT_SET_GET_RLIMIT
>>>
>>> /* Use the standard ABI for syscalls. */
>>> #include <asm-generic/unistd.h>
>>> diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
>>> index 9b1462e..bbaeac0 100644
>>> --- a/include/uapi/asm-generic/unistd.h
>>> +++ b/include/uapi/asm-generic/unistd.h
>>> @@ -465,10 +465,15 @@ __SYSCALL(__NR_uname, sys_newuname)
>>> __SYSCALL(__NR_sethostname, sys_sethostname)
>>> #define __NR_setdomainname 162
>>> __SYSCALL(__NR_setdomainname, sys_setdomainname)
>>> +
>>> +#ifdef __ARCH_WANT_SET_GET_RLIMIT
>>> +/* getrlimit and setrlimit are superseded with prlimit64 */
>>> #define __NR_getrlimit 163
>>> __SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
>>> #define __NR_setrlimit 164
>>> __SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
>>> +#endif
>>> +
>>> #define __NR_getrusage 165
>>> __SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
>>> #define __NR_umask 166
>>> --
>>> 2.7.4
>>>
>

2016-10-29 21:04:30

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
>
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all
> architectures using the generic syscall list to define it so that no
> in-tree architectures are affected.

The patch looks good, but shouldn't we also hide the actual syscall
implementation if the symbol is not set? It's just dead code otherwise
for new architectures.

Arnd

2016-10-29 21:46:02

by Yury Norov

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Sat, Oct 29, 2016 at 11:02:40PM +0200, Arnd Bergmann wrote:
> On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
> > The newer prlimit64 syscall provides all the functionality provided by
> > the getrlimit and setrlimit syscalls and adds the pid of target process,
> > so future architectures won't need to include getrlimit and setrlimit.
> >
> > Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> > list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> > unistd.h prior to including asm-generic/unistd.h, and adjust all
> > architectures using the generic syscall list to define it so that no
> > in-tree architectures are affected.
>
> The patch looks good, but shouldn't we also hide the actual syscall
> implementation if the symbol is not set? It's just dead code otherwise
> for new architectures.

I was thinking on it. The patch of James Hogan, b0da6d4415 (asm-generic:
Drop renameat syscall from default list) doesn't do it for renameat(), so
I decided not to do it too. It's not so easy to disable syscalls because arch
may support few ABIs, and some of them may require the syscall. For example,
arm64 supports lp64, aarch32 and ilp32, and first two ABIs need renameat()
and getrlimit/setrlimit.

At now there's no arches that doesn't need renameat() and getrlimit/setrlimit,
and there will be no such arch in nearest future. So there will be no
dead code.

But I agree with you that we need make that implementations
conditional. If I understand it correctly, we need something like
__ARCH_WANT_SET_GET_RLIMIT in all existing Kconfigs, correct?

I think this patch may be applied as is, and if needed I can send
another patch that disables renameat() and getrlimit/setrlimit soon.

James, what do you think?

Yury.

2016-10-29 21:55:19

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
>
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all
> architectures using the generic syscall list to define it so that no
> in-tree architectures are affected.
>

Acked-by: Arnd Bergmann <[email protected]>

Can you include this patch in your ilp32 series?

2016-10-29 21:54:34

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Sunday, October 30, 2016 12:45:41 AM CEST Yury Norov wrote:
> On Sat, Oct 29, 2016 at 11:02:40PM +0200, Arnd Bergmann wrote:
> > On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
> > > The newer prlimit64 syscall provides all the functionality provided by
> > > the getrlimit and setrlimit syscalls and adds the pid of target process,
> > > so future architectures won't need to include getrlimit and setrlimit.
> > >
> > > Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> > > list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> > > unistd.h prior to including asm-generic/unistd.h, and adjust all
> > > architectures using the generic syscall list to define it so that no
> > > in-tree architectures are affected.
> >
> > The patch looks good, but shouldn't we also hide the actual syscall
> > implementation if the symbol is not set? It's just dead code otherwise
> > for new architectures.
>
> I was thinking on it. The patch of James Hogan, b0da6d4415 (asm-generic:
> Drop renameat syscall from default list) doesn't do it for renameat(), so
> I decided not to do it too. It's not so easy to disable syscalls because arch
> may support few ABIs, and some of them may require the syscall. For example,
> arm64 supports lp64, aarch32 and ilp32, and first two ABIs need renameat()
> and getrlimit/setrlimit.
>
> At now there's no arches that doesn't need renameat() and getrlimit/setrlimit,
> and there will be no such arch in nearest future. So there will be no
> dead code.
>
> But I agree with you that we need make that implementations
> conditional. If I understand it correctly, we need something like
> __ARCH_WANT_SET_GET_RLIMIT in all existing Kconfigs, correct?
>
> I think this patch may be applied as is, and if needed I can send
> another patch that disables renameat() and getrlimit/setrlimit soon.

Fair enough. Actually now that I think about it, there are probably
lots of other syscalls that are unused on modern architectures.

It would be good to go through the full list and hide all the ones
that are not referenced, but that is clearly independent of your
patch.

Arnd

2016-10-29 22:05:56

by Yury Norov

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On Sat, Oct 29, 2016 at 11:54:08PM +0200, Arnd Bergmann wrote:
> On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
> > The newer prlimit64 syscall provides all the functionality provided by
> > the getrlimit and setrlimit syscalls and adds the pid of target process,
> > so future architectures won't need to include getrlimit and setrlimit.
> >
> > Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> > list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> > unistd.h prior to including asm-generic/unistd.h, and adjust all
> > architectures using the generic syscall list to define it so that no
> > in-tree architectures are affected.
> >
>
> Acked-by: Arnd Bergmann <[email protected]>
>
> Can you include this patch in your ilp32 series?

Already did.
https://github.com/norov/linux/commits/ilp32-4.9

2016-10-29 23:06:09

by James Hogan

[permalink] [raw]
Subject: Re: [PATCH] asm-generic: Drop getrlimit and setrlimit syscalls from default list

On 29 October 2016 22:45:41 BST, Yury Norov <[email protected]> wrote:
>On Sat, Oct 29, 2016 at 11:02:40PM +0200, Arnd Bergmann wrote:
>> On Saturday, October 22, 2016 3:14:04 PM CEST Yury Norov wrote:
>> > The newer prlimit64 syscall provides all the functionality provided
>by
>> > the getrlimit and setrlimit syscalls and adds the pid of target
>process,
>> > so future architectures won't need to include getrlimit and
>setrlimit.
>> >
>> > Therefore drop getrlimit and setrlimit syscalls from the generic
>syscall
>> > list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the
>architecture's
>> > unistd.h prior to including asm-generic/unistd.h, and adjust all
>> > architectures using the generic syscall list to define it so that
>no
>> > in-tree architectures are affected.
>>
>> The patch looks good, but shouldn't we also hide the actual syscall
>> implementation if the symbol is not set? It's just dead code
>otherwise
>> for new architectures.
>
>I was thinking on it. The patch of James Hogan, b0da6d4415
>(asm-generic:
>Drop renameat syscall from default list) doesn't do it for renameat(),
>so
>I decided not to do it too. It's not so easy to disable syscalls
>because arch
>may support few ABIs, and some of them may require the syscall. For
>example,
>arm64 supports lp64, aarch32 and ilp32, and first two ABIs need
>renameat()
>and getrlimit/setrlimit.
>
>At now there's no arches that doesn't need renameat() and
>getrlimit/setrlimit,
>and there will be no such arch in nearest future. So there will be no
>dead code.
>
>But I agree with you that we need make that implementations
>conditional. If I understand it correctly, we need something like
>__ARCH_WANT_SET_GET_RLIMIT in all existing Kconfigs, correct?
>
>I think this patch may be applied as is, and if needed I can send
>another patch that disables renameat() and getrlimit/setrlimit soon.
>
>James, what do you think?

For renameat my main concern was the ABI, and I didn't think it was worth the effort or slightly increased complexity to ifdef the implementation since it was such a trivial wrapper around renameat2. Getrlimit and setrlimit aren't much more complex, just a user copy in addition to the standard doprlimit, so i probably wouldn't have bothered for them either.

cheers
James Hogan