CTSRD-CHERI / cheri-c-programming

CHERI C/C++ Programming Guide
28 stars 3 forks source link

Discourage use of tags to implement logic #37

Open kwitaszczyk opened 1 year ago

kwitaszczyk commented 1 year ago

Tags could be seen as an interesting feature to implement logic that behaves differently depending on whether a pointer or an integer value was passed to a function. This triggers two issues:

  1. Relying on tags to distinguish pointers from integer values does not distinguish valid and invalid pointers, and it's simply invalid.
  2. Relying on tags makes it harder to upstream changes.

The document should make a developer aware of consequences of such decision.

bsdjhb commented 1 year ago

It also violates the principle of intentional use (one of the two underlying principles of CHERI).