Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814461/?format=api
{ "id": 814461, "url": "http://patchwork.ozlabs.org/api/patches/814461/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170916035347.19705-4-sergey.senozhatsky@gmail.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": "<20170916035347.19705-4-sergey.senozhatsky@gmail.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170916035347.19705-4-sergey.senozhatsky@gmail.com/", "date": "2017-09-16T03:53:45", "name": "[3/5] powerpc64: Add .opd based function descriptor dereference", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "d8932c7a222fca8509f2865d23185f2b212612fd", "submitter": { "id": 3905, "url": "http://patchwork.ozlabs.org/api/people/3905/?format=api", "name": "Sergey Senozhatsky", "email": "sergey.senozhatsky@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170916035347.19705-4-sergey.senozhatsky@gmail.com/mbox/", "series": [ { "id": 3413, "url": "http://patchwork.ozlabs.org/api/series/3413/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=3413", "date": "2017-09-16T03:53:42", "name": "printk/ia64/ppc64/parisc64: let's deprecate %pF/%pf printk specifiers", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/3413/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/814461/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814461/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 3xvJbT3CG8z9t16\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 14:05:57 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xvJbT23srzDrnj\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 14:05:57 +1000 (AEST)", "from mail-pf0-x244.google.com (mail-pf0-x244.google.com\n\t[IPv6:2607:f8b0:400e:c00::244])\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 3xvJRS1NklzDrnY\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 16 Sep 2017 13:59:00 +1000 (AEST)", "by mail-pf0-x244.google.com with SMTP id i23so2069426pfi.2\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 15 Sep 2017 20:59:00 -0700 (PDT)", "from localhost.localdomain ([121.137.63.184])\n\tby smtp.gmail.com with ESMTPSA id\n\t76sm4448230pfp.158.2017.09.15.20.58.53\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 15 Sep 2017 20:58:57 -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=\"n79MRlF2\"; 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=\"n79MRlF2\"; dkim-atps=neutral", "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gmail.com\n\t(client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com;\n\tenvelope-from=sergey.senozhatsky@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=\"n79MRlF2\"; dkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=KYXU6Z1rehKcw0LU74adwCML4qq4/Y5wszCe6R2duPs=;\n\tb=n79MRlF2JtUgaE8k+s4aCoQUdpFfI/c1g79hYpWqgt00QG0zr4WLO80sOByJPmbwYN\n\tKrxcde6niBj9JtrNy5v9Gx8sqNMcQ3eNPDtUxb6yj97f7koH/jllcVEvQD7Df+YgOE30\n\t3H+rz1U2jw5Eo5GI7lP8Tjt6AaOEkTktvtb/MohkEaBRGqwoVGbbs17DRqruD9iDa61f\n\tbKP7fD4wQD5t0gaoTQqyTFQsUMqRhIetaqsDfEmWHkW3yV0GdENhfQBXxKvDr9ni4i+7\n\tOyY2N6lNQc5b1+r4KXZ1YTUMHhpFwWOhtg+fecuIR/K1DDTOUK+iWYcO9dwjpG0fS7IQ\n\t5uGw==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=KYXU6Z1rehKcw0LU74adwCML4qq4/Y5wszCe6R2duPs=;\n\tb=Y9l4SlbCtc5PTEmR6+Cf5LD3Urbqwa1FO0u2v99rknJPyHrylio17Ge7ecNjpKxYzL\n\tI1+W47/ujieMxfcO74W9Im6+oBQNsidQgSB/LKeq7LTboVsriXv+mJG2XSKtkP7pTN49\n\tue0MFBhWhLHB3uJCD61cImNArP0OnPUU+KHKUMSYZnK9KPnJonoKJZoQewumQgOt8Rqh\n\tVqNy/gS8XB62v9cIREoi9RQEYV6/dXkTzncTftN7EiigPLaikDXT4M/VIAWSL64g9FZQ\n\tCTBiyF38P0qgSouQghVQkyyhy9x+eYss9vKpP0yxhufLGNIE8jbrpyqCcI8XgWBj0jXl\n\tG6BA==", "X-Gm-Message-State": "AHPjjUibniwA85QCNdLhLHSvaTaCrUxvzNk4D5Eh3cYjLaZok/it9bCl\n\tXSfXUjdJm5IPng==", "X-Google-Smtp-Source": "AOwi7QB6S+1oUsVca4OFvW6fapm9NwjRHGXpnapfYqOTzsmAZ/kDoXq7rQV8BPu1IEwaieiW352AsQ==", "X-Received": "by 10.159.194.201 with SMTP id u9mr9387881plz.142.1505534338124; \n\tFri, 15 Sep 2017 20:58:58 -0700 (PDT)", "From": "Sergey Senozhatsky <sergey.senozhatsky@gmail.com>", "To": "Tony Luck <tony.luck@intel.com>, Fenghua Yu <fenghua.yu@intel.com>,\n\tBenjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tPaul Mackerras <paulus@samba.org>,\n\tMichael Ellerman <mpe@ellerman.id.au>, \n\t\"James E . J . Bottomley\" <jejb@parisc-linux.org>,\n\tHelge Deller <deller@gmx.de>", "Subject": "[PATCH 3/5] powerpc64: Add .opd based function descriptor\n\tdereference", "Date": "Sat, 16 Sep 2017 12:53:45 +0900", "Message-Id": "<20170916035347.19705-4-sergey.senozhatsky@gmail.com>", "X-Mailer": "git-send-email 2.14.1", "In-Reply-To": "<20170916035347.19705-1-sergey.senozhatsky@gmail.com>", "References": "<20170916035347.19705-1-sergey.senozhatsky@gmail.com>", "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": "Petr Mladek <pmladek@suse.com>, linux-ia64@vger.kernel.org,\n\tlinux-parisc@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,\n\tSteven Rostedt <rostedt@goodmis.org>, linux-kernel@vger.kernel.org,\n\tSergey Senozhatsky <sergey.senozhatsky@gmail.com>,\n\tJessica Yu <jeyu@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, \n\tlinuxppc-dev@lists.ozlabs.org", "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": "We are moving towards separate kernel and module function descriptor\ndereference callbacks. This patch enables it for powerpc64.\n\nFor pointers that belong to the kernel\n- Added __start_opd and __end_opd pointers, to track the kernel\n .opd section address range;\n\n- Added dereference_kernel_function_descriptor(). Now we\n will dereference only function pointers that are within\n [__start_opd, __end_opd];\n\nFor pointers that belong to a module\n- Added dereference_module_function_descriptor() to handle module\n function descriptor dereference. Now we will dereference only\n pointers that are within [module->opd.start, module->opd.end].\n\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\n---\n arch/powerpc/include/asm/module.h | 3 +++\n arch/powerpc/include/asm/sections.h | 13 +++++++++++++\n arch/powerpc/kernel/module_64.c | 16 ++++++++++++++++\n arch/powerpc/kernel/vmlinux.lds.S | 2 ++\n 4 files changed, 34 insertions(+)", "diff": "diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h\nindex 6c0132c7212f..7e28442827f1 100644\n--- a/arch/powerpc/include/asm/module.h\n+++ b/arch/powerpc/include/asm/module.h\n@@ -45,6 +45,9 @@ struct mod_arch_specific {\n \tunsigned long tramp;\n #endif\n \n+\t/* For module function descriptor dereference */\n+\tunsigned long start_opd;\n+\tunsigned long end_opd;\n #else /* powerpc64 */\n \t/* Indices of PLT sections within module. */\n \tunsigned int core_plt_section;\ndiff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h\nindex 7902d6358854..7cc4db86952b 100644\n--- a/arch/powerpc/include/asm/sections.h\n+++ b/arch/powerpc/include/asm/sections.h\n@@ -16,6 +16,9 @@ extern char __end_interrupts[];\n extern char __prom_init_toc_start[];\n extern char __prom_init_toc_end[];\n \n+extern char __start_opd[];\n+extern char __end_opd[];\n+\n static inline int in_kernel_text(unsigned long addr)\n {\n \tif (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)\n@@ -66,6 +69,8 @@ static inline int overlaps_kvm_tmp(unsigned long start, unsigned long end)\n \n #ifdef PPC64_ELF_ABI_v1\n #undef dereference_function_descriptor\n+#undef dereference_kernel_function_descriptor\n+\n static inline void *dereference_function_descriptor(void *ptr)\n {\n \tstruct ppc64_opd_entry *desc = ptr;\n@@ -75,6 +80,14 @@ static inline void *dereference_function_descriptor(void *ptr)\n \t\tptr = p;\n \treturn ptr;\n }\n+\n+static inline void *dereference_kernel_function_descriptor(void *ptr)\n+{\n+\tif (ptr < (void *)__start_opd || (void *)__end_opd < ptr)\n+\t\treturn ptr;\n+\n+\treturn dereference_function_descriptor(ptr);\n+}\n #endif /* PPC64_ELF_ABI_v1 */\n \n #endif\ndiff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c\nindex 0b0f89685b67..52aa5d668364 100644\n--- a/arch/powerpc/kernel/module_64.c\n+++ b/arch/powerpc/kernel/module_64.c\n@@ -344,6 +344,11 @@ int module_frob_arch_sections(Elf64_Ehdr *hdr,\n \t\telse if (strcmp(secstrings+sechdrs[i].sh_name,\"__versions\")==0)\n \t\t\tdedotify_versions((void *)hdr + sechdrs[i].sh_offset,\n \t\t\t\t\t sechdrs[i].sh_size);\n+\t\telse if (strcmp(secstrings + sechdrs[i].sh_name, \".opd\")==0) {\n+\t\t\tme->arch.start_opd = sechdrs[i].sh_offset;\n+\t\t\tme->arch.end_opd = me->arch.start_opd +\n+\t\t\t\t\tsechdrs[i].sh_size;\n+\t\t}\n \n \t\t/* We don't handle .init for the moment: rename to _init */\n \t\twhile ((p = strstr(secstrings + sechdrs[i].sh_name, \".init\")))\n@@ -712,6 +717,17 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,\n \treturn 0;\n }\n \n+#ifdef PPC64_ELF_ABI_v1\n+unsigned long dereference_module_function_descriptor(struct module *mod,\n+\t\t\t\t\t\t unsigned long addr)\n+{\n+\tif (addr < mod->arch.start_opd || mod->arch.end_opd < addr)\n+\t\treturn addr;\n+\n+\treturn dereference_function_descriptor(addr);\n+}\n+#endif /* PPC64_ELF_ABI_v1 */\n+\n #ifdef CONFIG_DYNAMIC_FTRACE\n \n #ifdef CC_USING_MPROFILE_KERNEL\ndiff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S\nindex 882628fa6987..70e10251e083 100644\n--- a/arch/powerpc/kernel/vmlinux.lds.S\n+++ b/arch/powerpc/kernel/vmlinux.lds.S\n@@ -277,7 +277,9 @@ SECTIONS\n \t}\n \n \t.opd : AT(ADDR(.opd) - LOAD_OFFSET) {\n+\t\t__start_opd = .;\n \t\t*(.opd)\n+\t\t__end_opd = .;\n \t}\n \n \t. = ALIGN(256);\n", "prefixes": [ "3/5" ] }