Re: svn commit: r368022 - head/lib/libsysdecode

2020-11-25 Thread John Baldwin
On 11/25/20 8:30 AM, Pawel Biernacki wrote:
> Author: kaktus
> Date: Wed Nov 25 16:30:57 2020
> New Revision: 368022
> URL: https://svnweb.freebsd.org/changeset/base/368022
> 
> Log:
>   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
> 
> Modified:
>   head/lib/libsysdecode/flags.c
> 
> Modified: head/lib/libsysdecode/flags.c
> ==
> --- head/lib/libsysdecode/flags.c Wed Nov 25 15:45:20 2020
> (r368021)
> +++ head/lib/libsysdecode/flags.c Wed Nov 25 16:30:57 2020
> (r368022)
> @@ -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;

This was probably meant to be something more like 'prot &= ~PROT_MAX(protm);'.

As it is, if there are any invalid bits set, those are now lost.  The change
to mask off only the PROT_MAX bits would preserve any invalid/unknown bits.
(To test, try passing -1 or the like as a prot value and comparing the
decoded output for kdump or truss.)

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368022 - head/lib/libsysdecode

2020-11-25 Thread Pawel Biernacki
Author: kaktus
Date: Wed Nov 25 16:30:57 2020
New Revision: 368022
URL: https://svnweb.freebsd.org/changeset/base/368022

Log:
  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

Modified:
  head/lib/libsysdecode/flags.c

Modified: head/lib/libsysdecode/flags.c
==
--- head/lib/libsysdecode/flags.c   Wed Nov 25 15:45:20 2020
(r368021)
+++ head/lib/libsysdecode/flags.c   Wed Nov 25 16:30:57 2020
(r368022)
@@ -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);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"