Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/811885/?format=api
{ "id": 811885, "url": "http://patchwork.ozlabs.org/api/patches/811885/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504910713-7094-28-git-send-email-linuxram@us.ibm.com/", "project": { "id": 2, "url": "http://patchwork.ozlabs.org/api/projects/2/?format=api", "name": "Linux PPC development", "link_name": "linuxppc-dev", "list_id": "linuxppc-dev.lists.ozlabs.org", "list_email": "linuxppc-dev@lists.ozlabs.org", "web_url": "https://github.com/linuxppc/wiki/wiki", "scm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git", "webscm_url": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/", "list_archive_url_format": "https://lore.kernel.org/linuxppc-dev/{}/", "commit_url_format": "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}" }, "msgid": "<1504910713-7094-28-git-send-email-linuxram@us.ibm.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/1504910713-7094-28-git-send-email-linuxram@us.ibm.com/", "date": "2017-09-08T22:45:07", "name": "[19/25] powerpc: implementation for arch_vma_access_permitted()", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "7ffefa2bae19ea8d0224e724824210de83839488", "submitter": { "id": 2667, "url": "http://patchwork.ozlabs.org/api/people/2667/?format=api", "name": "Ram Pai", "email": "linuxram@us.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1504910713-7094-28-git-send-email-linuxram@us.ibm.com/mbox/", "series": [ { "id": 2303, "url": "http://patchwork.ozlabs.org/api/series/2303/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=2303", "date": "2017-09-08T22:44:40", "name": "powerpc: Free up RPAGE_RSV bits", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2303/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811885/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811885/checks/", "tags": {}, "related": [], "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 3xpv0N4884z9sBW\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 9 Sep 2017 09:38: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 3xpv0N2ttGzDrX0\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 9 Sep 2017 09:38:44 +1000 (AEST)", "from mail-qt0-x243.google.com (mail-qt0-x243.google.com\n\t[IPv6:2607:f8b0:400d:c0d::243])\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 3xpss06q44zDrd1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 9 Sep 2017 08:47:16 +1000 (AEST)", "by mail-qt0-x243.google.com with SMTP id q8so2360383qtb.1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 08 Sep 2017 15:47:16 -0700 (PDT)", "from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net.\n\t[50.39.103.96]) by smtp.gmail.com with ESMTPSA id\n\tx124sm2033726qka.85.2017.09.08.15.47.13\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 15:47:14 -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=\"TjM/JcsC\"; 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=\"TjM/JcsC\"; dkim-atps=neutral", "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400d:c0d::243; helo=mail-qt0-x243.google.com;\n\tenvelope-from=ram.n.pai@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=\"TjM/JcsC\"; dkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=szSA3vc/2aGhree59A931PQDmK2SvKPQh8WK1LUr7uA=;\n\tb=TjM/JcsCvEvZ7YQdJDXzImHpfwa+TUHuHWY46v/EjEp6Noq96RYbnK8yEOB67NfK8k\n\tTA3tQ978CtjGPaAIpg8lwZU0D3SItvNJV+RZLtDSDpssI3blJepVq8IM7xCl6mVMN7UV\n\tItcxfziyzNcClnSAP9TRTowu2kQqPBz5lj2h/WYE86ubYFdeJZF6Z+wv0jIVFm/bJYbQ\n\tSyuezq8lNne2l9wXbwoFx+9BNx9c2NAgztM+a2i/otrAvLffjG5WSmTTYri7nj8zR5Nq\n\tm/6/PhQ8Y4cZrImq13tGBi3ttZBxuSYIc3e/qnRdMOoaIMI7iVt4vx9VsWjXmJ7fNXcW\n\tGffw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references;\n\tbh=szSA3vc/2aGhree59A931PQDmK2SvKPQh8WK1LUr7uA=;\n\tb=H2/5Ix0pKa8q9prq2gMq1zpi+cgtV82nZnhAHi/allrJy2VOQeiHxAXapkBcd4vs7C\n\tNgs0C1yZRvCAeOJVo7fGbh6jlHOKgDQ14jCGn6wBWrOuQ+Si933q7p+UtnbnaP/Qxt1x\n\tYGWBcjiap4amRa1yFikNbI+in2PD8zB1oT76AIg/E2JYkb3cqF9JI23Ol70ziZuM5UWB\n\tl1LKhdvRhM0MuxDq/jEvvOpeCKzRughD5QLBnY7Owq+VQ0qKichBxBzAc1RKrd4QFsD8\n\titVeqwgivuge74h04tEkCvdJr1GucI2A48G6D5SPNi2HXTRaG47VHamuEg3UD3f6ZHm/\n\t1Gfw==", "X-Gm-Message-State": "AHPjjUhtKXmgIeyXRydvvm5e2V9xsLE5npvjip5Sks6g/DPk5q9UTuL/\n\t/mKmmsRZrG+IiA==", "X-Google-Smtp-Source": "AOwi7QBnOjgaTMGiS88wkWHvyykFQdqoRNrRXxwKD1hzTuqOvQLGbTpNwazlIc3GETY94dOXf7cpaQ==", "X-Received": "by 10.200.26.176 with SMTP id x45mr6940365qtj.181.1504910835086; \n\tFri, 08 Sep 2017 15:47:15 -0700 (PDT)", "From": "Ram Pai <linuxram@us.ibm.com>", "To": "mpe@ellerman.id.au,\n\tlinuxppc-dev@lists.ozlabs.org", "Subject": "[PATCH 19/25] powerpc: implementation for\n\tarch_vma_access_permitted()", "Date": "Fri, 8 Sep 2017 15:45:07 -0700", "Message-Id": "<1504910713-7094-28-git-send-email-linuxram@us.ibm.com>", "X-Mailer": "git-send-email 1.7.1", "In-Reply-To": "<1504910713-7094-1-git-send-email-linuxram@us.ibm.com>", "References": "<1504910713-7094-1-git-send-email-linuxram@us.ibm.com>", "X-BeenThere": "linuxppc-dev@lists.ozlabs.org", "X-Mailman-Version": "2.1.23", "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": "ebiederm@xmission.com, linuxram@us.ibm.com, mhocko@kernel.org,\n\tpaulus@samba.org, aneesh.kumar@linux.vnet.ibm.com,\n\tbauerman@linux.vnet.ibm.com, 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>" }, "content": "This patch provides the implementation for\narch_vma_access_permitted(). Returns true if the\nrequested access is allowed by pkey associated with the\nvma.\n\nSigned-off-by: Ram Pai <linuxram@us.ibm.com>\n---\n arch/powerpc/include/asm/mmu_context.h | 5 +++-\n arch/powerpc/mm/pkeys.c | 43 ++++++++++++++++++++++++++++++++\n 2 files changed, 47 insertions(+), 1 deletions(-)", "diff": "diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h\nindex 04e9221..9a56355 100644\n--- a/arch/powerpc/include/asm/mmu_context.h\n+++ b/arch/powerpc/include/asm/mmu_context.h\n@@ -135,6 +135,10 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm,\n {\n }\n \n+#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS\n+bool arch_vma_access_permitted(struct vm_area_struct *vma,\n+\t\t\tbool write, bool execute, bool foreign);\n+#else /* CONFIG_PPC64_MEMORY_PROTECTION_KEYS */\n static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,\n \t\tbool write, bool execute, bool foreign)\n {\n@@ -142,7 +146,6 @@ static inline bool arch_vma_access_permitted(struct vm_area_struct *vma,\n \treturn true;\n }\n \n-#ifndef CONFIG_PPC64_MEMORY_PROTECTION_KEYS\n #define pkey_initialize()\n #define pkey_mm_init(mm)\n \ndiff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c\nindex 24589d9..21c3b42 100644\n--- a/arch/powerpc/mm/pkeys.c\n+++ b/arch/powerpc/mm/pkeys.c\n@@ -320,3 +320,46 @@ bool arch_pte_access_permitted(u64 pte, bool write, bool execute)\n \treturn pkey_access_permitted(pte_to_pkey_bits(pte),\n \t\t\twrite, execute);\n }\n+\n+/*\n+ * We only want to enforce protection keys on the current process\n+ * because we effectively have no access to AMR/IAMR for other\n+ * processes or any way to tell *which * AMR/IAMR in a threaded\n+ * process we could use.\n+ *\n+ * So do not enforce things if the VMA is not from the current\n+ * mm, or if we are in a kernel thread.\n+ */\n+static inline bool vma_is_foreign(struct vm_area_struct *vma)\n+{\n+\tif (!current->mm)\n+\t\treturn true;\n+\t/*\n+\t * if the VMA is from another process, then AMR/IAMR has no\n+\t * relevance and should not be enforced.\n+\t */\n+\tif (current->mm != vma->vm_mm)\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n+bool arch_vma_access_permitted(struct vm_area_struct *vma,\n+\t\tbool write, bool execute, bool foreign)\n+{\n+\tint pkey;\n+\n+\tif (!pkey_inited)\n+\t\treturn true;\n+\n+\t/* allow access if the VMA is not one from this process */\n+\tif (foreign || vma_is_foreign(vma))\n+\t\treturn true;\n+\n+\tpkey = vma_pkey(vma);\n+\n+\tif (!pkey)\n+\t\treturn true;\n+\n+\treturn pkey_access_permitted(pkey, write, execute);\n+}\n", "prefixes": [ "19/25" ] }