From d92da7594102739c7786552c53e07e4ce3367f39 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 13 Jul 2018 11:32:27 +0000 Subject: [PATCH] Round down the location of execpathp to slightly improve copyout speed. In practice, this moves the padding from below the canary to above execpathp has no impact on stack consumption. Submitted by: Wuyang-Chung (via github pull request #159) MFC after: 1 week --- sys/kern/kern_exec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index e6b3782d93dd..99b5016a41d7 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1512,6 +1512,7 @@ exec_copyout_strings(struct image_params *imgp) */ if (execpath_len != 0) { destp -= execpath_len; + destp = rounddown2(destp, sizeof(void *)); imgp->execpathp = destp; copyout(imgp->execpath, (void *)destp, execpath_len); }