Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/814459/?format=api
{ "id": 814459, "url": "http://patchwork.ozlabs.org/api/patches/814459/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170916035347.19705-2-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-2-sergey.senozhatsky@gmail.com>", "list_archive_url": "https://lore.kernel.org/linuxppc-dev/20170916035347.19705-2-sergey.senozhatsky@gmail.com/", "date": "2017-09-16T03:53:43", "name": "[1/5] sections: split dereference_function_descriptor()", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "614870e59a61b94b911d4894bbdb9938bf24a8ac", "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-2-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/814459/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/814459/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 3xvJWF0BYsz9t16\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 14:02:17 +1000 (AEST)", "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xvJWD68TnzDqYQ\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 16 Sep 2017 14:02:16 +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 3xvJRD2p7bzDrnj\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tSat, 16 Sep 2017 13:58:48 +1000 (AEST)", "by mail-pf0-x244.google.com with SMTP id g65so2071095pfe.1\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 15 Sep 2017 20:58:48 -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.41\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 15 Sep 2017 20:58:45 -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=\"GWUxHrCD\"; 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=\"GWUxHrCD\"; 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=\"GWUxHrCD\"; 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=m4NVOdEEbgW+yLsF7VlHqvGOWnvuNQRtnSx21e1b6Bk=;\n\tb=GWUxHrCDC9NQnugVSPE13EEAzjg3FO7MWI5lHZ8uYb4UJA08gWv91oqYlETEOoxcDb\n\tIxTIwIJygr5NNjw29iyt1sAPwjAgvR4HBDOWpn3M7x1AlILrt49Q5jhauEq8gSfNXSIy\n\tVXeDW5mt+/ITH21oFYBA2j8lqil9Byv+c7pyhO9FjeLlu82+Kx8IYcqjT4X8yf2IMVr7\n\tBECWFVC0lSzfaQKkHyNGtaw3CAZXpMst4uRe4ObrtWBIGg9w2ueCoK5AbxLiRYMxhvXV\n\tow/RSmQFDJlGlnJhSDjZgZbhfgWrC4mBiy2RW2Sh0crw91zOJlwKbNG7+ox0PSlO0iV+\n\tLa+g==", "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=m4NVOdEEbgW+yLsF7VlHqvGOWnvuNQRtnSx21e1b6Bk=;\n\tb=tfDbRkkhu6eLYWvY+kXBrB+X/t76Cnz/efaKbksu6U1AvjGCwvW524V9y+JBDPaZST\n\tx8T76hw9+fDLCGk+zQEo/3mXAO9AOChKyOJ2aZ6DfiADm3QY5slXIgJz3Kx7h3oUSw2A\n\txtZwmKzoWEF0crve57IefSIDmSFPuGq7iaTuDondKbw39lyAdZX0DidTJCchbZWPzEQ9\n\tyf5OcAkb3/7iN0ObjohzBst2FT9KOxlfzajIdNSx/dDXF+vyVTki9mmnkjlLMJoSlA30\n\tNgHsNxcrGNGSZlTxcmBInZoJRr7AO8YfxbdAHXujnQ2NDItpN7xpvnibrJPrPPbp9iWf\n\tEcGg==", "X-Gm-Message-State": "AHPjjUioW509ntDmH56kLV68fAqHuvbIuGbDffRm3JjBPfjAsFZQQzjn\n\tUiBq9CothUBDaA==", "X-Google-Smtp-Source": "ADKCNb6mwPuyg3VsLqB8A+HCfUVPghXXhZz4raiSj1edh5EUJMxQaWQmff7m8wqvMfgSiRh91pjbmQ==", "X-Received": "by 10.84.238.141 with SMTP id v13mr30891509plk.349.1505534326300;\n\tFri, 15 Sep 2017 20:58:46 -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 1/5] sections: split dereference_function_descriptor()", "Date": "Sat, 16 Sep 2017 12:53:43 +0900", "Message-Id": "<20170916035347.19705-2-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": "There are two format specifiers to print out a pointer in symbolic\nformat: '%pS/%ps' and '%pF/%pf'. On most architectures, the two\nmean exactly the same thing, but some architectures (ia64, ppc64,\nparisc64) use an indirect pointer for C function pointers, where\nthe function pointer points to a function descriptor (which in\nturn contains the actual pointer to the code). The '%pF/%pf, when\nused appropriately, automatically does the appropriate function\ndescriptor dereference on such architectures.\n\nThe \"when used appropriately\" part is tricky. Basically this is\na subtle ABI detail, specific to some platforms, that made it to\nthe API level and people can be unaware of it and miss the whole\n\"we need to dereference the function\" business out. [1] proves\nthat point (note that it fixes only '%pF' and '%pS', there might\nbe '%pf' and '%ps' cases as well).\n\nIt appears that we can handle everything within the affected\narches and make '%pS/%ps' smart enough to retire '%pF/%pf'.\nFunction descriptors live in .opd elf section and all affected\narches (ia64, ppc64, parisc64) handle it properly for kernel\nand modules. So we, technically, can decide if the dereference\nis needed by simply looking at the pointer: if it belongs to\n.opd section then we need to dereference it.\n\nThe kernel and modules have their own .opd sections, obviously,\nthat's why we need to split dereference_function_descriptor()\nand use separate kernel and module dereference arch callbacks.\n\nThis patch does the first step, it\na) adds dereference_kernel_function_descriptor() function.\nb) adds a weak alias to dereference_module_function_descriptor()\n function.\n\nSo, for the time being, we will have:\n1) dereference_function_descriptor()\n A generic function, that simply dereferences the pointer. There is\n bunch of places that call it: kgdbts, init/main.c, extable, etc.\n\n2) dereference_kernel_function_descriptor()\n A function to call on kernel symbols that does kernel .opd section\n address range test.\n\n3) dereference_module_function_descriptor()\n A function to call on modules' symbols that does modules' .opd\n section address range test.\n\n[1] https://marc.info/?l=linux-kernel&m=150472969730573\n\nSigned-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>\n---\n include/asm-generic/sections.h | 4 ++--\n include/linux/moduleloader.h | 4 ++++\n kernel/module.c | 6 ++++++\n 3 files changed, 12 insertions(+), 2 deletions(-)", "diff": "diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h\nindex e5da44eddd2f..21d2165e531a 100644\n--- a/include/asm-generic/sections.h\n+++ b/include/asm-generic/sections.h\n@@ -49,10 +49,10 @@ extern char __ctors_start[], __ctors_end[];\n \n extern __visible const void __nosave_begin, __nosave_end;\n \n-/* function descriptor handling (if any). Override\n- * in asm/sections.h */\n+/* Function descriptor handling (if any). Override in asm/sections.h */\n #ifndef dereference_function_descriptor\n #define dereference_function_descriptor(p) (p)\n+#define dereference_kernel_function_descriptor(p) (p)\n #endif\n \n /* random extra sections (if any). Override\ndiff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h\nindex 4d0cb9bba93e..172904e9cded 100644\n--- a/include/linux/moduleloader.h\n+++ b/include/linux/moduleloader.h\n@@ -85,6 +85,10 @@ void module_arch_cleanup(struct module *mod);\n /* Any cleanup before freeing mod->module_init */\n void module_arch_freeing_init(struct module *mod);\n \n+/* Dereference module function descriptor */\n+unsigned long dereference_module_function_descriptor(struct module *mod,\n+\t\t\t\t\t\t unsigned long addr);\n+\n #ifdef CONFIG_KASAN\n #include <linux/kasan.h>\n #define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)\ndiff --git a/kernel/module.c b/kernel/module.c\nindex de66ec825992..87cdb46863cd 100644\n--- a/kernel/module.c\n+++ b/kernel/module.c\n@@ -2121,6 +2121,12 @@ void __weak module_arch_freeing_init(struct module *mod)\n {\n }\n \n+unsigned long __weak dereference_module_function_descriptor(struct module *mod,\n+\t\t\t\t\t\t\t unsigned long addr)\n+{\n+\treturn addr;\n+}\n+\n /* Free a module, remove from lists, etc. */\n static void free_module(struct module *mod)\n {\n", "prefixes": [ "1/5" ] }