From patchwork Wed Mar 24 06:54:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maninder Singh X-Patchwork-Id: 12160389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9204EC433DB for ; Wed, 24 Mar 2021 07:19:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17771619F6 for ; Wed, 24 Mar 2021 07:19:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 17771619F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=p1iPhN+HYc9F5WkTQAmbxkzICs+1wtlA1dc1i/oPUjI=; b=EmsCTj0FP7eYKskZmR3vkEmxZw qbmH5yQ4Q58yRos7cr2A8xFNy4IcjgfehsUrOl7EdYpU0oiVbPM5xesIgVROgnpFOln3o50i7twHy ldicuNcTathXFt8c26R3n7LGFlqlaCFg6853uZap1bpX5mJm2v3AsKW+kNmEsVqs/BXygmjz6lQaF RewEGRvHGqE8e/Ek08XbmOx+9Ly4XcI7VZKmlKyiWdPCT4RF19/i5Mvnq3yYpeNsNEQoXUF7EbpYL eo+IKjCwvQfKNls0JcpHRKbl363ClRrmEai7HXL6fMoLZBd3RQFSX7w3bFPbotQhBVnN8huAYx0Ka 0t4FOyrg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOxlb-00GTWW-GI; Wed, 24 Mar 2021 07:17:23 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOxkc-00GTC2-Oj for linux-arm-kernel@lists.infradead.org; Wed, 24 Mar 2021 07:16:30 +0000 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210324071617epoutp010d0c814978b2c7533936d3dee0e40d59~vNgL2JuG71167811678epoutp01g for ; Wed, 24 Mar 2021 07:16:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210324071617epoutp010d0c814978b2c7533936d3dee0e40d59~vNgL2JuG71167811678epoutp01g DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1616570177; bh=EZJ6jZebfYOz2VBi03W6MBX3hbw6FXJXb37vByeCE8s=; h=From:To:Cc:Subject:Date:References:From; b=nQOaCw/Nw3nTxeFW6Izv++CIgECFZZJmOUUq1qWL/LKeyJ+B+dmoA9kOrxuOoGZvp m+i6Le6BA3RbBmP/aXDlhnlMJEhaXqBHmV2jzkw1cWPVEYUTpnQ1bilPbA+9aDuTpo qd8aRzgy8knh/M2scrbvuz+0Ft0V6Cqv6p763NOM= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210324071614epcas5p2beb8860299b9d00cbf2f13e28879280a~vNgI3pGQu3065430654epcas5p2H; Wed, 24 Mar 2021 07:16:14 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 18.D2.41008.E37EA506; Wed, 24 Mar 2021 16:16:14 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20210324065511epcas5p1cb74119660e2d98a381ae69d01b29275~vNNw7pqQc2060220602epcas5p1I; Wed, 24 Mar 2021 06:55:11 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210324065511epsmtrp1af6f8952da5435723b7c8c8d9d27765d~vNNw6jQD_0887508875epsmtrp15; Wed, 24 Mar 2021 06:55:11 +0000 (GMT) X-AuditID: b6c32a4b-64bff7000001a030-dd-605ae73eab9a Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2E.A3.33967.F42EA506; Wed, 24 Mar 2021 15:55:11 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210324065508epsmtip2403aa1020ff9d8650e3dc6bb2c6101e0~vNNuQ0gCc0285702857epsmtip2M; Wed, 24 Mar 2021 06:55:08 +0000 (GMT) From: Maninder Singh To: catalin.marinas@arm.com, will@kernel.org, pcc@google.com, mark.rutland@arm.com, akpm@linux-foundation.org, 0x7f454c46@gmail.com, amit.kachhap@arm.com, james.morse@arm.com, vincenzo.frascino@arm.com, nsaenzjulienne@suse.de, keescook@chromium.org, samitolvanen@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, Maninder Singh Subject: [PATCH 1/2] arm64/process.c: fix Wmissing-prototypes build warnings Date: Wed, 24 Mar 2021 12:24:58 +0530 Message-Id: <1616568899-986-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDKsWRmVeSWpSXmKPExsWy7bCmhq7d86gEg9PvRCwmTHvBYnFxd6rF nPVr2CymfNjBavF+WQ+jxf19y5ksznTnWmx6fI3V4vKuOWwWh+e3sVgsvX6RyWLbrOVsFv13 rrNZLF3xltVi77+fLBYtd0wdBDzWzFvD6DG74SKLx85Zd9k9Fmwq9di0qpPN48SM3ywem5fU e/RtWcXosfl0tcfnTXIBXFFcNimpOZllqUX6dglcGff3vGAtWC5RcfPOP6YGxo0iXYycHBIC JhIbF31m6WLk4hAS2M0ocbO7hx3C+cQo8XrXFDYI5xujxPoL+1lhWiauaGOESOxllFhyYS9U 1RdGibVbZjGCVLEJ6Ems2rUHbLCIwHQmidbW52DtzAJdjBKbfhqB2MICPhJ3dywHa2ARUJW4 fuUvC4jNK+AqsWjCE2aIdXISN891MoMMkhDo5ZA4unwtI0TCRWLRqZMsELawxKvjW9ghbCmJ l/1t7BAN3YwSM+dchupeDbT5xXWoL+wlXjc3MHUxcgCdpCmxfpc+RFhWYuqpdUwQl/JJ9P5+ wgQR55XYMQ/GVpVoubkBaoy0xOePH6GO8JBYd2AXWI2QQKzE8d0P2SYwys5C2LCAkXEVo2Rq QXFuemqxaYFxXmq5XnFibnFpXrpecn7uJkZwAtLy3sH46MEHvUOMTByMhxglOJiVRHhbwiMS hHhTEiurUovy44tKc1KLDzFKc7AoifPuMHgQLySQnliSmp2aWpBaBJNl4uCUamDqn3dG+baH zL8vN42kjifEHpwTWcKnfDHox6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W98uW1ZZ5Lmqv0p4rE9gVxSm+yuiqR9CmnOl5m61uL0x3m6Nqw517zOdL+W1uspFueb 1d7FVLTpQvkb8YtZ8xSzpb7smm34Vkd6++MVS24tiZjPeNSz703db/ZVJx98UZj0MPn838NS G7LEtKeciufL1H32l1UrT1TlULqsXkO87XPB5tU8IvsOLw/hfbvW/lzHnVyjRzw7j2qt2DLz 17wrnF4tZzmvKrEUZyQaajEXFScCADVfoS7TAgAA X-CMS-MailID: 20210324065511epcas5p1cb74119660e2d98a381ae69d01b29275 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210324065511epcas5p1cb74119660e2d98a381ae69d01b29275 References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210324_071623_640777_86C957C4 X-CRM114-Status: GOOD ( 15.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org function protypes are missed before defination, which leads to compilation warning with "-Wmissing-prototypes" flag. https://lkml.org/lkml/2021/3/19/840 arch/arm64/kernel/process.c:261:6: warning: no previous prototype for '__show_regs' [-Wmissing-prototypes] 261 | void __show_regs(struct pt_regs *regs) | ^~~~~~~~~~~ arch/arm64/kernel/process.c:307:6: warning: no previous prototype for '__show_regs_alloc_free' [-Wmissing-prototypes] 307 | void __show_regs_alloc_free(struct pt_regs *regs) | ^~~~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/process.c:365:5: warning: no previous prototype for 'arch_dup_task_struct' [-Wmissing-prototypes] 365 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | ^~~~~~~~~~~~~~~~~~~~ arch/arm64/kernel/process.c:546:41: warning: no previous prototype for '__switch_to' [-Wmissing-prototypes] 546 | __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, | ^~~~~~~~~~~ arch/arm64/kernel/process.c:710:25: warning: no previous prototype for 'arm64_preempt_schedule_irq' [-Wmissing-prototypes] 710 | asmlinkage void __sched arm64_preempt_schedule_irq(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: kernel test robot Signed-off-by: Maninder Singh --- arch/arm64/include/asm/processor.h | 2 ++ arch/arm64/include/asm/thread_info.h | 2 ++ arch/arm64/kernel/process.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index ca2cd75d3286..efc10e9041a0 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -251,6 +251,8 @@ unsigned long get_wchan(struct task_struct *p); extern struct task_struct *cpu_switch_to(struct task_struct *prev, struct task_struct *next); +asmlinkage void arm64_preempt_schedule_irq(void); + #define task_pt_regs(p) \ ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 9f4e3b266f21..6623c99f0984 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -55,6 +55,8 @@ void arch_setup_new_exec(void); #define arch_setup_new_exec arch_setup_new_exec void arch_release_task_struct(struct task_struct *tsk); +int arch_dup_task_struct(struct task_struct *dst, + struct task_struct *src); #endif diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 325c83b1a24d..6e60aa3b5ea9 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -57,6 +57,8 @@ #include #include #include +#include +#include #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) #include From patchwork Wed Mar 24 06:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maninder Singh X-Patchwork-Id: 12160391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9A12C433E2 for ; Wed, 24 Mar 2021 07:19:21 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 529DB619FC for ; Wed, 24 Mar 2021 07:19:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 529DB619FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gPwTnUvuKh7gDf5f+p8hgft+qQYjReiNQznJ58GrzT0=; b=n5aZBkOKynBCZIS2N5e+Fr0liD GSw22ymXtvGrNA8knsVVXQwrcXoIqf5vR5x04oEpbHWpejIgHjMz3jaaLRoLn+WRBNkOE24TfweXt y9wlsM7B86G8WzIKgIG6oKPObxaEh2SOtDcMcORbGdF+Cc62l/1LWC4XoPGZiRse0fIPeOvsN0omu 0pd+aGURksnwNHnIEXSaIAr7fkpqLIsOzqR/3HdRHj4gnFbnq1CmdEvFvV66QUta/EYO43+NcC9LF KK1SEV6hf75bd8jsd92iUETu5hTJg5qgiQsgjnVd7FUVpIhjNst++QLaBYwbjt3tRurMtz0FffA8R kqSofvHQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOxlk-00GTaw-AU; Wed, 24 Mar 2021 07:17:33 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOxke-00GTDW-V9 for linux-arm-kernel@lists.infradead.org; Wed, 24 Mar 2021 07:16:30 +0000 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20210324071622epoutp0107fdccd7d66697b9cdda7f5ed707d555~vNgQV_4CH1202312023epoutp01V for ; Wed, 24 Mar 2021 07:16:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20210324071622epoutp0107fdccd7d66697b9cdda7f5ed707d555~vNgQV_4CH1202312023epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1616570182; bh=JfwyFLtEnH92E6JOT0cexb/0uIe8wkrNN8VfuEQfHBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKZsdFXROOgKh9h15k58wBy+EWUiGvH+nR1gY5VozXs7n0U/nqD5AwqmOBM3KpIn/ S5RGsvrAffJG3sa0I2MmSug6ZlmM29c6MqWqFosL83fViy6BVhkc2RI9WC1ibPq2s6 zDXJmtnlElxsrrcwNYH4/CEH8Zh2mEl7xGlG34Xk= Received: from epsmges5p3new.samsung.com (unknown [182.195.42.75]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20210324071621epcas5p1a087dc1205d7f1ae37b118edc00fcabf~vNgPiZJA60169501695epcas5p1V; Wed, 24 Mar 2021 07:16:21 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id 1B.E2.41008.547EA506; Wed, 24 Mar 2021 16:16:21 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20210324065516epcas5p450958011b69f5941e8f2bc993b82b904~vNN08j2Lf2429124291epcas5p4t; Wed, 24 Mar 2021 06:55:16 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210324065516epsmtrp272d6e26f8b1a44e5ad74529edec01e77~vNN07kngR2488824888epsmtrp2b; Wed, 24 Mar 2021 06:55:16 +0000 (GMT) X-AuditID: b6c32a4b-bf2c4a800001a030-11-605ae7454345 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 01.B3.33967.352EA506; Wed, 24 Mar 2021 15:55:15 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210324065513epsmtip25aeeae6ea9e3dca99da31ee6a6ceca80~vNNyIl9g30289902899epsmtip2P; Wed, 24 Mar 2021 06:55:12 +0000 (GMT) From: Maninder Singh To: catalin.marinas@arm.com, will@kernel.org, pcc@google.com, mark.rutland@arm.com, akpm@linux-foundation.org, 0x7f454c46@gmail.com, amit.kachhap@arm.com, james.morse@arm.com, vincenzo.frascino@arm.com, nsaenzjulienne@suse.de, keescook@chromium.org, samitolvanen@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, Maninder Singh , Vaneet Narang Subject: [PATCH 2/2] arm64: print alloc free paths for address in registers Date: Wed, 24 Mar 2021 12:24:59 +0530 Message-Id: <1616568899-986-2-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1616568899-986-1-git-send-email-maninder1.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLKsWRmVeSWpSXmKPExsWy7bCmhq7r86gEgwcLZS0mTHvBYnFxd6rF nPVr2CymfNjBavF+WQ+jxf19y5ksznTnWmx6fI3V4vKuOWwWh+e3sVgsvX6RyWLbrOVsFv13 rrNZLF3xltXi0Mm5jBZ7//1ksWi5Y+og6LFm3hpGj9kNF1k8ds66y+6xYFOpx6ZVnWweJ2b8 ZvHYvKTeo2/LKkaPzaerPT5vkgvgiuKySUnNySxLLdK3S+DKuHlxP0vBHpWKVU+fMTUwvpXt YuTkkBAwkehYtJS9i5GLQ0hgN6PEnt1fGEESQgKfGCWavvND2N8YJdb854Np+HBrDhNEw15G iecL5jFDOF8YJRbf/c0KUsUmoCexatceFpCEiMB0JonW1uesIA6zwCZGic29r8GqhAW8JX5e /QW2j0VAVeLgzZtgNq+Aq0T71h5WiH1yEjfPdTKD2JwCbhJNSzYxggySEFjLIXF34XeoIheJ 72sWsUPYwhKvjm+BsqUkPr/bywbR0M0oMXPOZWYIZzWjxKYX16G67SVeNzcAvcQBdJ+mxPpd +hBhWYmpp9YxgdjMAnwSvb+fMEHEeSV2zIOxVSVabm6AGiMt8fnjRxYI20Pi7Na30GCdySix 4shstgmMcrMQVixgZFzFKJlaUJybnlpsWmCcl1quV5yYW1yal66XnJ+7iRGcorS8dzA+evBB 7xAjEwfjIUYJDmYlEd6W8IgEId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rw7DB7ECwmkJ5akZqem FqQWwWSZODilGph8/73+aBFQvOWC5bHP6kf0uzK/lR0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OlDe9ZPFcHNzimv5g1cXp/y+f6b2/ ZoPp5A0sl9llvku++M3KOaekeu2Bc5Vle7qUItKCt+8//WZv69v1P+Y99r3WEphSv2vmkUkx y1ZbL1uy0Tvr6OuMJ+/PsNW8FC86eq7jadbGZ8/c57fPmnP0XKRn5EKBg+J3X5ztWPZuthFv QVr5Bfk9Nww2he/yku22e6elW6ejm9r/s0qaseuGntjLksCpyXeyNV7xTE5yFXpb8T+6pVPL 73aXX6LMBafEjQHKSSnzuJM0OTe83DzzRNAryfToW3eclFiKMxINtZiLihMBiO1RS/ACAAA= X-CMS-MailID: 20210324065516epcas5p450958011b69f5941e8f2bc993b82b904 X-Msg-Generator: CA X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210324065516epcas5p450958011b69f5941e8f2bc993b82b904 References: <1616568899-986-1-git-send-email-maninder1.s@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210324_071625_536775_3A60FE28 X-CRM114-Status: GOOD ( 19.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In case of a use after free kernel OOPs, freed path of the object is required to debug futher. In most of cases the object address is present in one of the registers. Thus check the register's address and if it belongs to slab, print its alloc and free path. commit a02a25709155 ("mm/slub: add support for free path information of an object") provides free path along with alloc path of object in mem_dump_obj(). Thus call it with register values same as in ARM with commit 14c0508adcdb ("arm: print alloc free paths for address in registers") e.g. in the below issue register x20 belongs to slab, and a use after free issue occurred on one of its dereferenced values: [ 19.516507] Unable to handle kernel paging request at virtual address 006b6b6b6b6b6b73 .. .. [ 19.528784] Register x10 information: 0-page vmalloc region starting at 0xffff800011bb0000 allocated at paging_init+0x1d8/0x544 [ 19.529143] Register x11 information: 0-page vmalloc region starting at 0xffff800011bb0000 allocated at paging_init+0x1d8/0x544 [ 19.529513] Register x12 information: non-paged memory .. [ 19.544953] Register x20 information: slab kmalloc-128 start ffff0000c3a34280 data offset 128 pointer offset 0 size 128 allocated at meminfo_proc_show+0x44/0x588 [ 19.545432] ___slab_alloc+0x638/0x658 [ 19.545576] __slab_alloc.isra.0+0x2c/0x58 [ 19.545728] kmem_cache_alloc+0x584/0x598 [ 19.545877] meminfo_proc_show+0x44/0x588 [ 19.546022] seq_read_iter+0x258/0x460 [ 19.546160] proc_reg_read_iter+0x90/0xd0 [ 19.546308] generic_file_splice_read+0xd0/0x188 [ 19.546474] do_splice_to+0x90/0xe0 [ 19.546609] splice_direct_to_actor+0xbc/0x240 [ 19.546768] do_splice_direct+0x8c/0xe8 [ 19.546911] do_sendfile+0x2c4/0x500 [ 19.547048] __arm64_sys_sendfile64+0x160/0x168 [ 19.547205] el0_svc_common.constprop.0+0x60/0x120 [ 19.547377] do_el0_svc_compat+0x1c/0x40 [ 19.547524] el0_svc_compat+0x24/0x38 [ 19.547660] el0_sync_compat_handler+0x90/0x158 [ 19.547821] Free path: [ 19.547906] __slab_free+0x3dc/0x538 [ 19.548051] kfree+0x2d8/0x310 [ 19.548176] meminfo_proc_show+0x60/0x588 [ 19.548322] seq_read_iter+0x258/0x460 [ 19.548459] proc_reg_read_iter+0x90/0xd0 [ 19.548602] generic_file_splice_read+0xd0/0x188 [ 19.548761] do_splice_to+0x90/0xe0 [ 19.548889] splice_direct_to_actor+0xbc/0x240 [ 19.549040] do_splice_direct+0x8c/0xe8 [ 19.549183] do_sendfile+0x2c4/0x500 [ 19.549319] __arm64_sys_sendfile64+0x160/0x168 [ 19.549477] el0_svc_common.constprop.0+0x60/0x120 [ 19.549646] do_el0_svc_compat+0x1c/0x40 [ 19.549782] el0_svc_compat+0x24/0x38 [ 19.549913] el0_sync_compat_handler+0x90/0x158 [ 19.550067] el0_sync_compat+0x174/0x180 .. Signed-off-by: Vaneet Narang Signed-off-by: Maninder Singh --- arch/arm64/include/asm/system_misc.h | 1 + arch/arm64/kernel/process.c | 11 +++++++++++ arch/arm64/kernel/traps.c | 1 + 3 files changed, 13 insertions(+) diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h index 673be2d1263c..84d5204cdb80 100644 --- a/arch/arm64/include/asm/system_misc.h +++ b/arch/arm64/include/asm/system_misc.h @@ -31,6 +31,7 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct mm_struct; extern void __show_regs(struct pt_regs *); +extern void __show_regs_alloc_free(struct pt_regs *regs); extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd); diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 6e60aa3b5ea9..d0d0ada332c3 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -306,6 +306,17 @@ void __show_regs(struct pt_regs *regs) } } +void __show_regs_alloc_free(struct pt_regs *regs) +{ + int i; + + /* check for x0 - x29 only */ + for (i = 0; i <= 29; i++) { + pr_alert("Register x%d information:", i); + mem_dump_obj((void *)regs->regs[i]); + } +} + void show_regs(struct pt_regs *regs) { __show_regs(regs); diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index a05d34f0e82a..cb4858c6e57b 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -104,6 +104,7 @@ static int __die(const char *str, int err, struct pt_regs *regs) print_modules(); show_regs(regs); + __show_regs_alloc_free(regs); dump_kernel_instr(KERN_EMERG, regs);