]> git.ipfire.org Git - thirdparty/glibc.git/commit
cheri: stdio-common: add support for printing CHERI capabilities
authorCarlos Eduardo Seo <carlos.seo@arm.com>
Thu, 7 Jul 2022 18:46:43 +0000 (18:46 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 22 Nov 2022 14:31:25 +0000 (14:31 +0000)
commit36d565f7e3ac9e1d73ef9921c24bbcd0cfd1ade4
tree55b0f0282183644e99c31bb7c22f1f6af40130a2
parent5e606fb79cbf9b701f50d0dde041d19ce0b423eb
cheri: stdio-common: add support for printing CHERI capabilities

This adds a new modifier %#p for printing capability information
according to the CHERI C Programming guide:

https://github.com/CTSRD-CHERI/cheri-c-programming/wiki/Displaying-Capabilities

A %#p option in printf will display:

  <address> [<permissions>,<base>-<top>] (<attr>)

   * address: Virtual address of capability displayed as a hexadecimal
     value with a 0x prefix.
   * permissions: Zero or more of the following characters:
      r: LOAD permission
      w: STORE permission
      x: EXECUTE permission
      R: LOAD_CAP permission
      W: STORE_CAP permission
      E: EXECUTIVE permission (Morello only)
   * base: Lower bound of capability displayed as a hexadecimal value
     with a 0x prefix.
   * top: Upper bound of capability plus 1 displayed as a hexadecimal
     value with a 0x prefix.
   * attr: Zero or more of the following comma-separated attributes. If
     none of the attributes are present, this field is omitted (along
     with the enclosing parentheses/brackets).
      invalid: Capability's tag is clear.
      sentry: Capability is a sealed entry.
      sealed: Capability is sealed with a type other than the sealed
              entry object type.

A %p option in printf will display the capability value (address) normally.
stdio-common/printf-parsemb.c
stdio-common/printf.h
stdio-common/vfprintf-internal.c
stdio-common/vfprintf-process-arg.c