From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753537AbdIEVpD (ORCPT ); Tue, 5 Sep 2017 17:45:03 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:39748 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753481AbdIEVpA (ORCPT ); Tue, 5 Sep 2017 17:45:00 -0400 Date: Tue, 05 Sep 2017 14:44:56 -0700 (PDT) Message-Id: <20170905.144456.431070706382873486.davem@davemloft.net> To: pavel@ucw.cz Cc: khalid.aziz@oracle.com, dave.hansen@linux.intel.com, corbet@lwn.net, bob.picco@oracle.com, steven.sistare@oracle.com, pasha.tatashin@oracle.com, mike.kravetz@oracle.com, mingo@kernel.org, nitin.m.gupta@oracle.com, kirill.shutemov@linux.intel.com, tom.hromatka@oracle.com, eric.saint.etienne@oracle.com, allen.pais@oracle.com, cmetcalf@mellanox.com, akpm@linux-foundation.org, geert@linux-m68k.org, tklauser@distanz.ch, atish.patra@oracle.com, vijay.ac.kumar@oracle.com, peterz@infradead.org, mhocko@suse.com, jack@suse.cz, lstoakes@gmail.com, hughd@google.com, thomas.tai@oracle.com, paul.gortmaker@windriver.com, ross.zwisler@linux.intel.com, dave.jiang@intel.com, willy@infradead.org, ying.huang@intel.com, zhongjiang@huawei.com, minchan@kernel.org, vegard.nossum@oracle.com, imbrenda@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, aarcange@redhat.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, khalid@gonehiking.org Subject: Re: [PATCH v7 9/9] sparc64: Add support for ADI (Application Data Integrity) From: David Miller In-Reply-To: <20170904162530.GA21781@amd> References: <3a687666c2e7972fb6d2379848f31006ac1dd59a.1502219353.git.khalid.aziz@oracle.com> <20170904162530.GA21781@amd> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 05 Sep 2017 14:44:58 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Machek Date: Mon, 4 Sep 2017 18:25:30 +0200 > Will gcc be able to compile code that uses these automatically? That > does not sound easy to me. Can libc automatically use this in malloc() > to prevent accessing freed data when buffers are overrun? > > Is this for benefit of JITs? Anything that can control mappings and the virtual address used to access memory can use ADI. malloc() is of course one such case. It can map memory with ADI enabled, and return buffer addresses to malloc() callers with the proper virtual address bits set to satisfy the ADI key checks. And by induction anything using malloc() for it's memory allocation gets ADI protection as well.