* [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
@ 2023-06-15 9:39 Dylan Jhong
2023-06-26 2:36 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 6:57 ` Li Wang
0 siblings, 2 replies; 12+ messages in thread
From: Dylan Jhong @ 2023-06-15 9:39 UTC (permalink / raw)
To: ltp; +Cc: minachou, tim609, x5710999x
When testing hugeshmctl02 under the 32bit architecture, a segmentation fault
will occur. This patch will skip EFAULT tests for libc variant.
Hugeshmctl02 will intentionally pass "(struct shmid_ds *)-1" to shmctl(), but
glibc will perform an additional conversion function when the architecture is
32bit, which will try to copy all items in (struct shmid_ds *) to another
structure[*1]. In the process of copying, it is necessary to dereference
"(struct shmid_ds *)-1", resulting in segmentation fault.
The LTP also has similar problems before, this patch is reference from the
shmctl03 patch[*2].
[*1]: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/shmctl.c#L37
[*2]: https://github.com/linux-test-project/ltp/commit/a5a80aa8485a7cb017f96aba8d7b5ea79f1ba4d4
Signed-off-by: Dylan Jhong <dylan@andestech.com>
---
.../mem/hugetlb/hugeshmctl/hugeshmctl02.c | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index 0bc9ffd74..e9c2e9fc8 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -27,6 +27,7 @@
#include <pwd.h>
#include <limits.h>
#include "hugetlb.h"
+#include "lapi/syscalls.h"
static size_t shm_size;
static int shm_id_1 = -1;
@@ -50,9 +51,37 @@ struct tcase {
{&shm_id_2, -1, &buf, EINVAL},
};
+static int libc_shmctl(int shmid, int cmd, void *buf)
+{
+ return shmctl(shmid, cmd, buf);
+}
+
+static int sys_shmctl(int shmid, int cmd, void *buf)
+{
+ return tst_syscall(__NR_shmctl, shmid, cmd, buf);
+}
+
+static struct test_variants
+{
+ int (*shmctl)(int shmid, int cmd, void *buf);
+ char *desc;
+} variants[] = {
+ { .shmctl = libc_shmctl, .desc = "libc shmctl()"},
+#if (__NR_shmctl != __LTP__NR_INVALID_SYSCALL)
+ { .shmctl = sys_shmctl, .desc = "__NR_shmctl syscall"},
+#endif
+};
+
static void test_hugeshmctl(unsigned int i)
{
- TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
+ struct test_variants *tv = &variants[tst_variant];
+
+ if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl) {
+ tst_res(TCONF, "EFAULT is skipped for libc variant");
+ return;
+ }
+
+ TEST(tv->shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
if (TST_RET != -1) {
tst_res(TFAIL, "shmctl succeeded unexpectedly");
return;
@@ -70,8 +99,11 @@ static void test_hugeshmctl(unsigned int i)
static void setup(void)
{
+ struct test_variants *tv = &variants[tst_variant];
long hpage_size;
+ tst_res(TINFO, "Testing variant: %s", tv->desc);
+
if (tst_hugepages == 0)
tst_brk(TCONF, "No enough hugepages for testing.");
@@ -101,6 +133,7 @@ static void cleanup(void)
static struct tst_test test = {
.test = test_hugeshmctl,
+ .test_variants = ARRAY_SIZE(variants),
.tcnt = ARRAY_SIZE(tcases),
.needs_root = 1,
.needs_tmpdir = 1,
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-15 9:39 [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant Dylan Jhong
@ 2023-06-26 2:36 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 6:57 ` Li Wang
1 sibling, 0 replies; 12+ messages in thread
From: Dylan Dai-Rong Jhong(鍾岱融) @ 2023-06-26 2:36 UTC (permalink / raw)
To: ltp@lists.linux.it
Cc: Mina Hui-Min Chou(周慧敏),
Tim Shih-Ting OuYang(歐陽士庭),
x5710999x@gmail.com
Hi All,
Ping. Any comments on this patch?
Thanks,
Dylan
-----Original Message-----
From: Dylan Dai-Rong Jhong(鍾岱融) <dylan@andestech.com>
Sent: Thursday, June 15, 2023 5:40 PM
To: ltp@lists.linux.it
Cc: Randolph Sheng-Kai Lin(林聖凱) <randolph@andestech.com>; x5710999x@gmail.com; Tim Shih-Ting OuYang(歐陽士庭) <tim609@andestech.com>; Mina Hui-Min Chou(周慧敏) <minachou@andestech.com>; Dylan Dai-Rong Jhong(鍾岱融) <dylan@andestech.com>
Subject: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
When testing hugeshmctl02 under the 32bit architecture, a segmentation fault will occur. This patch will skip EFAULT tests for libc variant.
Hugeshmctl02 will intentionally pass "(struct shmid_ds *)-1" to shmctl(), but glibc will perform an additional conversion function when the architecture is 32bit, which will try to copy all items in (struct shmid_ds *) to another structure[*1]. In the process of copying, it is necessary to dereference "(struct shmid_ds *)-1", resulting in segmentation fault.
The LTP also has similar problems before, this patch is reference from the
shmctl03 patch[*2].
[*1]: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/shmctl.c#L37
[*2]: https://github.com/linux-test-project/ltp/commit/a5a80aa8485a7cb017f96aba8d7b5ea79f1ba4d4
Signed-off-by: Dylan Jhong <dylan@andestech.com>
---
.../mem/hugetlb/hugeshmctl/hugeshmctl02.c | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index 0bc9ffd74..e9c2e9fc8 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -27,6 +27,7 @@
#include <pwd.h>
#include <limits.h>
#include "hugetlb.h"
+#include "lapi/syscalls.h"
static size_t shm_size;
static int shm_id_1 = -1;
@@ -50,9 +51,37 @@ struct tcase {
{&shm_id_2, -1, &buf, EINVAL},
};
+static int libc_shmctl(int shmid, int cmd, void *buf) {
+ return shmctl(shmid, cmd, buf);
+}
+
+static int sys_shmctl(int shmid, int cmd, void *buf) {
+ return tst_syscall(__NR_shmctl, shmid, cmd, buf); }
+
+static struct test_variants
+{
+ int (*shmctl)(int shmid, int cmd, void *buf);
+ char *desc;
+} variants[] = {
+ { .shmctl = libc_shmctl, .desc = "libc shmctl()"}, #if (__NR_shmctl !=
+__LTP__NR_INVALID_SYSCALL)
+ { .shmctl = sys_shmctl, .desc = "__NR_shmctl syscall"}, #endif };
+
static void test_hugeshmctl(unsigned int i) {
- TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
+ struct test_variants *tv = &variants[tst_variant];
+
+ if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl) {
+ tst_res(TCONF, "EFAULT is skipped for libc variant");
+ return;
+ }
+
+ TEST(tv->shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
if (TST_RET != -1) {
tst_res(TFAIL, "shmctl succeeded unexpectedly");
return;
@@ -70,8 +99,11 @@ static void test_hugeshmctl(unsigned int i)
static void setup(void)
{
+ struct test_variants *tv = &variants[tst_variant];
long hpage_size;
+ tst_res(TINFO, "Testing variant: %s", tv->desc);
+
if (tst_hugepages == 0)
tst_brk(TCONF, "No enough hugepages for testing.");
@@ -101,6 +133,7 @@ static void cleanup(void)
static struct tst_test test = {
.test = test_hugeshmctl,
+ .test_variants = ARRAY_SIZE(variants),
.tcnt = ARRAY_SIZE(tcases),
.needs_root = 1,
.needs_tmpdir = 1,
--
2.34.1
CONFIDENTIALITY NOTICE:
This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.
Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-15 9:39 [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant Dylan Jhong
2023-06-26 2:36 ` Dylan Dai-Rong Jhong(鍾岱融)
@ 2023-06-26 6:57 ` Li Wang
2023-06-26 9:14 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 9:23 ` Cyril Hrubis
1 sibling, 2 replies; 12+ messages in thread
From: Li Wang @ 2023-06-26 6:57 UTC (permalink / raw)
To: Dylan Jhong; +Cc: minachou, tim609, x5710999x, ltp
On Thu, Jun 15, 2023 at 5:40 PM Dylan Jhong <dylan@andestech.com> wrote:
> When testing hugeshmctl02 under the 32bit architecture, a segmentation
> fault
> will occur. This patch will skip EFAULT tests for libc variant.
>
> Hugeshmctl02 will intentionally pass "(struct shmid_ds *)-1" to shmctl(),
> but
> glibc will perform an additional conversion function when the architecture
> is
> 32bit, which will try to copy all items in (struct shmid_ds *) to another
> structure[*1]. In the process of copying, it is necessary to dereference
> "(struct shmid_ds *)-1", resulting in segmentation fault.
>
> The LTP also has similar problems before, this patch is reference from the
> shmctl03 patch[*2].
>
> [*1]:
> https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/shmctl.c#L37
> [*2]:
> https://github.com/linux-test-project/ltp/commit/a5a80aa8485a7cb017f96aba8d7b5ea79f1ba4d4
>
> Signed-off-by: Dylan Jhong <dylan@andestech.com>
> ---
> .../mem/hugetlb/hugeshmctl/hugeshmctl02.c | 35 ++++++++++++++++++-
> 1 file changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> index 0bc9ffd74..e9c2e9fc8 100644
> --- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> +++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
> @@ -27,6 +27,7 @@
> #include <pwd.h>
> #include <limits.h>
> #include "hugetlb.h"
> +#include "lapi/syscalls.h"
>
> static size_t shm_size;
> static int shm_id_1 = -1;
> @@ -50,9 +51,37 @@ struct tcase {
> {&shm_id_2, -1, &buf, EINVAL},
> };
>
> +static int libc_shmctl(int shmid, int cmd, void *buf)
> +{
> + return shmctl(shmid, cmd, buf);
> +}
> +
> +static int sys_shmctl(int shmid, int cmd, void *buf)
> +{
> + return tst_syscall(__NR_shmctl, shmid, cmd, buf);
> +}
> +
> +static struct test_variants
> +{
> + int (*shmctl)(int shmid, int cmd, void *buf);
> + char *desc;
> +} variants[] = {
> + { .shmctl = libc_shmctl, .desc = "libc shmctl()"},
> +#if (__NR_shmctl != __LTP__NR_INVALID_SYSCALL)
> + { .shmctl = sys_shmctl, .desc = "__NR_shmctl syscall"},
> +#endif
> +};
> +
> static void test_hugeshmctl(unsigned int i)
> {
> - TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
> + struct test_variants *tv = &variants[tst_variant];
> +
> + if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl) {
>
You pointed the segment fault only exists on 32bit when use
libc wrapper, but this condition skips for both 64and32 bits,
isn't it?
I guess the strict condition should be as below?
if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl &&
tst_kernel_bits() == 32) {
...
}
> + tst_res(TCONF, "EFAULT is skipped for libc variant");
> + return;
> + }
> +
> + TEST(tv->shmctl(*(tcases[i].shmid), tcases[i].cmd,
> tcases[i].sbuf));
> if (TST_RET != -1) {
> tst_res(TFAIL, "shmctl succeeded unexpectedly");
> return;
> @@ -70,8 +99,11 @@ static void test_hugeshmctl(unsigned int i)
>
> static void setup(void)
> {
> + struct test_variants *tv = &variants[tst_variant];
> long hpage_size;
>
> + tst_res(TINFO, "Testing variant: %s", tv->desc);
> +
> if (tst_hugepages == 0)
> tst_brk(TCONF, "No enough hugepages for testing.");
>
> @@ -101,6 +133,7 @@ static void cleanup(void)
>
> static struct tst_test test = {
> .test = test_hugeshmctl,
> + .test_variants = ARRAY_SIZE(variants),
> .tcnt = ARRAY_SIZE(tcases),
> .needs_root = 1,
> .needs_tmpdir = 1,
> --
> 2.34.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-26 6:57 ` Li Wang
@ 2023-06-26 9:14 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 9:23 ` Cyril Hrubis
1 sibling, 0 replies; 12+ messages in thread
From: Dylan Dai-Rong Jhong(鍾岱融) @ 2023-06-26 9:14 UTC (permalink / raw)
To: Li Wang
Cc: Mina Hui-Min Chou(周慧敏),
Tim Shih-Ting OuYang(歐陽士庭),
x5710999x@gmail.com, ltp@lists.linux.it
Hi Li Wang,
Thanks for the review.
Please ignore my email I just replied to you, I forgot to click “reply all”.
Please consider this email the primary email.
From: Li Wang <liwang@redhat.com>
Sent: Monday, June 26, 2023 2:57 PM
To: Dylan Dai-Rong Jhong(鍾岱融) <dylan@andestech.com>
Cc: ltp@lists.linux.it; Mina Hui-Min Chou(周慧敏) <minachou@andestech.com>; Tim Shih-Ting OuYang(歐陽士庭) <tim609@andestech.com>; x5710999x@gmail.com; Cyril Hrubis <chrubis@suse.cz>
Subject: Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
On Thu, Jun 15, 2023 at 5:40 PM Dylan Jhong <dylan@andestech.com<mailto:dylan@andestech.com>> wrote:
When testing hugeshmctl02 under the 32bit architecture, a segmentation fault
will occur. This patch will skip EFAULT tests for libc variant.
Hugeshmctl02 will intentionally pass "(struct shmid_ds *)-1" to shmctl(), but
glibc will perform an additional conversion function when the architecture is
32bit, which will try to copy all items in (struct shmid_ds *) to another
structure[*1]. In the process of copying, it is necessary to dereference
"(struct shmid_ds *)-1", resulting in segmentation fault.
The LTP also has similar problems before, this patch is reference from the
shmctl03 patch[*2].
[*1]: https://github.com/bminor/glibc/blob/master/sysdeps/unix/sysv/linux/shmctl.c#L37
[*2]: https://github.com/linux-test-project/ltp/commit/a5a80aa8485a7cb017f96aba8d7b5ea79f1ba4d4
Signed-off-by: Dylan Jhong <dylan@andestech.com<mailto:dylan@andestech.com>>
---
.../mem/hugetlb/hugeshmctl/hugeshmctl02.c | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index 0bc9ffd74..e9c2e9fc8 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -27,6 +27,7 @@
#include <pwd.h>
#include <limits.h>
#include "hugetlb.h"
+#include "lapi/syscalls.h"
static size_t shm_size;
static int shm_id_1 = -1;
@@ -50,9 +51,37 @@ struct tcase {
{&shm_id_2, -1, &buf, EINVAL},
};
+static int libc_shmctl(int shmid, int cmd, void *buf)
+{
+ return shmctl(shmid, cmd, buf);
+}
+
+static int sys_shmctl(int shmid, int cmd, void *buf)
+{
+ return tst_syscall(__NR_shmctl, shmid, cmd, buf);
+}
+
+static struct test_variants
+{
+ int (*shmctl)(int shmid, int cmd, void *buf);
+ char *desc;
+} variants[] = {
+ { .shmctl = libc_shmctl, .desc = "libc shmctl()"},
+#if (__NR_shmctl != __LTP__NR_INVALID_SYSCALL)
+ { .shmctl = sys_shmctl, .desc = "__NR_shmctl syscall"},
+#endif
+};
+
static void test_hugeshmctl(unsigned int i)
{
- TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
+ struct test_variants *tv = &variants[tst_variant];
+
+ if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl) {
You pointed the segment fault only exists on 32bit when use
libc wrapper, but this condition skips for both 64and32 bits,
isn't it?
I guess the strict condition should be as below?
if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl && tst_kernel_bits() == 32) {
...
}
Indeed, this only happens on 32-bit architectures, so the condition you added is no problem.
But in other LTP test cases, this condition is not considered on both 32/64 bit.
For example:
- msgctl04: https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c#L74
- semctl04: https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/ipc/semctl/semctl03.c#L78
- sched_rr_get_interval03.c: https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/sched_rr_get_interval/sched_rr_get_interval03.c#L71
Not sure if the original developers didn't think of this or LTP just wanted to ignore this condition.
Do you think the condition needs to be modified to only ignore 32 bits, or designed to be the same as the other LTP test cases so that 32/64 bits are ignored?
Thanks,
Dylan
+ tst_res(TCONF, "EFAULT is skipped for libc variant");
+ return;
+ }
+
+ TEST(tv->shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
if (TST_RET != -1) {
tst_res(TFAIL, "shmctl succeeded unexpectedly");
return;
@@ -70,8 +99,11 @@ static void test_hugeshmctl(unsigned int i)
static void setup(void)
{
+ struct test_variants *tv = &variants[tst_variant];
long hpage_size;
+ tst_res(TINFO, "Testing variant: %s", tv->desc);
+
if (tst_hugepages == 0)
tst_brk(TCONF, "No enough hugepages for testing.");
@@ -101,6 +133,7 @@ static void cleanup(void)
static struct tst_test test = {
.test = test_hugeshmctl,
+ .test_variants = ARRAY_SIZE(variants),
.tcnt = ARRAY_SIZE(tcases),
.needs_root = 1,
.needs_tmpdir = 1,
--
2.34.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
--
Regards,
Li Wang
CONFIDENTIALITY NOTICE:
This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.
Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-26 6:57 ` Li Wang
2023-06-26 9:14 ` Dylan Dai-Rong Jhong(鍾岱融)
@ 2023-06-26 9:23 ` Cyril Hrubis
2023-06-27 1:26 ` Li Wang
1 sibling, 1 reply; 12+ messages in thread
From: Cyril Hrubis @ 2023-06-26 9:23 UTC (permalink / raw)
To: Li Wang; +Cc: minachou, tim609, x5710999x, ltp
Hi!
> You pointed the segment fault only exists on 32bit when use
> libc wrapper, but this condition skips for both 64and32 bits,
> isn't it?
>
> I guess the strict condition should be as below?
>
> if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl &&
> tst_kernel_bits() == 32) {
> ...
> }
Actually I think that it may be safer to skip libc version regardless,
as long as we have the raw syscall test in place we are not getting any
more coverage from passing invalid address to the libc call, since
either the libc call is thin wrapper, i.e. equivalent to the syscall()
call which we already test, or it does something to the arguments, in
which case it's possible to trigger segfault, if not now in some future
libc versions.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-26 9:23 ` Cyril Hrubis
@ 2023-06-27 1:26 ` Li Wang
2023-06-27 13:50 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Li Wang @ 2023-06-27 1:26 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: minachou, tim609, x5710999x, ltp
On Mon, Jun 26, 2023 at 5:22 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > You pointed the segment fault only exists on 32bit when use
> > libc wrapper, but this condition skips for both 64and32 bits,
> > isn't it?
> >
> > I guess the strict condition should be as below?
> >
> > if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl &&
> > tst_kernel_bits() == 32) {
> > ...
> > }
>
> Actually I think that it may be safer to skip libc version regardless,
> as long as we have the raw syscall test in place we are not getting any
> more coverage from passing invalid address to the libc call, since
> either the libc call is thin wrapper, i.e. equivalent to the syscall()
> call which we already test, or it does something to the arguments, in
> which case it's possible to trigger segfault, if not now in some future
> libc versions.
>
Okay, sounds reasonable. I agree with this.
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-27 1:26 ` Li Wang
@ 2023-06-27 13:50 ` Petr Vorel
2023-06-27 15:06 ` Cyril Hrubis
0 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-06-27 13:50 UTC (permalink / raw)
To: Li Wang; +Cc: minachou, tim609, ltp, x5710999x
Hi all,
> On Mon, Jun 26, 2023 at 5:22 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> > Hi!
> > > You pointed the segment fault only exists on 32bit when use
> > > libc wrapper, but this condition skips for both 64and32 bits,
> > > isn't it?
> > > I guess the strict condition should be as below?
> > > if (tcases[i].error == EFAULT && tv->shmctl == libc_shmctl &&
> > > tst_kernel_bits() == 32) {
> > > ...
> > > }
> > Actually I think that it may be safer to skip libc version regardless,
> > as long as we have the raw syscall test in place we are not getting any
> > more coverage from passing invalid address to the libc call, since
> > either the libc call is thin wrapper, i.e. equivalent to the syscall()
> > call which we already test, or it does something to the arguments, in
> > which case it's possible to trigger segfault, if not now in some future
> > libc versions.
Good to know. Because at least of some of the tests modified by Vinay Kumar
(which Dylan is referring) aren't able to run on 32bit libc if we skip with
&& tst_kernel_bits() == 32, e.g.
./msgctl04
tst_test.c:1558: TINFO: Timeout per run is 0h 00m 30s
msgctl04.c:103: TINFO: Testing variant: libc msgctl()
msgctl04.c:79: TPASS: msgctl(32816, 2, 0x565e4700) : EACCES (13)
tst_kernel.c:87: TINFO: uname.machine=x86_64 kernel is 64bit
tst_test.c:1618: TBROK: Test killed by SIGSEGV!
> Okay, sounds reasonable. I agree with this.
BTW I also get ENOMEM on my laptop (currently 1G free space):
hugeshmctl02.c:119: TBROK: shmget #1: ENOMEM (12)
Should we handle it somehow?
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-27 13:50 ` Petr Vorel
@ 2023-06-27 15:06 ` Cyril Hrubis
2023-06-27 18:26 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Cyril Hrubis @ 2023-06-27 15:06 UTC (permalink / raw)
To: Petr Vorel; +Cc: minachou, tim609, ltp, x5710999x
Hi!
> > Okay, sounds reasonable. I agree with this.
>
> BTW I also get ENOMEM on my laptop (currently 1G free space):
> hugeshmctl02.c:119: TBROK: shmget #1: ENOMEM (12)
>
> Should we handle it somehow?
The line 119 looks suspicions, in latest git the hugeshmctl02.c does not
even have 119 lines.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-27 15:06 ` Cyril Hrubis
@ 2023-06-27 18:26 ` Petr Vorel
2023-07-06 3:13 ` Dylan Dai-Rong Jhong(鍾岱融)
0 siblings, 1 reply; 12+ messages in thread
From: Petr Vorel @ 2023-06-27 18:26 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: minachou, tim609, ltp, x5710999x
Hi All,
Reviewed-by: Petr Vorel <pvorel@suse.cz>
LGTM.
> Hi!
> > > Okay, sounds reasonable. I agree with this.
> > BTW I also get ENOMEM on my laptop (currently 1G free space):
> > hugeshmctl02.c:119: TBROK: shmget #1: ENOMEM (12)
> > Should we handle it somehow?
> The line 119 looks suspicions, in latest git the hugeshmctl02.c does not
> even have 119 lines.
Well, it occurred with this patch (file has with it 147 lines). Previously the
version from master worked, but now it also reports ENOMEM even on master:
hugeshmctl02.c:87: TBROK: shmget #1: ENOMEM (12)
(therefore not this patch specific). Should we use .min_mem_avail? (not sure
which value).
nit: The patch subject is "hugeshmctl02: Skipped EFAULT tests for libc variant".
"Skipped" => "Skip" (we use imperative mood).
IMHO more important is the fact, that test variant was added, that's what I'd
mention in the subject. Of course, I'd keep in the commit message body that
libc variant was skipped.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-06-27 18:26 ` Petr Vorel
@ 2023-07-06 3:13 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-07-11 11:24 ` Dylan Dai-Rong Jhong(鍾岱融)
0 siblings, 1 reply; 12+ messages in thread
From: Dylan Dai-Rong Jhong(鍾岱融) @ 2023-07-06 3:13 UTC (permalink / raw)
To: Petr Vorel, Cyril Hrubis
Cc: Mina Hui-Min Chou(周慧敏),
Tim Shih-Ting OuYang(歐陽士庭),
x5710999x@gmail.com, ltp@lists.linux.it
Hi All,
Thanks for reviewing this patch.
> Hi All,
> Reviewed-by: Petr Vorel <pvorel@suse.cz> LGTM.
> > Hi!
> > > > Okay, sounds reasonable. I agree with this.
> > > BTW I also get ENOMEM on my laptop (currently 1G free space):
> > > hugeshmctl02.c:119: TBROK: shmget #1: ENOMEM (12)
> > > Should we handle it somehow?
> > The line 119 looks suspicions, in latest git the hugeshmctl02.c does
> > not even have 119 lines.
> Well, it occurred with this patch (file has with it 147 lines). Previously the version from master worked, but now it also reports ENOMEM even on master:
> hugeshmctl02.c:87: TBROK: shmget #1: ENOMEM (12) (therefore not this patch specific). Should we use .min_mem_avail? (not sure which value).
This patch only adds a set of test variants, and does not modify the content of the test items. I think this error should have nothing to do with this patch, maybe another patch can be sent to solve the "ENOMEM" problem.
> nit: The patch subject is "hugeshmctl02: Skipped EFAULT tests for libc variant".
> "Skipped" => "Skip" (we use imperative mood).
> IMHO more important is the fact, that test variant was added, that's what I'd mention in the subject. Of course, I'd keep in the commit message body that libc variant was skipped.
Thanks for the correction. Do I have to submit a V2 patch to fix the title?
> Kind regards,
> Petr
CONFIDENTIALITY NOTICE:
This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.
Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-07-06 3:13 ` Dylan Dai-Rong Jhong(鍾岱融)
@ 2023-07-11 11:24 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-07-11 22:24 ` Petr Vorel
0 siblings, 1 reply; 12+ messages in thread
From: Dylan Dai-Rong Jhong(鍾岱融) @ 2023-07-11 11:24 UTC (permalink / raw)
To: Dylan Dai-Rong Jhong(鍾岱融), Petr Vorel,
Cyril Hrubis
Cc: Mina Hui-Min Chou(周慧敏),
Tim Shih-Ting OuYang(歐陽士庭),
ltp@lists.linux.it, x5710999x@gmail.com
Hi All,
Any update on this patch?
Best,
Dylan
> Hi All,
> Thanks for reviewing this patch.
> > Hi All,
> > Reviewed-by: Petr Vorel <pvorel@suse.cz> LGTM.
> > > Hi!
> > > > > Okay, sounds reasonable. I agree with this.
> > > > BTW I also get ENOMEM on my laptop (currently 1G free space):
> > > > hugeshmctl02.c:119: TBROK: shmget #1: ENOMEM (12)
> > > > Should we handle it somehow?
> > > The line 119 looks suspicions, in latest git the hugeshmctl02.c does
> > > not even have 119 lines.
> > Well, it occurred with this patch (file has with it 147 lines). Previously the version from master worked, but now it also reports ENOMEM even on master:
> > hugeshmctl02.c:87: TBROK: shmget #1: ENOMEM (12) (therefore not this patch specific). Should we use .min_mem_avail? (not sure which value).
> This patch only adds a set of test variants, and does not modify the content of the test items. I think this error should have nothing to do with this patch, maybe another patch can be sent to solve the "ENOMEM" problem.
> > nit: The patch subject is "hugeshmctl02: Skipped EFAULT tests for libc variant".
> > "Skipped" => "Skip" (we use imperative mood).
> > IMHO more important is the fact, that test variant was added, that's what I'd mention in the subject. Of course, I'd keep in the commit message body that libc variant was skipped.
> Thanks for the correction. Do I have to submit a V2 patch to fix the title?
> > Kind regards,
> > Petr
CONFIDENTIALITY NOTICE:
This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.
Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant
2023-07-11 11:24 ` Dylan Dai-Rong Jhong(鍾岱融)
@ 2023-07-11 22:24 ` Petr Vorel
0 siblings, 0 replies; 12+ messages in thread
From: Petr Vorel @ 2023-07-11 22:24 UTC (permalink / raw)
To: Dylan Dai-Rong Jhong(鍾岱融)
Cc: Mina Hui-Min Chou(周慧敏),
Tim Shih-Ting OuYang(歐陽士庭),
ltp@lists.linux.it, x5710999x@gmail.com
Hi Dylan,
patch merged, thanks!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-07-11 22:24 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 9:39 [LTP] [PATCH] hugeshmctl02: Skipped EFAULT tests for libc variant Dylan Jhong
2023-06-26 2:36 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 6:57 ` Li Wang
2023-06-26 9:14 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-06-26 9:23 ` Cyril Hrubis
2023-06-27 1:26 ` Li Wang
2023-06-27 13:50 ` Petr Vorel
2023-06-27 15:06 ` Cyril Hrubis
2023-06-27 18:26 ` Petr Vorel
2023-07-06 3:13 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-07-11 11:24 ` Dylan Dai-Rong Jhong(鍾岱融)
2023-07-11 22:24 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox