1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) Crackerjack Project., 2007
4  * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
5  * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
6  */
7 
8 /*\
9  * [Description]
10  *
11  * Test io_cancel invoked via syscall(2) with one of pointers set to invalid
12  * address and expects it to return EFAULT.
13  */
14 
15 #include <linux/aio_abi.h>
16 
17 #include "config.h"
18 #include "tst_test.h"
19 #include "lapi/syscalls.h"
20 
run(void)21 static void run(void)
22 {
23 	aio_context_t ctx;
24 
25 	memset(&ctx, 0, sizeof(ctx));
26 	TST_EXP_FAIL(tst_syscall(__NR_io_cancel, ctx, NULL, NULL), EFAULT);
27 }
28 
29 static struct tst_test test = {
30 	.needs_kconfigs = (const char *[]) {
31 		"CONFIG_AIO=y",
32 		NULL
33 	},
34 	.test_all = run,
35 };
36