Page MenuHomeFreeBSD

libsysdecode: PROT_MAX() decoding bug
ClosedPublic

Authored by sigsys_gmail.com on Nov 22 2020, 8:07 AM.
Tags
None
Referenced Files
F156669696: D27312.id79993.diff
Fri, May 15, 1:48 PM
F156652457: D27312.id.diff
Fri, May 15, 10:20 AM
F156620589: D27312.id79848.diff
Fri, May 15, 4:26 AM
F156610840: D27312.id79848.diff
Fri, May 15, 2:45 AM
F156562925: D27312.id.diff
Thu, May 14, 4:52 PM
Unknown Object (File)
Mon, May 11, 10:21 PM
Unknown Object (File)
Fri, May 1, 10:39 AM
Unknown Object (File)
Thu, Apr 30, 3:26 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