Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef _PKEYS_HELPER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _PKEYS_HELPER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #define _GNU_SOURCE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <stdarg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <stdint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <signal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <assert.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <ucontext.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <sys/mman.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) /* Define some kernel-like types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define  u8 __u8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define u16 __u16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define u32 __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define u64 __u64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define PTR_ERR_ENOTSUP ((void *)-ENOTSUP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifndef DEBUG_LEVEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define DEBUG_LEVEL 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define DPRINT_IN_SIGNAL_BUF_SIZE 4096
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) extern int dprint_in_signal;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) extern char dprint_in_signal_buffer[DPRINT_IN_SIGNAL_BUF_SIZE];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) extern int test_nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) extern int iteration_nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #ifdef __GNUC__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) __attribute__((format(printf, 1, 2)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) static inline void sigsafe_printf(const char *format, ...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	va_list ap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	if (!dprint_in_signal) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		va_start(ap, format);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		vprintf(format, ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		va_end(ap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		 * No printf() functions are signal-safe.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		 * They deadlock easily. Write the format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		 * string to get some output, even if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		 * incomplete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		ret = write(1, format, strlen(format));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 			exit(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define dprintf_level(level, args...) do {	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	if (level <= DEBUG_LEVEL)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		sigsafe_printf(args);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define dprintf0(args...) dprintf_level(0, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define dprintf1(args...) dprintf_level(1, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) #define dprintf2(args...) dprintf_level(2, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #define dprintf3(args...) dprintf_level(3, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) #define dprintf4(args...) dprintf_level(4, args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) extern void abort_hooks(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define pkey_assert(condition) do {		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	if (!(condition)) {			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		dprintf0("assert() at %s::%d test_nr: %d iteration: %d\n", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 				__FILE__, __LINE__,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 				test_nr, iteration_nr);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		dprintf0("errno at assert: %d", errno);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		abort_hooks();			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		exit(__LINE__);			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	}					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) __attribute__((noinline)) int read_ptr(int *ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) void expected_pkey_fault(int pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) int sys_pkey_free(unsigned long pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) int mprotect_pkey(void *ptr, size_t size, unsigned long orig_prot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		unsigned long pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) void record_pkey_malloc(void *ptr, long size, int prot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) #if defined(__i386__) || defined(__x86_64__) /* arch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) #include "pkey-x86.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #elif defined(__powerpc64__) /* arch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #include "pkey-powerpc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) #else /* arch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) #error Architecture not supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #endif /* arch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) #define PKEY_MASK	(PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	u32 shift = pkey_bit_position(pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	/* mask out bits from pkey in old value */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	reg &= ~((u64)PKEY_MASK << shift);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/* OR in new bits for pkey */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	reg |= (flags & PKEY_MASK) << shift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	return reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static inline u64 get_pkey_bits(u64 reg, int pkey)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	u32 shift = pkey_bit_position(pkey);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	 * shift down the relevant bits to the lowest two, then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	 * mask off all the other higher bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	return ((reg >> shift) & PKEY_MASK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) extern u64 shadow_pkey_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) static inline u64 _read_pkey_reg(int line)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	u64 pkey_reg = __read_pkey_reg();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	dprintf4("read_pkey_reg(line=%d) pkey_reg: %016llx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			" shadow: %016llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			line, pkey_reg, shadow_pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	assert(pkey_reg == shadow_pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	return pkey_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define read_pkey_reg() _read_pkey_reg(__LINE__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static inline void write_pkey_reg(u64 pkey_reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	dprintf4("%s() changing %016llx to %016llx\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			__read_pkey_reg(), pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	/* will do the shadow check for us: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	read_pkey_reg();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	__write_pkey_reg(pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	shadow_pkey_reg = pkey_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	dprintf4("%s(%016llx) pkey_reg: %016llx\n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			pkey_reg, __read_pkey_reg());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * These are technically racy. since something could
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * change PKEY register between the read and the write.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static inline void __pkey_access_allow(int pkey, int do_allow)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	u64 pkey_reg = read_pkey_reg();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	int bit = pkey * 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	if (do_allow)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		pkey_reg &= (1<<bit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 		pkey_reg |= (1<<bit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	dprintf4("pkey_reg now: %016llx\n", read_pkey_reg());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	write_pkey_reg(pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) static inline void __pkey_write_allow(int pkey, int do_allow_write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	u64 pkey_reg = read_pkey_reg();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	int bit = pkey * 2 + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	if (do_allow_write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		pkey_reg &= (1<<bit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		pkey_reg |= (1<<bit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	write_pkey_reg(pkey_reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	dprintf4("pkey_reg now: %016llx\n", read_pkey_reg());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) #define ALIGN_UP(x, align_to)	(((x) + ((align_to)-1)) & ~((align_to)-1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) #define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #define ALIGN_PTR_UP(p, ptr_align_to)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	((typeof(p))ALIGN_UP((unsigned long)(p), ptr_align_to))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) #define ALIGN_PTR_DOWN(p, ptr_align_to)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	((typeof(p))ALIGN_DOWN((unsigned long)(p), ptr_align_to))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define __stringify_1(x...)     #x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) #define __stringify(x...)       __stringify_1(x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static inline u32 *siginfo_get_pkey_ptr(siginfo_t *si)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #ifdef si_pkey
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	return &si->si_pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	return (u32 *)(((u8 *)si) + si_pkey_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline int kernel_has_pkeys(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	/* try allocating a key and see if it succeeds */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	int ret = sys_pkey_alloc(0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	if (ret <= 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	sys_pkey_free(ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static inline int is_pkeys_supported(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	/* check if the cpu supports pkeys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (!cpu_has_pkeys()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		dprintf1("SKIP: %s: no CPU support\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	/* check if the kernel supports pkeys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	if (!kernel_has_pkeys()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		dprintf1("SKIP: %s: no kernel support\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) #endif /* _PKEYS_HELPER_H */