Module Name:    src
Committed By:   rin
Date:           Mon Aug 30 01:25:10 UTC 2021

Modified Files:
        src/sys/kern: kern_pax.c

Log Message:
Respect alignment requests of executable when PAX_ASLR is enabled on
kernel, but disabled for the process, as in the same manner as PAX_ASLR
is disabled; see pax_aslr_exec_offset() for !PAX_ASLR in sys/sys/pax.h.

This is a regression introduced in kern_pax.c rev 1.58:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_pax.c#rev1.58

Part of PR port-arm/56380 but unfortunately this does not fix the
problem described in the PR...


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/kern_pax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.61 src/sys/kern/kern_pax.c:1.62
--- src/sys/kern/kern_pax.c:1.61	Thu Jan 23 10:21:14 2020
+++ src/sys/kern/kern_pax.c	Mon Aug 30 01:25:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.61 2020/01/23 10:21:14 ad Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.62 2021/08/30 01:25:10 rin Exp $	*/
 
 /*
  * Copyright (c) 2015, 2020 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.61 2020/01/23 10:21:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.62 2021/08/30 01:25:10 rin Exp $");
 
 #include "opt_pax.h"
 
@@ -604,7 +604,7 @@ pax_aslr_exec_offset(struct exec_package
 #endif
 	return pax_aslr_offset(align);
 out:
-	return 0;
+	return MAX(align, PAGE_SIZE);
 }
 
 voff_t

Reply via email to