Re: git: 884e1a00151d - main - imgact_elf: Pass program headers to the sv_protect hook
Date: Wed, 25 Nov 2026 15:38:08 UTC
On Wed, Nov 25, 2026 at 10:33:27AM -0500, John Baldwin wrote: > On 11/25/26 10:20, Mark Johnston wrote: > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=884e1a00151d181e5dd1ba9d83c1adcffd25e5e8 > > > > commit 884e1a00151d181e5dd1ba9d83c1adcffd25e5e8 > > Author: Mark Johnston <markj@FreeBSD.org> > > AuthorDate: 2026-11-25 15:17:44 +0000 > > Commit: Mark Johnston <markj@FreeBSD.org> > > CommitDate: 2026-11-25 15:17:44 +0000 > > > > imgact_elf: Pass program headers to the sv_protect hook > > We handle program headers beyond the first page of the file, but > > arm64_exec_protect() wasn't updated to handle this. Pass the program > > header array directly to the sv_protect hook. > > Also fix a pre-existing bug: imgp->et_dyn_addr isn't the right base > > address to use for the SV_INTERP case. > > Hmm, downstream in CheriBSD when we added program headers beyond the first page, > we changed affected sysent entries to pass a 'const Elf_Phdr *' instead of 'const > void *'. I think there's no harm in getting a bit more type safety. I did this originally and changed it as it felt like a small layering violation: sysent hooks shouldn't really assume that the image format is ELF, or at least, I can't see any preexisting assumptions like that, aside from sv_elf_core_*. Similarly, struct image_params uses void * in a couple of places where it could be more specific, e.g., auxargs.