Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F163831221
D15208.id41881.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
789 B
Referenced Files
None
Subscribers
None
D15208.id41881.diff
View Options
Index: libexec/rtld-elf/rtld.c
===================================================================
--- libexec/rtld-elf/rtld.c
+++ libexec/rtld-elf/rtld.c
@@ -404,7 +404,16 @@
i = aux_info[AT_CANARYLEN]->a_un.a_val;
if (i > sizeof(__stack_chk_guard))
i = sizeof(__stack_chk_guard);
- memcpy(__stack_chk_guard, aux_info[AT_CANARY]->a_un.a_ptr, i);
+
+ /*
+ * Avoid using functions which might have stack protection
+ * enabled, to update the __stack_chk_guard.
+ * Do a manual volatile copy to not allow the optimizer to
+ * call memcpy() behind us.
+ */
+ while (--i >= 0) {
+ ((char *)__stack_chk_guard)[i] = ((volatile char *)(aux_info[AT_CANARY]->a_un.a_ptr))[i];
+ }
} else {
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jul 27, 11:40 AM (16 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35596357
Default Alt Text
D15208.id41881.diff (789 B)
Attached To
Mode
D15208: update __stack_chk_guard safely
Attached
Detach File
Event Timeline
Log In to Comment