All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
@ 2019-07-11  5:57 Hongzhi.Song
  2019-07-11  6:19 ` Hongzhi, Song
  0 siblings, 1 reply; 4+ messages in thread
From: Hongzhi.Song @ 2019-07-11  5:57 UTC (permalink / raw)
  To: ltp

Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff

According to kernel code: RLIM_INFINITY is set to 0x7fffffffUL
instead of ULONG_MAX on mips32.

/*
 * SuS says limits have to be unsigned.
 * Which makes a ton more sense anyway,
 * but we keep the old value on MIPS32,
 * for compatibility:
 */

Adding mips judgement code to fix this.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
index e4d56c4..1903558 100644
--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
@@ -61,7 +61,13 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
+#ifdef __mips
+#ifndef __mips64
+const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
 const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
@@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t val_u64,
 {
 	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
 	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
-		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
-			resource, kind, val_u64,
+		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
+			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource, kind, val_u64,
 			resource, kind, val_ul);
 		return -1;
 	}
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
  2019-07-11  5:57 [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32 Hongzhi.Song
@ 2019-07-11  6:19 ` Hongzhi, Song
  0 siblings, 0 replies; 4+ messages in thread
From: Hongzhi, Song @ 2019-07-11  6:19 UTC (permalink / raw)
  To: ltp

Commit log is not complete. I will send V2 later.

Please ignore this.

--Hongzhi


On 7/11/19 1:57 PM, Hongzhi.Song wrote:
> Error info:
> getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
> ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff
>
> According to kernel code: RLIM_INFINITY is set to 0x7fffffffUL
> instead of ULONG_MAX on mips32.
>
> /*
>   * SuS says limits have to be unsigned.
>   * Which makes a ton more sense anyway,
>   * but we keep the old value on MIPS32,
>   * for compatibility:
>   */
>
> Adding mips judgement code to fix this.
>
> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> ---
>   testcases/kernel/syscalls/getrlimit/getrlimit03.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> index e4d56c4..1903558 100644
> --- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> +++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
> @@ -61,7 +61,13 @@ struct rlimit_ulong {
>   	unsigned long rlim_cur;
>   	unsigned long rlim_max;
>   };
> +#ifdef __mips
> +#ifndef __mips64
> +const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
> +#else
>   const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
> +#endif
> +#endif
>   
>   static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
>   {
> @@ -101,8 +107,8 @@ static int compare_u64_ulong(int resource, uint64_t val_u64,
>   {
>   	if ((val_u64 > RLIM_INFINITY_UL && val_ul != RLIM_INFINITY_UL) ||
>   	    (val_u64 <= RLIM_INFINITY_UL && val_ul != val_u64)) {
> -		tst_res(TFAIL, "__NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
> -			resource, kind, val_u64,
> +		tst_res(TFAIL, "SIGNED_GETRLIMIT = %d __WORDSIZE %d ULONG_MAX = %lu RLIM_INFINITY_UL = %lu __NR_prlimit64(%d) had %s = %" PRIx64 " but " __NR_getrlimit_ulong_str "(%d) had %s = %lx",
> +			SIGNED_GETRLIMIT, __WORDSIZE, ULONG_MAX, RLIM_INFINITY_UL, resource, kind, val_u64,
>   			resource, kind, val_ul);
>   		return -1;
>   	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
  2019-07-16  9:04 ` [LTP] [PATCH] " Hongzhi.Song
@ 2019-07-17  8:36   ` Jan Stancek
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Stancek @ 2019-07-17  8:36 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> Error info:
> getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
> ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff
> 
> According to kernel code: [arch/mips/include/uapi/asm/resource.h]
> RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.
> 
>  /*
>  * SuS says limits have to be unsigned.
>  * Which makes a ton more sense anyway,
>  * but we keep the old value on MIPS32,
>  * for compatibility:
>  */
>  #ifndef __mips64
>  # define RLIM_INFINITY      0x7fffffffUL
>  #endif
> 
> Adding conditional statement about mips to fix this.
> 
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>

Pushed.

Thanks,
Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32
  2019-07-16  9:04 [LTP] [PATCH V5] " Hongzhi.Song
@ 2019-07-16  9:04 ` Hongzhi.Song
  2019-07-17  8:36   ` Jan Stancek
  0 siblings, 1 reply; 4+ messages in thread
From: Hongzhi.Song @ 2019-07-16  9:04 UTC (permalink / raw)
  To: ltp

Error info:
getrlimit03.c:104: FAIL: __NR_prlimit64(0) had rlim_cur =
ffffffffffffffff but __NR_getrlimit(0) had rlim_cur = 7fffffff

According to kernel code: [arch/mips/include/uapi/asm/resource.h]
RLIM_INFINITY is set to 0x7fffffffUL instead of ULONG_MAX on mips32.

 /*
 * SuS says limits have to be unsigned.
 * Which makes a ton more sense anyway,
 * but we keep the old value on MIPS32,
 * for compatibility:
 */
 #ifndef __mips64
 # define RLIM_INFINITY      0x7fffffffUL
 #endif

Adding conditional statement about mips to fix this.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/getrlimit/getrlimit03.c b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
index e4d56c4..319bc49 100644
--- a/testcases/kernel/syscalls/getrlimit/getrlimit03.c
+++ b/testcases/kernel/syscalls/getrlimit/getrlimit03.c
@@ -26,6 +26,7 @@
 
 #include "tst_test.h"
 #include "lapi/syscalls.h"
+#include "lapi/abisize.h"
 
 /**
  * Linux provides an "old" getrlimit syscall handler that uses signed long,
@@ -61,7 +62,12 @@ struct rlimit_ulong {
 	unsigned long rlim_cur;
 	unsigned long rlim_max;
 };
-const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+
+#if defined(__mips__) && defined(TST_ABI32)
+	const unsigned long RLIM_INFINITY_UL = 0x7fffffffUL;
+#else
+	const unsigned long RLIM_INFINITY_UL = ULONG_MAX;
+#endif
 
 static int getrlimit_ulong(int resource, struct rlimit_ulong *rlim)
 {
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-17  8:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11  5:57 [LTP] [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32 Hongzhi.Song
2019-07-11  6:19 ` Hongzhi, Song
2019-07-16  9:04 [LTP] [PATCH V5] " Hongzhi.Song
2019-07-16  9:04 ` [LTP] [PATCH] " Hongzhi.Song
2019-07-17  8:36   ` Jan Stancek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.