public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/arm/morello/main] cheri: malloc: Disable pointer protection
Date: Wed, 26 Oct 2022 15:18:21 +0000 (GMT)	[thread overview]
Message-ID: <20221026151822.74B183865C2C@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5440678ee1801698f97c52e227aaeff7a84e4516

commit 5440678ee1801698f97c52e227aaeff7a84e4516
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Wed Jul 7 14:21:40 2021 +0100

    cheri: malloc: Disable pointer protection
    
    Such arithmetic invalidates capabilities so this security measure does
    not work for CHERI.
    
    Note: the architecture makes it hard to corrupt pointers in malloc
    metadata, but not impossible: current allocation bounds include the
    metadata and capabilities are not revoked after free. These issues can
    be fixed by a capability aware malloc.

Diff:
---
 malloc/malloc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/malloc/malloc.c b/malloc/malloc.c
index bd3c76ed31..062ca0dc0a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -341,8 +341,12 @@ Fatal glibc error: malloc assertion failure in %s: %s\n",
    It assumes a minimum page size of 4096 bytes (12 bits).  Systems with
    larger pages provide less entropy, although the pointer mangling
    still works.  */
+#ifdef __CHERI_PURE_CAPABILITY__
+#define PROTECT_PTR(pos, ptr) (ptr)
+#else
 #define PROTECT_PTR(pos, ptr) \
   ((__typeof (ptr)) ((((size_t) pos) >> 12) ^ ((size_t) ptr)))
+#endif
 #define REVEAL_PTR(ptr)  PROTECT_PTR (&ptr, ptr)
 
 /*

             reply	other threads:[~2022-10-26 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26 15:18 Szabolcs Nagy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-23 14:46 Szabolcs Nagy
2022-10-27 13:56 Szabolcs Nagy
2022-08-05 19:35 Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221026151822.74B183865C2C@sourceware.org \
    --to=nsz@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).