Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e3e62b2f-34a3-2bb1-1c06-d28a865bf84e@mirbsd.de>
Date: Tue, 21 Apr 2026 18:32:35 +0200 (CEST)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
cc: Florian Schmaus <florian.schmaus@...asip.com>
Subject: Re: [PATCH] qsort: align 'tmp' buffer to preserve CHERI
 capabilities

On Tue, 21 Apr 2026, Rich Felker wrote:
>On Tue, Apr 21, 2026 at 09:57:35AM +0200, Florian Schmaus wrote:

>> -	unsigned char tmp[256];
>> +	void* tmp[16 * sizeof(void*)];

This is… not correct. I’ll leave figuring out the correct size
to the musl people, though.

>I'm not 100% sure there's not a way to argue this is valid, but on the
>surface it looks like this is introducing UB via effective type rules.
>If the goal is just alignment, a union preserving the char array and
>just adding a sufficiently aligned member would achieve that without
>concern over the type.

There’s alignment, which is needed everywhere, but also preserving
of the special bits, all but one of which are embedded in the fat
pointers but get stripped out by some actions. See also the CHERI
programming guide (you can use #ifdefs, if needed):
https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-947.pdf

AFAICT, any pointer to data (not function) can be cast to void *
and back without introducing UB as long as the cast back is to the
proper type and the void * pointer is not otherwise touched.

bye,
//mirabilos
-- 
(gnutls can also be used, but if you are compiling lynx for your own use,
there is no reason to consider using that package)
	-- Thomas E. Dickey on the Lynx mailing list, about OpenSSL

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.