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