โŒ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

ada: Preserve capability validity in address arithmetic

ada: Preserve capability validity in address arithmetic

On CHERI targets where System.Address is a capability, arithmetic on
addresses should avoid converting to integers and instead use the
operations defined in System.Storage_Elements to perform the arithmetic
directly on the System.Address object. This preserves the capability's
validity throughout the calculation, ensuring that the resulting capability
can be dereferenced.

gcc/ada/

	* libgnat/s-carsi8.adb: Use operations from
	System.Storage_Elements for address arithmetic.
	* libgnat/s-carun8.adb: Likewise
	* libgnat/s-casi128.adb: Likewise
	* libgnat/s-casi16.adb: Likewise
	* libgnat/s-casi32.adb: Likewise
	* libgnat/s-casi64.adb: Likewise
	* libgnat/s-caun128.adb: Likewise
	* libgnat/s-caun16.adb: Likewise
	* libgnat/s-caun32.adb: Likewise
	* libgnat/s-caun64.adb: Likewise
	* libgnat/s-geveop.adb: Likewise
  • [DBH] gcc/ada/libgnat/s-carsi8.adb
  • [DBH] gcc/ada/libgnat/s-carun8.adb
  • [DBH] gcc/ada/libgnat/s-casi128.adb
  • [DBH] gcc/ada/libgnat/s-casi16.adb
  • [DBH] gcc/ada/libgnat/s-casi32.adb
  • [DBH] gcc/ada/libgnat/s-casi64.adb
  • [DBH] gcc/ada/libgnat/s-caun128.adb
  • [DBH] gcc/ada/libgnat/s-caun16.adb
  • [DBH] gcc/ada/libgnat/s-caun32.adb
  • [DBH] gcc/ada/libgnat/s-caun64.adb
  • [DBH] gcc/ada/libgnat/s-geveop.adb

ada: Fix conversions between addresses and integers

ada: Fix conversions between addresses and integers

On CHERI targets the size of System.Address and Integer_Address
(or similar) are not the same. The operations in System.Storage_Elements
should be used to convert between integers and addresses.

gcc/ada/

	* libgnat/a-tags.adb (To_Tag): Use System.Storage_Elements for
	integer to address conversion.
	* libgnat/s-putima.adb (Put_Image_Pointer): Likewise.
  • [DBH] gcc/ada/libgnat/a-tags.adb
  • [DBH] gcc/ada/libgnat/s-putima.adb

ada: Update personality function for CHERI purecap

ada: Update personality function for CHERI purecap

This makes two changes to the GNAT personality function to reflect
differences for pure capability CHERI/Morello. The first is to use
__builtin_code_address_from_pointer to drop the LSB from Morello
code pointers when searching through call-site tables (without this
we would never find the right landing pad when unwinding).

The second change is to reflect the change in the exception table
format for pure-capability Morello where the landing pad is a capability
indirected by an offset in the call-site table.

gcc/ada/

	* raise-gcc.c (get_ip_from_context): Adapt for CHERI purecap
	(get_call_site_action_for): Adapt for CHERI purecap
  • [DBH] gcc/ada/raise-gcc.c

ada: Add CHERI variant of System.Stream_Attributes

ada: Add CHERI variant of System.Stream_Attributes

Reading and writing System.Address to a stream on CHERI targets does
not preserve the capability tag; it will always be invalid since
a valid capability cannot be created out of thin air. Reading an Address
from a stream would therefore never yield a capability that can be
dereferenced.

This patch introduces a CHERI variant of System.Stream_Attributes that
raises Program_Error when attempting to read a System.Address from a stream.

gcc/ada/

	* libgnat/s-stratt__cheri.adb: New file
  • [DBH] gcc/ada/libgnat/s-stratt__cheri.adb

ada: Define CHERI exception types

ada: Define CHERI exception types

These exception types map to the CHERI hardware exceptions that are
triggered due to misuse of capabilities.

gcc/ada/

	* libgnat/i-cheri.ads (Capability_Bound_Error)
	(Capability_Permission_Error, Capability_Sealed_Error)
	(Capability_Tag_Error): New, define CHERI exception types.
  • [DBH] gcc/ada/libgnat/i-cheri.ads
โŒ