Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-20 Thread Kees Cook
On Sun, Sep 07, 2025 at 11:25:19AM +0200, Martin Uecker wrote: > Am Donnerstag, dem 04.09.2025 um 17:24 -0700 schrieb Kees Cook: > > To support the KCFI type-id which needs to convert unique function > > prototypes into unique 32-bit values, add a subset of the Itanium C++ > > mangling ABI for C ty

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-17 Thread Kees Cook
On Tue, Sep 09, 2025 at 12:12:11AM +0200, Martin Uecker wrote: > I meant a string that is valid (and also human readable) > C representation of the type, not a mangled version. Oh! Yes, that would be very nice too. :) > If I am not mistaken, it would currently not agree between C and C. > > type

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-14 Thread Martin Uecker
Am Dienstag, dem 09.09.2025 um 09:33 -0700 schrieb Kees Cook: > > > > > One thing for sure we need to settle on is a common hash and (AIUI) > > > LLVM would like to drop the hash KCFI is currently using (KCFI is the > > > last user of it). As I mentioned elsewhere, the hash doesn't need to be >

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-09 Thread Kees Cook
On Tue, Sep 09, 2025 at 08:01:59AM +0200, Martin Uecker wrote: > Other things this approach may break are using an enum on the one > side and the integer type which it should be compatible to on the > other. This should be a KCFI mismatch: both sides need to use the enum. In fact, while working on

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-09 Thread Martin Uecker
Am Montag, dem 08.09.2025 um 20:05 -0700 schrieb Kees Cook: > On Mon, Sep 08, 2025 at 04:36:57PM -0700, Andrew Pinski wrote: > > On Mon, Sep 8, 2025 at 4:24 PM Kees Cook wrote: > > > > > > On Tue, Sep 09, 2025 at 12:13:19AM +0200, Martin Uecker wrote: > > > > Sorry, example should have been this:

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Andrew Pinski
On Mon, Sep 8, 2025 at 4:24 PM Kees Cook wrote: > > On Tue, Sep 09, 2025 at 12:13:19AM +0200, Martin Uecker wrote: > > Sorry, example should have been this: > > > > typedef int arr_t[]; > > typedef int arr3_t[3]; > > > > void f(arr3_t*); > > > > void g(void (*fp)(arr_t*)) { > > > > int a[3];

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Kees Cook
On Mon, Sep 08, 2025 at 04:36:57PM -0700, Andrew Pinski wrote: > On Mon, Sep 8, 2025 at 4:24 PM Kees Cook wrote: > > > > On Tue, Sep 09, 2025 at 12:13:19AM +0200, Martin Uecker wrote: > > > Sorry, example should have been this: > > > > > > typedef int arr_t[]; > > > typedef int arr3_t[3]; > > > >

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Andrew Pinski
On Mon, Sep 8, 2025 at 4:36 PM Andrew Pinski wrote: > > On Mon, Sep 8, 2025 at 4:24 PM Kees Cook wrote: > > > > On Tue, Sep 09, 2025 at 12:13:19AM +0200, Martin Uecker wrote: > > > Sorry, example should have been this: > > > > > > typedef int arr_t[]; > > > typedef int arr3_t[3]; > > > > > > void

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Kees Cook
On Tue, Sep 09, 2025 at 12:13:19AM +0200, Martin Uecker wrote: > Sorry, example should have been this: > > typedef int arr_t[]; > typedef int arr3_t[3]; > > void f(arr3_t*); > > void g(void (*fp)(arr_t*)) { > > int a[3]; > (*fp)(&a); // this call would fail? > } > > int h()

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Martin Uecker
Am Dienstag, dem 09.09.2025 um 00:12 +0200 schrieb Martin Uecker: > Am Montag, dem 08.09.2025 um 14:51 -0700 schrieb Kees Cook: > > On Sun, Sep 07, 2025 at 11:25:19AM +0200, Martin Uecker wrote: > > > Am Donnerstag, dem 04.09.2025 um 17:24 -0700 schrieb Kees Cook: > > > > To support the KCFI type-i

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-08 Thread Martin Uecker
Am Montag, dem 08.09.2025 um 14:51 -0700 schrieb Kees Cook: > On Sun, Sep 07, 2025 at 11:25:19AM +0200, Martin Uecker wrote: > > Am Donnerstag, dem 04.09.2025 um 17:24 -0700 schrieb Kees Cook: > > > To support the KCFI type-id which needs to convert unique function > > > prototypes into unique 32-b

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-07 Thread Martin Uecker
Am Donnerstag, dem 04.09.2025 um 17:24 -0700 schrieb Kees Cook: > To support the KCFI type-id which needs to convert unique function > prototypes into unique 32-bit values, add a subset of the Itanium C++ > mangling ABI for C typeinfo of function prototypes, but then do > hashing, which is needed b

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-04 Thread Kees Cook
On Thu, Sep 04, 2025 at 05:50:45PM -0700, Andrew Pinski wrote: > On Thu, Sep 4, 2025 at 5:27 PM Kees Cook wrote: > > + > > + /* Unknown builtin type - this should never happen in a well-formed C > > program. */ > > + debug_tree (type); > > + internal_error ("mangle: Unknown builtin type in fu

[PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-04 Thread Kees Cook
To support the KCFI type-id which needs to convert unique function prototypes into unique 32-bit values, add a subset of the Itanium C++ mangling ABI for C typeinfo of function prototypes, but then do hashing, which is needed by KCFI to get a 32-bit hash value for a given function prototype. Option

Re: [PATCH v2 1/7] mangle: Introduce C typeinfo mangling API

2025-09-04 Thread Andrew Pinski
On Thu, Sep 4, 2025 at 5:27 PM Kees Cook wrote: > > To support the KCFI type-id which needs to convert unique function > prototypes into unique 32-bit values, add a subset of the Itanium C++ > mangling ABI for C typeinfo of function prototypes, but then do > hashing, which is needed by KCFI to get