]> 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>
Fri, 5 Aug 2022 18:45:19 +0000 (19:45 +0100)
commit3be82efc58a7089039c4e8ae442c8baa78a99d1b
treecb8ad6e80ccac539a764a28dfa16b168313a1932
parentcec148df6f86bd4cd6c2a4e95bca37840bc90d36
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