[{"id":1773285,"web_url":"http://patchwork.ozlabs.org/comment/1773285/","msgid":"<20170922160019.0d6d1eae@firefly.ozlabs.ibm.com>","date":"2017-09-22T06:00:19","subject":"Re: [PATCH 4/6] mm/mprotect, powerpc/mm/pkeys, x86/mm/pkeys: Add\n\tsysfs interface","submitter":{"id":9347,"url":"http://patchwork.ozlabs.org/api/people/9347/","name":"Balbir Singh","email":"bsingharora@gmail.com"},"content":"On Fri, 15 Sep 2017 18:21:08 -0700\nRam Pai <linuxram@us.ibm.com> wrote:\n\n> From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>\n> \n> Expose useful information for programs using memory protection keys.\n> Provide implementation for powerpc and x86.\n> \n> On a powerpc system with pkeys support, here is what is shown:\n> \n> $ head /sys/kernel/mm/protection_keys/*\n> ==> /sys/kernel/mm/protection_keys/disable_access_supported <==  \n> true\n> \n> ==> /sys/kernel/mm/protection_keys/disable_execute_supported <==  \n> true\n> \n> ==> /sys/kernel/mm/protection_keys/disable_write_supported <==  \n> true\n> \n> ==> /sys/kernel/mm/protection_keys/total_keys <==  \n> 32\n> \n> ==> /sys/kernel/mm/protection_keys/usable_keys <==  \n> 29\n> \n> And on an x86 without pkeys support:\n> \n> $ head /sys/kernel/mm/protection_keys/*\n> ==> /sys/kernel/mm/protection_keys/disable_access_supported <==  \n> false\n> \n> ==> /sys/kernel/mm/protection_keys/disable_execute_supported <==  \n> false\n> \n> ==> /sys/kernel/mm/protection_keys/disable_write_supported <==  \n> false\n> \n> ==> /sys/kernel/mm/protection_keys/total_keys <==  \n> 1\n> \n> ==> /sys/kernel/mm/protection_keys/usable_keys <==  \n> 0\n> \n> Signed-off-by: Ram Pai <linuxram@us.ibm.com>\n> Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>\n> ---\n\nJust curious, how do you see this being used? For debugging\nor will applications parse these properties and use them?\nIt's hard for an application to partition its address space\namong keys at runtime, would you agree?\n\nBalbir Singh.","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xz2vL3mtNz9sBd\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 16:02:38 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xz2vL2gMXzDsN4\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 16:02:38 +1000 (AEST)","from mail-pg0-x242.google.com (mail-pg0-x242.google.com\n\t[IPv6:2607:f8b0:400e:c05::242])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xz2s2615nzDsM5\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 22 Sep 2017 16:00:38 +1000 (AEST)","by mail-pg0-x242.google.com with SMTP id m30so95306pgn.5\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tThu, 21 Sep 2017 23:00:38 -0700 (PDT)","from firefly.ozlabs.ibm.com ([122.99.82.10])\n\tby smtp.gmail.com with ESMTPSA id\n\tn29sm4865985pgf.22.2017.09.21.23.00.30\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 21 Sep 2017 23:00:36 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"FXe6nyxi\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"FXe6nyxi\"; dkim-atps=neutral","ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c05::242; helo=mail-pg0-x242.google.com;\n\tenvelope-from=bsingharora@gmail.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"FXe6nyxi\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=hSHa6LCsyyL9efkf0S94kaTzQfE21OYLnFOMYAYDUPQ=;\n\tb=FXe6nyxiiNF1etltmYiLMKNo6yFPwK5vDzMRQ7EfG307qecAUtENiuOaFDNPTU4oz1\n\tONxU75rp6EbCT7OAM0j6hMyqEzTeQVkOBuvv1ORdO6qhRTqrfB5w+b/vEirpDiaVayNT\n\tzn+3D45A8EE18HZn1FfdUj3Rwh8TPI9m/GqmN5Uj6rP7Znr+yvEYialVirQPHkkuVaXc\n\t+2x3kSrVaOQhz5amK58A5gXScBqoKkdnyfPob/QdxikAtVBar16vpInDuDCf96R4P3Kf\n\tUIC3RuP/6pVX++hMeq9Hyj+IKY0+yiLAJgqNba7y6qTCM9+wY8f+RW8eBbuyLYqlS5Py\n\tgmpw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=hSHa6LCsyyL9efkf0S94kaTzQfE21OYLnFOMYAYDUPQ=;\n\tb=nQ+lAtVppOM73oaDB/GU6Q0Zw5OIJggQJN+fwHcZ5jvbUT7PGjLWqt7GNIcg/Llahq\n\tXYVq/B+eAFjDzUJAvH4f/y8IkJRWqzlynXmY6eWR8piWkwCyWiG2raAwQSm64EqqeSn3\n\tPpawl1s8sL24LDmNfiKsl3LeKWbJ47GXijBgU6ShrOpVVftpHgxrj5Yxq/F46lr+nlnq\n\taQFiNyBXGfdbpjRf9NgdFB/NE6wXYfaM9YwITOWzNFHPhe31dfhc3NfZ1B6MU+pXrd7t\n\tEDWFGM4nWxugeRyHFD3axPUpTUaJi2WS+UOtAXeV99Jz2B8SACQjFF+Ink8l7swkiDNT\n\tw/fw==","X-Gm-Message-State":"AHPjjUiZj/KRrscVvZC0aTOgQkSARsO0AL6ALBSEKDZ3Ahz66v7XtNI2\n\tqWLk+5IVVTwdKXWviyiZOLU=","X-Google-Smtp-Source":"AOwi7QBC5g1Ms+UpMffvV7AUWtkbjVJTyyPRXto4Ajsz74fPMIL4vUW5Vxt0qgY+4c0aXcGWzOAoBg==","X-Received":"by 10.84.232.72 with SMTP id f8mr7888608pln.269.1506060036588;\n\tThu, 21 Sep 2017 23:00:36 -0700 (PDT)","Date":"Fri, 22 Sep 2017 16:00:19 +1000","From":"Balbir Singh <bsingharora@gmail.com>","To":"Ram Pai <linuxram@us.ibm.com>","Subject":"Re: [PATCH 4/6] mm/mprotect, powerpc/mm/pkeys, x86/mm/pkeys: Add\n\tsysfs interface","Message-ID":"<20170922160019.0d6d1eae@firefly.ozlabs.ibm.com>","In-Reply-To":"<1505524870-4783-5-git-send-email-linuxram@us.ibm.com>","References":"<1505524870-4783-1-git-send-email-linuxram@us.ibm.com>\n\t<1505524870-4783-5-git-send-email-linuxram@us.ibm.com>","X-Mailer":"Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu)","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, corbet@lwn.net, ebiederm@xmission.com,\n\tarnd@arndb.de, linux-doc@vger.kernel.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, mhocko@kernel.org, linux-mm@kvack.org, \n\tmingo@redhat.com, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, \n\tbauerman@linux.vnet.ibm.com, akpm@linux-foundation.org,\n\tlinuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}},{"id":1773761,"web_url":"http://patchwork.ozlabs.org/comment/1773761/","msgid":"<20170922164752.GQ5698@ram.oc3035372033.ibm.com>","date":"2017-09-22T16:47:52","subject":"Re: [PATCH 4/6] mm/mprotect, powerpc/mm/pkeys, x86/mm/pkeys: Add\n\tsysfs interface","submitter":{"id":2667,"url":"http://patchwork.ozlabs.org/api/people/2667/","name":"Ram Pai","email":"linuxram@us.ibm.com"},"content":"On Fri, Sep 22, 2017 at 04:00:19PM +1000, Balbir Singh wrote:\n> On Fri, 15 Sep 2017 18:21:08 -0700\n> Ram Pai <linuxram@us.ibm.com> wrote:\n> \n> > From: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>\n> > \n> > Expose useful information for programs using memory protection keys.\n> > Provide implementation for powerpc and x86.\n> > \n> > On a powerpc system with pkeys support, here is what is shown:\n> > \n> > $ head /sys/kernel/mm/protection_keys/*\n> > ==> /sys/kernel/mm/protection_keys/disable_access_supported <==  \n> > true\n> > \n> > ==> /sys/kernel/mm/protection_keys/disable_execute_supported <==  \n> > true\n> > \n> > ==> /sys/kernel/mm/protection_keys/disable_write_supported <==  \n> > true\n> > \n> > ==> /sys/kernel/mm/protection_keys/total_keys <==  \n> > 32\n> > \n> > ==> /sys/kernel/mm/protection_keys/usable_keys <==  \n> > 29\n> > \n> > And on an x86 without pkeys support:\n> > \n> > $ head /sys/kernel/mm/protection_keys/*\n> > ==> /sys/kernel/mm/protection_keys/disable_access_supported <==  \n> > false\n> > \n> > ==> /sys/kernel/mm/protection_keys/disable_execute_supported <==  \n> > false\n> > \n> > ==> /sys/kernel/mm/protection_keys/disable_write_supported <==  \n> > false\n> > \n> > ==> /sys/kernel/mm/protection_keys/total_keys <==  \n> > 1\n> > \n> > ==> /sys/kernel/mm/protection_keys/usable_keys <==  \n> > 0\n> > \n> > Signed-off-by: Ram Pai <linuxram@us.ibm.com>\n> > Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>\n> > ---\n> \n> Just curious, how do you see this being used? \n> For debugging or will applications parse these properties and use them?\n\nIts upto the application to determine the best way to fully exploit all\nthe keys. But that cannot happen if the application has no easy way to\ndetermine the number of available keys.\n\n\n> It's hard for an application to partition its address space\n> among keys at runtime, would you agree?\n\nWhy would it be hard? Because the application may not know; in advance,\nthe range of its address space?  Well that is true.  But that may not be\nthe best strategy. It should not be based on how large its address space\nrange is, rather it should be based on how many unique access-domains it\nwill need. It can associate a key with each domain and it can associate\naddress-ranges to the appropriate domains. The more the number\nof keys the more the number of access-domains and finer the control.\n\n> \n> Balbir Singh.","headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xzKG02B2Yz9s7h\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 02:49:44 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xzKG0191XzDrJL\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 02:49:44 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xzKD84mjlzDqjC\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 23 Sep 2017 02:48:08 +1000 (AEST)","from pps.filterd (m0098394.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8MGi0Lj091933\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 12:48:04 -0400","from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2d56148v26-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 12:48:04 -0400","from localhost\n\tby e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from <linuxram@us.ibm.com>;\n\tFri, 22 Sep 2017 10:48:03 -0600","from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15)\n\tby e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tFri, 22 Sep 2017 10:47:58 -0600","from b03ledav003.gho.boulder.ibm.com\n\t(b03ledav003.gho.boulder.ibm.com [9.17.130.234])\n\tby b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8MGlwgl4784606; Fri, 22 Sep 2017 09:47:58 -0700","from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 144C46A03B;\n\tFri, 22 Sep 2017 10:47:58 -0600 (MDT)","from ram.oc3035372033.ibm.com (unknown [9.85.187.219])\n\tby b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTPS id\n\t9B0BB6A03C; Fri, 22 Sep 2017 10:47:54 -0600 (MDT)"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=us.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=linuxram@us.ibm.com; receiver=<UNKNOWN>)","Date":"Fri, 22 Sep 2017 09:47:52 -0700","From":"Ram Pai <linuxram@us.ibm.com>","To":"Balbir Singh <bsingharora@gmail.com>","Subject":"Re: [PATCH 4/6] mm/mprotect, powerpc/mm/pkeys, x86/mm/pkeys: Add\n\tsysfs interface","References":"<1505524870-4783-1-git-send-email-linuxram@us.ibm.com>\n\t<1505524870-4783-5-git-send-email-linuxram@us.ibm.com>\n\t<20170922160019.0d6d1eae@firefly.ozlabs.ibm.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170922160019.0d6d1eae@firefly.ozlabs.ibm.com>","User-Agent":"Mutt/1.5.20 (2009-12-10)","X-TM-AS-GCONF":"00","x-cbid":"17092216-0020-0000-0000-00000CBFA80C","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007778; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000231; SDB=6.00920790; UDB=6.00462713;\n\tIPR=6.00701011; \n\tBA=6.00005601; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017249;\n\tXFM=3.00000015; UTC=2017-09-22 16:48:03","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17092216-0021-0000-0000-00005E3C5DBD","Message-Id":"<20170922164752.GQ5698@ram.oc3035372033.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-22_06:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=0\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709220236","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.24","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Reply-To":"Ram Pai <linuxram@us.ibm.com>","Cc":"linux-arch@vger.kernel.org, corbet@lwn.net, ebiederm@xmission.com,\n\tarnd@arndb.de, linux-doc@vger.kernel.org, x86@kernel.org,\n\tdave.hansen@intel.com, linux-kernel@vger.kernel.org, mhocko@kernel.org,\n\tlinux-mm@kvack.org, mingo@redhat.com, paulus@samba.org,\n\taneesh.kumar@linux.vnet.ibm.com, bauerman@linux.vnet.ibm.com,\n\takpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org,\n\tkhandual@linux.vnet.ibm.com","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"}}]