sctp: define dst_pending_confirm as a bit in sctp_transport
[linux-2.6/btrfs-unstable.git] / mm / rodata_test.c
blob0fd21670b513f735e554b340adc0d86938e32d69
1 /*
2 * rodata_test.c: functional test for mark_rodata_ro function
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
12 #include <linux/uaccess.h>
13 #include <asm/sections.h>
15 const int rodata_test_data = 0xC3;
16 EXPORT_SYMBOL_GPL(rodata_test_data);
18 void rodata_test(void)
20 unsigned long start, end;
21 int zero = 0;
23 /* test 1: read the value */
24 /* If this test fails, some previous testrun has clobbered the state */
25 if (!rodata_test_data) {
26 pr_err("rodata_test: test 1 fails (start data)\n");
27 return;
30 /* test 2: write to the variable; this should fault */
31 if (!probe_kernel_write((void *)&rodata_test_data,
32 (void *)&zero, sizeof(zero))) {
33 pr_err("rodata_test: test data was not read only\n");
34 return;
37 /* test 3: check the value hasn't changed */
38 if (rodata_test_data == zero) {
39 pr_err("rodata_test: test data was changed\n");
40 return;
43 /* test 4: check if the rodata section is PAGE_SIZE aligned */
44 start = (unsigned long)__start_rodata;
45 end = (unsigned long)__end_rodata;
46 if (start & (PAGE_SIZE - 1)) {
47 pr_err("rodata_test: start of .rodata is not page size aligned\n");
48 return;
50 if (end & (PAGE_SIZE - 1)) {
51 pr_err("rodata_test: end of .rodata is not page size aligned\n");
52 return;
55 pr_info("rodata_test: all tests were successful\n");