From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dog.birch.relay.mailchannels.net (dog.birch.relay.mailchannels.net [23.83.209.48]) by sourceware.org (Postfix) with ESMTPS id DDFFD388A423 for ; Wed, 25 Nov 2020 15:08:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDFFD388A423 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 90C1E541BEA; Wed, 25 Nov 2020 15:08:28 +0000 (UTC) Received: from pdx1-sub0-mail-a90.g.dreamhost.com (100-96-8-96.trex.outbound.svc.cluster.local [100.96.8.96]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id BE67954117D; Wed, 25 Nov 2020 15:08:26 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a90.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.10); Wed, 25 Nov 2020 15:08:28 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Rock-White: 29c8da771169c80d_1606316908380_2585218491 X-MC-Loop-Signature: 1606316908379:566926504 X-MC-Ingress-Time: 1606316908379 Received: from pdx1-sub0-mail-a90.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a90.g.dreamhost.com (Postfix) with ESMTP id 817BB7E602; Wed, 25 Nov 2020 07:08:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=zsxDNF X7nuDhKXQ8w8u3Ynrjjwg=; b=mAkt5sc9K8G/OPf5wvXA8AotNHYBvmNENDHUNr CSu3xRKBvZ66dtQ6o+WVGpXNPAOWIwxx5dK78SAy6dnasRW+kFTfqVuwCDFD6S0Y hYTh+Ge6VhgASCD9GAwCrbN7+xwa88VNx72gCOgBAgPQUltCKxqFGIMxbGk2+qp2 KcsD4= Received: from [192.168.1.111] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a90.g.dreamhost.com (Postfix) with ESMTPSA id 4E97C85964; Wed, 25 Nov 2020 07:08:24 -0800 (PST) Subject: Re: [PATCH v3 2/8] elf: Add a tunable to control use of tagged memory To: Richard Earnshaw , libc-alpha@sourceware.org References: <20201123154236.25809-1-rearnsha@arm.com> <20201123154236.25809-3-rearnsha@arm.com> X-DH-BACKEND: pdx1-sub0-mail-a90 From: Siddhesh Poyarekar Message-ID: <36a6759b-3a91-372b-8a9c-1841d6923d7f@gotplt.org> Date: Wed, 25 Nov 2020 20:38:19 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201123154236.25809-3-rearnsha@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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: , X-List-Received-Date: Wed, 25 Nov 2020 15:08:33 -0000 On 11/23/20 9:12 PM, Richard Earnshaw via Libc-alpha wrote: > > Add a new glibc tunable: mtag.enable, bound to the environment variable > _MTAG_ENABLE. This is a decimal constant in the range 0-255 but used > as a bit-field. > > Bit 0 enables use of tagged memory in the malloc family of functions. > Bit 1 enables precise faulting of tag failure on platforms where this > can be controlled. > Other bits are currently unused, but if set will cause memory tag > checking for the current process to be enabled in the kernel. > --- > elf/dl-tunables.list | 9 +++++++++ > manual/tunables.texi | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 40 insertions(+) > > diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list > index e1d8225128..652cadc334 100644 > --- a/elf/dl-tunables.list > +++ b/elf/dl-tunables.list > @@ -141,4 +141,13 @@ glibc { > default: 512 > } > } > + > +memtag { > + enable { > + type: INT_32 > + minval: 0 > + maxval: 255 > + env_alias: _MTAG_ENABLE > + } > + } > } > diff --git a/manual/tunables.texi b/manual/tunables.texi > index d72d7a5ec0..6ab432a73f 100644 > --- a/manual/tunables.texi > +++ b/manual/tunables.texi > @@ -36,6 +36,8 @@ their own namespace. > * POSIX Thread Tunables:: Tunables in the POSIX thread subsystem > * Hardware Capability Tunables:: Tunables that modify the hardware > capabilities seen by @theglibc{} > +* Memory Tagging Tunables:: Tunables that control the use of hardware > + memory tagging > @end menu > > @node Tunable names > @@ -484,3 +486,32 @@ instead. > > This tunable is specific to i386 and x86-64. > @end deftp > + > +@node Memory Tagging Tunables > +@section Memory Tagging Tunables > +@cindex memory tagging tunables > + > +@deftp {Tunable namespace} glibc.memtag > +If the hardware supports memory tagging, these tunables can be used to > +control the way @theglibc{} uses this feature. Currently, only AArch64 > +supports this feature. > +@end deftp > + > +@deftp Tunable glibc.memtag.enable > +This tunable takes a value between 0 and 255 and acts as a bitmask > +that enables various capabilities. > + > +Bit 0 (the least significant bit) causes the malloc subsystem to allocate > +tagged memory, with each allocation being assigned a random tag. > + > +Bit 1 enables precise faulting mode for tag violations on systems that > +support deferred tag violation reporting. This may cause programs > +to run more slowly. > + > +Other bits are currently reserved. > + > +@Theglibc{} startup code will automatically enable memory tagging > +support in the kernel if this tunable has any non-zero value. > + > +The default value is @samp{0}, which disables all memory tagging. > +@end deftp This is OK. Reviewed-by: Siddhesh Poyarekar