1 /* 2 * Copyright (c) 2021, Google Inc. All rights reserved 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24 #include <stdbool.h> 25 #include <stdint.h> 26 27 /** 28 * mmutest_arch_rodata_pnx() - Test that rodata section is mapped pnx 29 * 30 * Return: 31 * * ERR_FAULT - if rodata is not executable 32 * * 0 - if rodata is executable 33 */ 34 int mmutest_arch_rodata_pnx(void); 35 36 /** 37 * mmutest_arch_data_pnx() - Test that data section is mapped pnx 38 * 39 * Return: 40 * * ERR_FAULT - if data is not executable 41 * * 0 - if data is executable 42 */ 43 int mmutest_arch_data_pnx(void); 44 45 /** 46 * mmutest_arch_rodata_ro() - Test that rodata section is mapped read-only 47 * 48 * Return: 49 * * ERR_FAULT - if rodata is not writable 50 * * 1 - if write to rodata is silently dropped 51 * * 0 - if rodata is writable 52 */ 53 int mmutest_arch_rodata_ro(void); 54 55 /** 56 * mmutest_arch_store_uint32() - Test if ptr is writable 57 * @ptr: Memory location to test 58 * @user: Use unprivileged store 59 * 60 * Return: 61 * * ERR_FAULT - if ptr is not writable 62 * * ERR_GENERIC - if ptr is not readable 63 * * 2 - if write does not fault, but data is lost on readback from 64 * memory 65 * * 1 - if write does not fault, but data is lost on readback from 66 * cache 67 * * 0 - if ptr is writable 68 */ 69 int mmutest_arch_store_uint32(uint32_t* ptr, bool user); 70 71 /** 72 * mmutest_arch_pan_supported() - Test is FEAT_PAN indicates PAN support. 73 * 74 * Return: 75 * * true - if PAN is supported. 76 * * false - if PAN is not supported. 77 */ 78 bool mmutest_arch_pan_supported(void); 79 80 /** 81 * mmutest_arch_pan_enabled() - Test if PAN is supported and enabled. 82 * 83 * Return: 84 * * true - PAN is supported and has been enabled. 85 * * false - PAN is not enabled or not supported. 86 */ 87 bool mmutest_arch_pan_enabled(void); 88