2 * aio-io-setup-with-nonwritable-context-pointer -
3 * Test what happens when a non-writable context pointer is passed to io_setup
4 * Copyright (C) 2007 Jeff Moyer
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 * Description: Pass a non-writable context pointer to io_setup to see if
25 * the kernel deals with it correctly. In the past, the reference counting
26 * in this particular error path was off and this operation would cause an
29 * This is a destructive test.
38 main(int __attribute__((unused)) argc, char **argv)
42 addr = mmap(NULL, 4096, PROT_READ, MAP_SHARED|MAP_ANONYMOUS, 0, 0);
43 if (addr == MAP_FAILED) {
47 io_setup(1, addr /* un-writable pointer */);
49 printf("%s: Success!\n", basename(argv[0]));