Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2026 09:45:45 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 804daf166406 - main - imgact_elf: read program headers if not contained in the first page
Message-ID:  <6c63abe2-f8d0-4b64-a3b1-1ad9e1a0a100@FreeBSD.org>
In-Reply-To: <ahmlPPP9mBqx8vzP@kib.kiev.ua>
References:  <6a18acc7.32ef9.6a0db43@gitrepo.freebsd.org> <e76f0994-4284-4e86-a03b-834962748a04@FreeBSD.org> <ahmlPPP9mBqx8vzP@kib.kiev.ua>

index | next in thread | previous in thread | raw e-mail

On 5/29/26 10:39, Konstantin Belousov wrote:
> On Fri, May 29, 2026 at 10:30:48AM -0400, John Baldwin wrote:
>> On 5/28/26 16:59, Konstantin Belousov wrote:
>>> The branch main has been updated by kib:
>>>
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=804daf166406a1b0e22f93b9417b90ed7d3aa1ae
>>>
>>> commit 804daf166406a1b0e22f93b9417b90ed7d3aa1ae
>>> Author:     Konstantin Belousov <kib@FreeBSD.org>
>>> AuthorDate: 2026-05-28 09:06:33 +0000
>>> Commit:     Konstantin Belousov <kib@FreeBSD.org>
>>> CommitDate: 2026-05-28 20:59:26 +0000
>>>
>>>       imgact_elf: read program headers if not contained in the first page
>>>       PR:     295629
>>>       Reviewed by:    markj
>>>       Tested by:      Alex S <iwtcex@gmail.com>
>>>       Sponsored by:   The FreeBSD Foundation
>>>       MFC after:      1 week
>>>       Differential revision:  https://reviews.freebsd.org/D57294
>>
>> Oh well, I wish I had seen this earlier.  I already had a version of this downstream in
>> CheriBSD as we have a CHERI-specific case of many phdrs.  I had a sysctl/tunable to control
>> how many pages of phdrs were allowed which defaulted to something like 4 pages worth but
>> could be more easily adjusted than the hardcoded constant here.  I will see if I can upstream
>> the sysctl at least.
> 
> A sysctl should be a no-brainer, I can add it.  I did not see much value
> in it being tunable, the current 128 value should be enough for everything?

In the changes we have downstream both in LLD and CheriBSD, we support decomposing
executables and libraries into multiple compartments which results in separate
.text, .data, etc. for each compartment.  This results in an arbitrary number of
PT_LOADs (as well as additional phdrs CHERI uses such as a PT_CHERI_PCC that is
somewhat akin to PT_GNU_RELRO in that it describes properties of a region of
address space).  So we can indeed construct binaries with many phdrs.

-- 
John Baldwin



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6c63abe2-f8d0-4b64-a3b1-1ad9e1a0a100>