Page MenuHomeFreeBSD

libsysdecode: PROT_MAX() decoding bug
ClosedPublic

Authored by sigsys_gmail.com on Nov 22 2020, 8:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 5, 3:10 AM
Unknown Object (File)
Wed, Dec 4, 1:14 AM
Unknown Object (File)
Tue, Nov 26, 8:18 AM
Unknown Object (File)
Mon, Nov 25, 5:26 AM
Unknown Object (File)
Nov 23 2024, 10:23 PM
Unknown Object (File)
Nov 19 2024, 11:31 AM
Unknown Object (File)
Nov 5 2024, 11:21 AM
Unknown Object (File)
Oct 21 2024, 7:30 AM
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

Lint
Lint Skipped
Unit
Tests Skipped