Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107428906
D47817.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47817.diff
View Options
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -187,11 +187,6 @@
{
/*
- * The LLVM integrated assembler doesn't understand the PAN
- * PSTATE field. Because of this we need to manually create
- * the instruction in an asm block. This is equivalent to:
- * msr pan, #1
- *
* This sets the PAN bit, stopping the kernel from accessing
* memory when userspace can also access it unless the kernel
* uses the userspace load/store instructions.
@@ -199,7 +194,10 @@
if (has_pan) {
WRITE_SPECIALREG(sctlr_el1,
READ_SPECIALREG(sctlr_el1) & ~SCTLR_SPAN);
- __asm __volatile(".inst 0xd500409f | (0x1 << 8)");
+ __asm __volatile(
+ ".arch_extension pan \n"
+ "msr pan, #1 \n"
+ ".arch_extension nopan \n");
}
}
diff --git a/sys/arm64/include/asm.h b/sys/arm64/include/asm.h
--- a/sys/arm64/include/asm.h
+++ b/sys/arm64/include/asm.h
@@ -87,19 +87,25 @@
ldr tmp, =has_pan; /* Get the addr of has_pan */ \
ldr reg, [tmp]; /* Read it */ \
cbz reg, 997f; /* If no PAN skip */ \
- .inst 0xd500409f | (0 << 8); /* Clear PAN */ \
+ .arch_extension pan; \
+ msr pan, #0; /* Disable PAN checks */ \
+ .arch_extension nopan; \
997:
#define EXIT_USER_ACCESS(reg) \
cbz reg, 998f; /* If no PAN skip */ \
- .inst 0xd500409f | (1 << 8); /* Set PAN */ \
+ .arch_extension pan; \
+ msr pan, #1; /* Enable PAN checks */ \
+ .arch_extension nopan; \
998:
#define EXIT_USER_ACCESS_CHECK(reg, tmp) \
ldr tmp, =has_pan; /* Get the addr of has_pan */ \
ldr reg, [tmp]; /* Read it */ \
cbz reg, 999f; /* If no PAN skip */ \
- .inst 0xd500409f | (1 << 8); /* Set PAN */ \
+ .arch_extension pan; \
+ msr pan, #1; /* Enable PAN checks */ \
+ .arch_extension nopan; \
999:
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 15, 1:02 AM (10 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15803467
Default Alt Text
D47817.diff (1 KB)
Attached To
Mode
D47817: arm64: Use the PAN msr mnemonic rather than .inst
Attached
Detach File
Event Timeline
Log In to Comment