get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/817407/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 817407,
    "url": "http://patchwork.ozlabs.org/api/patches/817407/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/94a52b3862789611138480bdc879334caa535066.1505934128.git.naveen.n.rao@linux.vnet.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": "<94a52b3862789611138480bdc879334caa535066.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>",
    "list_archive_url": "https://lore.kernel.org/linuxppc-dev/94a52b3862789611138480bdc879334caa535066.1505934128.git.naveen.n.rao@linux.vnet.ibm.com/",
    "date": "2017-09-22T09:10:46",
    "name": "[v2,4/6] powerpc/kprobes: Fix warnings from __this_cpu_read() on preempt kernels",
    "commit_ref": "c179ea270100488c416890beef6424ce390ceb38",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "189dbda0f80466da019e18b28e8ff2d3c760187c",
    "submitter": {
        "id": 15185,
        "url": "http://patchwork.ozlabs.org/api/people/15185/?format=api",
        "name": "Naveen N. Rao",
        "email": "naveen.n.rao@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linuxppc-dev/patch/94a52b3862789611138480bdc879334caa535066.1505934128.git.naveen.n.rao@linux.vnet.ibm.com/mbox/",
    "series": [
        {
            "id": 4580,
            "url": "http://patchwork.ozlabs.org/api/series/4580/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=4580",
            "date": "2017-09-22T09:10:23",
            "name": "powerpc/kprobes: More fixes",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/4580/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/817407/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/817407/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 [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 3xz7D83VJYz9sNc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 19:17:28 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xz7D82F7czDsNg\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 19:17:28 +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 3xz75143thzDsM7\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 22 Sep 2017 19:11:17 +1000 (AEST)",
            "from pps.filterd (m0098409.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8M9AQl3022458\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 05:11:15 -0400",
            "from e23smtp07.au.ibm.com (e23smtp07.au.ibm.com [202.81.31.140])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2d4pnhjxtm-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 05:11:15 -0400",
            "from localhost\n\tby e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <linuxppc-dev@lists.ozlabs.org> from\n\t<naveen.n.rao@linux.vnet.ibm.com>; Fri, 22 Sep 2017 19:11:12 +1000",
            "from d23relay09.au.ibm.com (202.81.31.228)\n\tby e23smtp07.au.ibm.com (202.81.31.204) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tFri, 22 Sep 2017 19:11:11 +1000",
            "from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\n\tby d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tv8M9BBKr41746528\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 19:11:11 +1000",
            "from d23av02.au.ibm.com (localhost [127.0.0.1])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tv8M9B2Np020647\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 22 Sep 2017 19:11:02 +1000",
            "from naverao1-tp.ibm.com ([9.77.124.51])\n\tby d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tv8M9AoTY020313; Fri, 22 Sep 2017 19:10:59 +1000"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com\n\t(client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n\tenvelope-from=naveen.n.rao@linux.vnet.ibm.com; receiver=<UNKNOWN>)",
        "From": "\"Naveen N. Rao\" <naveen.n.rao@linux.vnet.ibm.com>",
        "To": "Michael Ellerman <mpe@ellerman.id.au>",
        "Subject": "[PATCH v2 4/6] powerpc/kprobes: Fix warnings from __this_cpu_read()\n\ton preempt kernels",
        "Date": "Fri, 22 Sep 2017 14:40:46 +0530",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": [
            "<9e98f74834af349564b71bc8443bdad55d6e37c6.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>",
            "<cover.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>"
        ],
        "References": [
            "<9e98f74834af349564b71bc8443bdad55d6e37c6.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>",
            "<cover.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>"
        ],
        "X-TM-AS-MML": "disable",
        "x-cbid": "17092209-0044-0000-0000-00000287A088",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17092209-0045-0000-0000-0000071D8E34",
        "Message-Id": "<94a52b3862789611138480bdc879334caa535066.1505934128.git.naveen.n.rao@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-22_02:, , 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-1709220128",
        "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": "linuxppc-dev@lists.ozlabs.org, Masami Hiramatsu <mhiramat@kernel.org>,\n\tKamalesh Babulal <kamalesh@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": "Kamalesh pointed out that we are getting the below call traces with\nlivepatched functions when we enable CONFIG_PREEMPT:\n\n[  495.470721] BUG: using __this_cpu_read() in preemptible [00000000] code: cat/8394\n[  495.471167] caller is is_current_kprobe_addr+0x30/0x90\n[  495.471171] CPU: 4 PID: 8394 Comm: cat Tainted: G              K 4.13.0-rc7-nnr+ #95\n[  495.471173] Call Trace:\n[  495.471178] [c00000008fd9b960] [c0000000009f039c] dump_stack+0xec/0x160 (unreliable)\n[  495.471184] [c00000008fd9b9a0] [c00000000059169c] check_preemption_disabled+0x15c/0x170\n[  495.471187] [c00000008fd9ba30] [c000000000046460] is_current_kprobe_addr+0x30/0x90\n[  495.471191] [c00000008fd9ba60] [c00000000004e9a0] ftrace_call+0x1c/0xb8\n[  495.471195] [c00000008fd9bc30] [c000000000376fd8] seq_read+0x238/0x5c0\n[  495.471199] [c00000008fd9bcd0] [c0000000003cfd78] proc_reg_read+0x88/0xd0\n[  495.471203] [c00000008fd9bd00] [c00000000033e5d4] __vfs_read+0x44/0x1b0\n[  495.471206] [c00000008fd9bd90] [c0000000003402ec] vfs_read+0xbc/0x1b0\n[  495.471210] [c00000008fd9bde0] [c000000000342138] SyS_read+0x68/0x110\n[  495.471214] [c00000008fd9be30] [c00000000000bc6c] system_call+0x58/0x6c\n\nCommit c05b8c4474c030 (\"powerpc/kprobes: Skip livepatch_handler() for\njprobes\") introduced a helper is_current_kprobe_addr() to help determine\nif the current function has been livepatched or if it has a jprobe\ninstalled, both of which modify the NIP. This was subsequently renamed\nto __is_active_jprobe().\n\nIn the case of a jprobe, kprobe_ftrace_handler() disables pre-emption\nbefore calling into setjmp_pre_handler() which returns without disabling\npre-emption. This is done to ensure that the jprobe handler won't\ndisappear beneath us if the jprobe is unregistered between the\nsetjmp_pre_handler() and the subsequent longjmp_break_handler() called\nfrom the jprobe handler. Due to this, we can use __this_cpu_read() in\n__is_active_jprobe() with the pre-emption check as we know that\npre-emption will be disabled.\n\nHowever, if this function has been livepatched, we are still doing this\ncheck and when we do so, pre-emption won't necessarily be disabled. This\nresults in the call trace shown above.\n\nFix this by only invoking __is_active_jprobe() when pre-emption is\ndisabled. And since we now guard this within a pre-emption check, we can\ninstead use raw_cpu_read() to get the current_kprobe value skipping the\ncheck done by __this_cpu_read().\n\nFixes: c05b8c4474c030 (\"powerpc/kprobes: Skip livepatch_handler() for jprobes\")\nReported-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>\nTested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>\nSigned-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>\n---\n arch/powerpc/kernel/kprobes-ftrace.c | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/arch/powerpc/kernel/kprobes-ftrace.c b/arch/powerpc/kernel/kprobes-ftrace.c\nindex 48f675a73cff..1e54ec8ad85f 100644\n--- a/arch/powerpc/kernel/kprobes-ftrace.c\n+++ b/arch/powerpc/kernel/kprobes-ftrace.c\n@@ -32,8 +32,12 @@\n  */\n int __is_active_jprobe(unsigned long addr)\n {\n-\tstruct kprobe *p = kprobe_running();\n-\treturn (p && (unsigned long)p->addr == addr) ? 1 : 0;\n+\tif (!preemptible()) {\n+\t\tstruct kprobe *p = raw_cpu_read(current_kprobe);\n+\t\treturn (p && (unsigned long)p->addr == addr) ? 1 : 0;\n+\t}\n+\n+\treturn 0;\n }\n \n static nokprobe_inline\n",
    "prefixes": [
        "v2",
        "4/6"
    ]
}