Page MenuHomeFreeBSD

libsysdecode: decode PROT_MAX allocations
ClosedPublic

Authored by kaktus on Sep 18 2019, 7:12 PM.

Details

Summary

libsysdecode: decode PROT_MAX flags

Extend libsysdecode to pretty-print PROT_MAX flags and fix decoding of regular protection flags broken since r349240.

before:
truss:
mmap(0x0,40960,0x30000,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax CALL mmap(0,0xa000,0x30000<><invalid>196608,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

after:
truss:
mmap(0x0,40960,PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax CALL mmap(0,0xa000,0x30000<PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kaktus created this revision.Sep 18 2019, 7:12 PM
kib added inline comments.Sep 18 2019, 7:40 PM
lib/libsysdecode/flags.c
668 ↗(On Diff #62276)

Why don't you print non-max protection bits ?

kaktus updated this revision to Diff 62281.Sep 18 2019, 9:39 PM
kaktus edited the summary of this revision. (Show Details)

don't return too early

kaktus added inline comments.Sep 18 2019, 9:40 PM
lib/libsysdecode/flags.c
669 ↗(On Diff #62281)

Maybe I should strip the whole early return as both truss and dump ignore the return value anyway?

kaktus edited the summary of this revision. (Show Details)Sep 18 2019, 9:43 PM
kib added inline comments.Sep 19 2019, 6:47 AM
lib/libsysdecode/flags.c
669 ↗(On Diff #62281)

I do not think that you should return early at all if first print_mask_int() returned false. Instead the final return value should be false, thats all.

No, I do not think that changing the signature of the public function in libsysdecode is good idea. Because you would need to bump the lib version number due to the ABI changes, which seems to be more noise that to just satisfy the interface.

kaktus updated this revision to Diff 62303.Sep 19 2019, 10:25 AM

rewrite the return path

kib accepted this revision.Sep 19 2019, 1:05 PM
This revision is now accepted and ready to land.Sep 19 2019, 1:05 PM
kaktus retitled this revision from truss and ktrace should decode PROT_MAX allocations to libsysdecode: decode PROT_MAX allocations.Sep 26 2019, 8:33 PM
kaktus edited the summary of this revision. (Show Details)
kaktus edited the summary of this revision. (Show Details)Sep 26 2019, 8:38 PM
This revision was automatically updated to reflect the committed changes.