From patchwork Wed Jun 24 15:53:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Earnshaw X-Patchwork-Id: 39786 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78721398786D; Wed, 24 Jun 2020 15:54:02 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 3B24A3851C2B for ; Wed, 24 Jun 2020 15:53:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3B24A3851C2B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rearnsha@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B7F971FB; Wed, 24 Jun 2020 08:53:56 -0700 (PDT) Received: from eagle.buzzard.freeserve.co.uk (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 452383F73C; Wed, 24 Jun 2020 08:53:56 -0700 (PDT) From: Richard Earnshaw To: libc-alpha@sourceware.org Subject: [PATCH v2 0/6] Memory tagging support Date: Wed, 24 Jun 2020 16:53:43 +0100 Message-Id: <20200624155349.12134-1-rearnsha@arm.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Earnshaw Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Changes since version 1: Regerated INSTALL cpu-features - ensure that the memtag tunable is cleared if the HW does not support MTE. Fix issues with MALLOC_CHECK_ != 0; disable the guard byte code when memory tagging is enabled - it serves no purpose since the tags provide the checking. Rework the __malloc_usable_size/musable code so that when memory tagging is disabled at run-time, but enabled in the library, we avoid wasting the word in the malloc chunk header unnecessarily. Move the round-up allocation size inside checked_request2size and do it after the out-of-bounds check; the check can now be simplified to a simple round-up to a granule boundary. Make some new function pointers static; they shouldn't be used outside the malloc module. Rebase onto 6f3331f26d2ee5d210ba768389828c391750f7a0, eliminating the need for changes to memchr.S strchr.S strchrnul.S strcmp.S strcpy.S R. ========== Richard Earnshaw (6): config: Allow memory tagging to be enabled when configuring glibc elf: Add a tunable to control use of tagged memory malloc: Basic support for memory tagging in the malloc() family linux: Add compatibility definitions to sys/prctl.h for MTE aarch64: Add sysv specific enabling code for memory tagging aarch64: Add aarch64-specific files for memory tagging support INSTALL | 14 ++ config.h.in | 3 + config.make.in | 2 + configure | 17 ++ configure.ac | 10 + elf/dl-tunables.list | 9 + malloc/arena.c | 43 +++- malloc/hooks.c | 6 + malloc/malloc.c | 186 ++++++++++++++---- malloc/malloc.h | 7 + manual/install.texi | 13 ++ manual/tunables.texi | 31 +++ sysdeps/aarch64/Makefile | 5 + sysdeps/aarch64/__mtag_address_get_tag.S | 31 +++ sysdeps/aarch64/__mtag_memset_tag.S | 46 +++++ sysdeps/aarch64/__mtag_new_tag.S | 38 ++++ sysdeps/aarch64/__mtag_tag_region.S | 44 +++++ sysdeps/aarch64/libc-mtag.h | 57 ++++++ sysdeps/generic/libc-mtag.h | 52 +++++ sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h | 1 + sysdeps/unix/sysv/linux/aarch64/bits/mman.h | 32 +++ .../unix/sysv/linux/aarch64/cpu-features.c | 28 +++ .../unix/sysv/linux/aarch64/cpu-features.h | 1 + sysdeps/unix/sysv/linux/sys/prctl.h | 18 ++ 24 files changed, 652 insertions(+), 42 deletions(-) create mode 100644 sysdeps/aarch64/__mtag_address_get_tag.S create mode 100644 sysdeps/aarch64/__mtag_memset_tag.S create mode 100644 sysdeps/aarch64/__mtag_new_tag.S create mode 100644 sysdeps/aarch64/__mtag_tag_region.S create mode 100644 sysdeps/aarch64/libc-mtag.h create mode 100644 sysdeps/generic/libc-mtag.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/mman.h