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 * Copyright (c) 2017 Xiao Yang <yangx.jy@cn.fujitsu.com> 7 * Copyright (c) 2021 Xie Ziyao <xieziyao@huawei.com> 8 */ 9 10/*\ 11 * [Description] 12 * 13 * Test io_destroy invoked via syscall(2) with an invalid ctx and expects 14 * it to return EINVAL. 15 */ 16 17#include <linux/aio_abi.h> 18 19#include "config.h" 20#include "tst_test.h" 21#include "lapi/syscalls.h" 22 23static void run(void) 24{ 25 aio_context_t ctx; 26 27 memset(&ctx, 0xff, sizeof(ctx)); 28 TST_EXP_FAIL(tst_syscall(__NR_io_destroy, ctx), EINVAL, 29 "io_destroy() with an invalid ctx"); 30} 31 32static struct tst_test test = { 33 .needs_kconfigs = (const char *[]) { 34 "CONFIG_AIO=y", 35 NULL 36 }, 37 .test_all = run, 38}; 39