Page MenuHomeFreeBSD

libsysdecode: PROT_MAX() decoding bug
ClosedPublic

Authored by sigsys_gmail.com on Nov 22 2020, 8:07 AM.
Tags
None
Referenced Files
F160708439: D27312.id.diff
Sat, Jun 27, 12:58 AM
Unknown Object (File)
Fri, Jun 26, 2:42 AM
Unknown Object (File)
Tue, Jun 23, 7:00 PM
Unknown Object (File)
Sun, Jun 21, 11:55 PM
Unknown Object (File)
Sat, Jun 20, 7:02 PM
Unknown Object (File)
Thu, Jun 18, 10:09 PM
Unknown Object (File)
Thu, Jun 18, 1:16 PM
Unknown Object (File)
May 15 2026, 1:48 PM
Subscribers

Details

Summary

Small bug with with the regular protection bits not being decoded when there's a PROT_MAX.

Test Plan

Doesn't seem like anything uses explicit PROT_MAX()s in base. So here's a sample program to truss.

#include <stddef.h>
#include <sys/mman.h>
#include <sys/param.h>

int main() {
	int prots[] = { PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC, PROT_READ|PROT_WRITE, PROT_READ|PROT_WRITE|PROT_EXEC };
	for (size_t i = 0; i < nitems(prots); i++)
		for (size_t j = 0; j < nitems(prots); j++)
			mmap(NULL, PAGE_SIZE, prots[i] | PROT_MAX(prots[j]), MAP_ANON, -1, 0);
	return (0);
}

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable