Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZmiFuLEEUEmaxYaG@stefan-starfish>
Date: Tue, 11 Jun 2024 20:13:28 +0300
From: Stefan Jumarea <stefanjumarea02@...il.com>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: [PATCH] mallocng: Add MTE support for Aarch64

On Tue, Jun 11, 2024 at 12:42:22PM -0400, Rich Felker wrote:
> On Tue, Jun 11, 2024 at 06:37:11PM +0300, Stefan Jumarea wrote:
> > On Tue, Jun 11, 2024 at 10:46:25AM -0400, Rich Felker wrote:
> > > On Tue, Jun 11, 2024 at 04:09:22PM +0200, Szabolcs Nagy wrote:
> > > > * Stefan Jumarea <stefanjumarea02@...il.com> [2024-06-10 15:36:25 +0300]:
> > 
> > This was done since MTE has a 16 byte granule for tagging.
> > Makes more sense to do this where the class is selected, yes. I'm not
> > sure about making it work for smaller allocations, I'll try to think of
> > a way to cover that.
> 
> Is there any way to perform a "load, ignoring tag mismatch" operation?
> 

Yes, there is the `ldg` instruction that can load the tag of a given
address, so we can use that.

> > > > iirc i changed IB when i tried out mte with mallocng.
> > > > 
> > > > i would avoid excessive ifdefs in the code, e.g. by using
> > > > 'p = untag(p);' and define untag appropriately in a header.
> > > > (this might as well do the tag checks when mte is enabled,
> > 
> > Agree, will do.
> > 
> > > 
> > > Yes.
> > > 
> > > > but might need special-casing 0 sized allocations.)
> > > 
> > > Zero-sized allocations could maybe be implemented as a wrong tag? But
> > > then we'd need a way for free to let them pass untrapped.
> > > 
> > 
> > Hm, a wrong tag seems like a nice idea, but I don't see an easy way to
> > let the free pass untrapped.
> 
> You'd need to be able to peek at the metadata and see that it's
> zero-sized.
> 
> > Can we do a special case and return NULL on
> > zero-size allocations?
> 
> Nope, that's not an option. While the standard allows it, it's awful
> behavior and fundamentally inconsistent with how realloc works (null
> return is ambiguous between failure to realloc, in which case old
> object would still exit, and successful realloc to size zero, in which
> case old object does not exist).

I see, makes sense.

Stefan

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.