I was hacking away at other stuff and disabled pg_ps_enabled for testing, but left aslr enabled. On boot the machine panics with integer division by zero. Happens when starting init. In a function called something like rnd_elf64_imgact, or similar. It's gone too quickly to read, machine just reboots instantly.
Created attachment 222451 [details] proposed patch
thanks, that patch works for me! (and i see how it fixes the problem by avoiding the zero-divide in rnd_elf64_base() in roundup()) btw, for me sysctl hw.pagesizes always comes up empty (prints nothing, except its description).
(In reply to johannes from comment #2) I think you might need this for `sysctl hw.pagesizes` to work: https://cgit.freebsd.org/src/commit/sys/kern/kern_mib.c?id=a0efcf6400788d856b8b89dfff7ef63007896d90 the sysctl works for me on recent HEAD, but not 12-STABLE.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=41032835dc2d489ec7841d7529f74f6389329cd3 commit 41032835dc2d489ec7841d7529f74f6389329cd3 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2021-02-15 02:47:22 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-02-15 18:38:04 +0000 Fix divide-by-zero panic when ASLR is enabled and superpages disabled When locating the anonymous memory region for a vm_map with ASLR enabled, we try to keep the slid base address aligned on a superpage boundary to minimize pagetable fragmentation and maximize the potential usage of superpage mappings. We can't (portably) do this if superpages have been disabled by loader tunable and pagesizes[1] is 0, and it would be less beneficial in that case anyway. PR: 253511 Reported by: johannes@jo-t.de MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28678 sys/kern/imgact_elf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fc6c898ec5f46c730b8f2902c2692549de47d7d6 commit fc6c898ec5f46c730b8f2902c2692549de47d7d6 Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2021-02-15 02:47:22 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-02-24 00:01:30 +0000 Fix divide-by-zero panic when ASLR is enabled and superpages disabled When locating the anonymous memory region for a vm_map with ASLR enabled, we try to keep the slid base address aligned on a superpage boundary to minimize pagetable fragmentation and maximize the potential usage of superpage mappings. We can't (portably) do this if superpages have been disabled by loader tunable and pagesizes[1] is 0, and it would be less beneficial in that case anyway. PR: 253511 (cherry picked from commit 41032835dc2d489ec7841d7529f74f6389329cd3) sys/kern/imgact_elf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=941747f63cfa127248e6c7246f75c5ac5e142fcc commit 941747f63cfa127248e6c7246f75c5ac5e142fcc Author: Jason A. Harmening <jah@FreeBSD.org> AuthorDate: 2021-02-15 02:47:22 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> CommitDate: 2021-02-24 00:04:00 +0000 Fix divide-by-zero panic when ASLR is enabled and superpages disabled When locating the anonymous memory region for a vm_map with ASLR enabled, we try to keep the slid base address aligned on a superpage boundary to minimize pagetable fragmentation and maximize the potential usage of superpage mappings. We can't (portably) do this if superpages have been disabled by loader tunable and pagesizes[1] is 0, and it would be less beneficial in that case anyway. PR: 253511 (cherry picked from commit 41032835dc2d489ec7841d7529f74f6389329cd3) sys/kern/imgact_elf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)