libsysdecode: correctly decode mmap flags

r352913 added decoding of mmap PROT_MAX()'d flags but didn’t account for the
case where different values were specified for PROT_MAX and regular flags.
Fix it.

Submitted by:	sigsys_gmail.com
Reported by:	sigsys_gmail.com
MFC after:	7 days
Differential Revision:	https://reviews.freebsd.org/D27312
This commit is contained in:
Pawel Biernacki 2020-11-25 16:30:57 +00:00
parent ddd30dd82b
commit 4cbec44397

View File

@ -662,11 +662,11 @@ sysdecode_mmap_prot(FILE *fp, int prot, int *rem)
printed = false;
protm = PROT_MAX_EXTRACT(prot);
prot = PROT_EXTRACT(prot);
if (protm != 0) {
fputs("PROT_MAX(", fp);
printed = print_mask_int(fp, mmapprot, protm, rem);
fputs(")|", fp);
prot = protm;
}
return (print_mask_int(fp, mmapprot, prot, rem) || printed);
}