The kernel might check for a valid context before checking the access of the pointers. In such a case, it will return EINVAL instead of EFAULT. Add an io_setup step to the test to ensure the io_cancel syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com --- This patch doesn't have any dependency, but it's a dependency to the following Morello Linux series: "Support aio shared memory usage in the Purecap apps"
Review branch: https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morello... --- .../kernel/syscalls/io_cancel/io_cancel01.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c index f7e8bd061ed7..f31ed07fac93 100644 --- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c +++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c @@ -18,11 +18,22 @@ #include "tst_test.h" #include "lapi/syscalls.h"
-static void run(void) +static aio_context_t ctx; + +static void setup(void) { - aio_context_t ctx; + TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx)); +}
- memset(&ctx, 0, sizeof(ctx)); +static void cleanup(void) +{ + if (ctx) + TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx)); +} + + +static void run(void) +{ TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT); }
@@ -31,5 +42,7 @@ static struct tst_test test = { "CONFIG_AIO=y", NULL }, + .setup = setup, + .cleanup = cleanup, .test_all = run, };
On 18/04/2023 12:12, Tudor Cretu wrote:
The kernel might check for a valid context before checking the access of the pointers. In such a case, it will return EINVAL instead of EFAULT. Add an io_setup step to the test to ensure the io_cancel syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com
This patch doesn't have any dependency, but it's a dependency to the following Morello Linux series: "Support aio shared memory usage in the Purecap apps"
Review branch: https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morello...
.../kernel/syscalls/io_cancel/io_cancel01.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c index f7e8bd061ed7..f31ed07fac93 100644 --- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c +++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c @@ -18,11 +18,22 @@ #include "tst_test.h" #include "lapi/syscalls.h" -static void run(void) +static aio_context_t ctx;
+static void setup(void) {
- aio_context_t ctx;
- TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+}
- memset(&ctx, 0, sizeof(ctx));
+static void cleanup(void) +{
- if (ctx)
TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+static void run(void) +{ TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT); } @@ -31,5 +42,7 @@ static struct tst_test test = { "CONFIG_AIO=y", NULL },
- .setup = setup,
- .cleanup = cleanup, .test_all = run, };
Looks good to me, thanks Tudor !
Best regards, Téo
On 18/04/2023 13:12, Tudor Cretu wrote:
The kernel might check for a valid context before checking the access of the pointers. In such a case, it will return EINVAL instead of EFAULT. Add an io_setup step to the test to ensure the io_cancel syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com
This patch doesn't have any dependency, but it's a dependency to the following Morello Linux series: "Support aio shared memory usage in the Purecap apps"
Looks good to me too and agreed this patch has no dependency, it should work with and without your AIO series. It can therefore already be merged.
Kevin
Review branch: https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morello...
.../kernel/syscalls/io_cancel/io_cancel01.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c index f7e8bd061ed7..f31ed07fac93 100644 --- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c +++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c @@ -18,11 +18,22 @@ #include "tst_test.h" #include "lapi/syscalls.h" -static void run(void) +static aio_context_t ctx;
+static void setup(void) {
- aio_context_t ctx;
- TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+}
- memset(&ctx, 0, sizeof(ctx));
+static void cleanup(void) +{
- if (ctx)
TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+static void run(void) +{ TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT); } @@ -31,5 +42,7 @@ static struct tst_test test = { "CONFIG_AIO=y", NULL },
- .setup = setup,
- .cleanup = cleanup, .test_all = run,
};
Hi Tudor,
Overall the change looks good though it seems the other io_cancel test might suffer from the same issue (?). Might be worth to make those two aligned, event though the other one will not be triggered.
--- BR B. On Tue, Apr 18, 2023 at 12:12:30PM +0100, Tudor Cretu wrote:
The kernel might check for a valid context before checking the access of the pointers. In such a case, it will return EINVAL instead of EFAULT. Add an io_setup step to the test to ensure the io_cancel syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com
This patch doesn't have any dependency, but it's a dependency to the following Morello Linux series: "Support aio shared memory usage in the Purecap apps"
Review branch: https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morello...
.../kernel/syscalls/io_cancel/io_cancel01.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c index f7e8bd061ed7..f31ed07fac93 100644 --- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c +++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c @@ -18,11 +18,22 @@ #include "tst_test.h" #include "lapi/syscalls.h" -static void run(void) +static aio_context_t ctx;
+static void setup(void) {
- aio_context_t ctx;
- TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+}
- memset(&ctx, 0, sizeof(ctx));
+static void cleanup(void) +{
- if (ctx)
TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+static void run(void) +{ TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT); } @@ -31,5 +42,7 @@ static struct tst_test test = { "CONFIG_AIO=y", NULL },
- .setup = setup,
- .cleanup = cleanup, .test_all = run,
};
2.34.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
On 08-06-2023 10:48, Beata Michalska wrote:
Hi Tudor,
Overall the change looks good though it seems the other io_cancel test might suffer from the same issue (?). Might be worth to make those two aligned, event though the other one will not be triggered.
Hi Beata,
Very good point! Updated the patch.
Many thanks, Tudor
BR B. On Tue, Apr 18, 2023 at 12:12:30PM +0100, Tudor Cretu wrote:
The kernel might check for a valid context before checking the access of the pointers. In such a case, it will return EINVAL instead of EFAULT. Add an io_setup step to the test to ensure the io_cancel syscall fails because of the intended cause.
Signed-off-by: Tudor Cretu tudor.cretu@arm.com
This patch doesn't have any dependency, but it's a dependency to the following Morello Linux series: "Support aio shared memory usage in the Purecap apps"
Review branch: https://git.morello-project.org/tudcre01/morello-linux-ltp/-/commits/morello...
.../kernel/syscalls/io_cancel/io_cancel01.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/syscalls/io_cancel/io_cancel01.c b/testcases/kernel/syscalls/io_cancel/io_cancel01.c index f7e8bd061ed7..f31ed07fac93 100644 --- a/testcases/kernel/syscalls/io_cancel/io_cancel01.c +++ b/testcases/kernel/syscalls/io_cancel/io_cancel01.c @@ -18,11 +18,22 @@ #include "tst_test.h" #include "lapi/syscalls.h" -static void run(void) +static aio_context_t ctx;
+static void setup(void) {
- aio_context_t ctx;
- TST_EXP_PASS_SILENT(tst_syscall(__NR_io_setup, 1, &ctx));
+}
- memset(&ctx, 0, sizeof(ctx));
+static void cleanup(void) +{
- if (ctx)
TST_EXP_PASS_SILENT(tst_syscall(__NR_io_destroy, ctx));
+}
+static void run(void) +{ TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT); } @@ -31,5 +42,7 @@ static struct tst_test test = { "CONFIG_AIO=y", NULL },
- .setup = setup,
- .cleanup = cleanup, .test_all = run, };
-- 2.34.1
linux-morello-ltp mailing list -- linux-morello-ltp@op-lists.linaro.org To unsubscribe send an email to linux-morello-ltp-leave@op-lists.linaro.org
linux-morello-ltp@op-lists.linaro.org