From patchwork Fri Oct 21 20:33:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 101641 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp1489640qge; Fri, 21 Oct 2016 13:45:28 -0700 (PDT) X-Received: by 10.99.173.75 with SMTP id y11mr4156165pgo.130.1477082728114; Fri, 21 Oct 2016 13:45:28 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id l78si4043706pfi.288.2016.10.21.13.45.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Oct 2016 13:45:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@CAVIUMNETWORKS.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bxgfm-0004PR-NH; Fri, 21 Oct 2016 20:44:14 +0000 Received: from mail-co1nam03on0076.outbound.protection.outlook.com ([104.47.40.76] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bxgYg-000507-Rv for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2016 20:37:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zTGCc01VWWoYIHmqzxRKe12JR/IaSmTX/r4UuUTaBdw=; b=I2FbpV8/bMXNenXTrHx44a2L2xlZEgJqjKo/2noPg68xZKxKe2U/Sh6nsH/R4E3M+h6I5Sr0GvwnkN3cDSB7BZzN8N9QLUAkNqmlzZQGs3/a32v/vqmIK2XEYbDvO4JMib8Vgt8VJxLfW8bFL8n4RE8Di8etX0nB701G3eRB0SU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by CY1PR07MB2246.namprd07.prod.outlook.com (10.164.112.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Fri, 21 Oct 2016 20:36:31 +0000 From: Yury Norov To: , , , , , Subject: [PATCH 16/18] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Date: Fri, 21 Oct 2016 23:33:15 +0300 Message-ID: <1477081997-4770-17-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> References: <1477081997-4770-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM4PR0701CA0023.eurprd07.prod.outlook.com (10.165.102.33) To CY1PR07MB2246.namprd07.prod.outlook.com (10.164.112.148) X-MS-Office365-Filtering-Correlation-Id: 0fd0bc66-7a16-4807-216d-08d3f9f1f137 X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2246; 2:Ba3XTtSEhi4PSW105PnV4OKc4dHHNc7OGzGEBKxwf7JdYF7xEhzAl1ZSSGZpfGfZ7qRnehNHgTQD+XSz+KA1zji4Q+Md2KRKk5HiFMMIqBhcxdHV1af600WEEf5/Oq3K/A757etREuslNdb3YwFiEKTnUNAQfIwDqfD9Chz+Va15z2fgK+JP1jkcc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/+yGpModM84EZDmhEGaC8lUL77afhsmwttwxomFiRxid0IVmM6D0iUYM6X7lfYWr+akYIhZ7wPOifD+BZ23C3C4Yznl0x6Tpk2mTsqke5qvtq1NOqNw7XXj4VxZqvfpSst8F0qAuD0XfL5Rx1fPWRaRiRDR5DZllOW7ueC52XLo662+jIUburGwjnekSvLy1/XS6yewsU1aaUL1iWYlB34JH2I03bR0HVtWZPVrtJ8VakG1tyHvYZv8xZWzW8qHoI4h+1EO91x+v4zPi2xK7EahhrYDE1q6fSc3TzQeo0N/wxOahvDu5novnh0K+Cv4m30nL9+i1non11VYZLaFEct4CyXX6A/XROiTV8x1JhL6uZWZFYSU7NLTco5SMxRUhzlWPGUkzDsJ4UECjt8PVI+8Ybs04FT+sJ3oXsnggK+2u2hTi/DwoWSepdG5BIBB58tB95tzQpIlPpR33uYRj3Bm7clOiTZ6p4wV32Bcq4aaDZKUWf08l+z4qMOq6T+ksl6AmtHN2a5sOO8Zl2w7fNlHu6TY/QWd9g0U2jB4F+qhweo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(50582790962513); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:CY1PR07MB2246; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2246; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2246; 4:9hm1XEsi5GOqUvMVdzxPb3HnSWdPmUyLeJ9foIUIrr6jIhtwNSfdtL+awrDdrFsauhhc332gkinGw7IFmp18rpD7+WelnrpRyKEC5YGCr3txcSSvnNnuoJG0ZkyDq5rHvjwYCvcWKiTnQecHb4UpjxD5cc/YA4U9hlwfngW+IW94c3qID4DNnlh+2o/DozxQL7zNVakuE/iKF7BblSbKaMwG+EYzNZCCC2b50q4hh0Fb5iaay8rl5XkvHv6+iMmvDEj3slyKZ9g2emkYwhQf8lZkR3+rdm+yULG9BupLB4vZS7AOdTptceKpGo/B0eNQsaw4wRZcBa7TllyrjpZ9KpbMlaRCQvHIrcnC6XiHRkHD2sGfuATSk8yrPKSzr3/hj/8ThS/3sZuHGSaczhD8CmdLUMRrhL6gHJsCL+BZPd03bMlljuSKb1WR3FMbIzJGF1v9vKjnhRs68irbV2gDiQ== X-Forefront-PRVS: 01026E1310 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(4326007)(101416001)(6116002)(76176999)(189998001)(50466002)(5890100001)(2906002)(3846002)(47776003)(97736004)(68736007)(105586002)(229853001)(66066001)(106356001)(92566002)(5003940100001)(77096005)(50226002)(5001770100001)(81166006)(76506005)(19580405001)(19580395003)(42186005)(7416002)(2950100002)(7846002)(81156014)(36756003)(586003)(33646002)(2201001)(5660300001)(6666003)(50986999)(305945005)(48376002)(8676002)(7736002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2246; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2246; 23:avhxne7bbuhgZl0b19R2Toke17d/VtWBd3WhcCGHp?= tzlLZ4JS+Bleq9gGoLJzFcPAEoWNKRnXJEv+6CoTlH+d0iXtPyR/63lBEuJ/0/E/NAuh9DOK6bQGV6t2AK8+AXsTfdv3er6MYL4iTXRXfI76pynlZPPEmGtwcv78J+bTriySgNDaD/W7uyZp58Au8hBLDj/hm1SDhF183PAwLKIaXyJpN0XVUFMtffm2eMRFTRG3/4RqXT4zZFA9vUKN/j5O5k/lcLNsSngYYkPj8DFDDW/HxxrPsspsK3Xzy48Yhzb3STln1LFhAkWbuXAYqS1j+rDZnl4zI0ppeOctR/zss8nkzkCNDNJafVgrpg4z0mBb4xWVmdHDwzvywF7GgjmKqaENRB3WOmUeC033wxKFvhbP/ovCLPwHFnPX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CkKcBwgzXFZuB+veRweAhJNuzt5XMcFpW2d2ZYIGkLVa9UOl4ZrmagWYtxhSHKF; 5:Z3zGgboKD19k5I1slUkuqu+07WYD43xIh/vwU4WHcq/WXioejh30XSfxmaZqsBtzKCsvfkzmJsA3VEVmEOrmqgVtyWh7xLz4kTHUZY+udmUogt7WBnEiJ6ZRUgxgsVeD4BqsHy9dGzAabM9y54lPsa9beeLlflrw5b54pAX14TE=; 24:QlabiFN5dtHFSbArGa00wE+dzDd9uQtHZ5w++NGzGOOynZO4snzvmozRHDQPV/o6yyWW/4wRZf0aiCDKIp3d1xapArL0s95mT0B9XmFbE48=; 7:rGihF7G3/8TZ25mUOuJUJVRfE3CO92RfyycwGdnLOJO40JxTs3FvQ0g73T9N8jVJ5tHAVp8HHZiX0AD6pzkxmn/9ayCSEJJfQ2kPqPbQVCROevqYIKFp9Vcc/AluWHh3rl7SGxbSKakEq3/wyqRsQWJXbiOR7rjgwpRwnath8EfUnmfiWdhQLrGeCo39zAS0ZfL96klGa3y275W3oB2fRNPvkso21mqV6SB4KQB6QC3Xfnr5r/F5dDwwp0mhtdfqZonv5Ryk0koPOh0hxZTfOGeDB7MEauOQWdYREs9JAwNRhbRdJiYod9vhZlo3eiiAV2vscoFYO1W7NiYVCyL77/NjN5GKMcaS3Jb82O8Ywgw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2016 20:36:31.5134 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2246 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161021_133655_591951_B3E25992 X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [104.47.40.76 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [104.47.40.76 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, Bamvor Zhang Jian , maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, schwidefsky@de.ibm.com, davem@davemloft.net, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org New aarch32 ptrace syscall handler is introduced to avoid run-time detection of the task type. Signed-off-by: Yury Norov Signed-off-by: Bamvor Zhang Jian Signed-off-by: Chengming Zhou --- arch/arm64/include/asm/unistd32.h | 2 +- arch/arm64/kernel/ptrace.c | 91 ++++++++++++++++++++++++++++++++++++++- arch/arm64/kernel/sys32.c | 1 + include/linux/ptrace.h | 6 +++ kernel/ptrace.c | 10 ++--- 5 files changed, 103 insertions(+), 7 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index b7e8ef1..6da7cbd 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -74,7 +74,7 @@ __SYSCALL(__NR_getuid, sys_getuid16) /* 25 was sys_stime */ __SYSCALL(25, sys_ni_syscall) #define __NR_ptrace 26 -__SYSCALL(__NR_ptrace, compat_sys_ptrace) +__SYSCALL(__NR_ptrace, compat_sys_aarch32_ptrace) /* 27 was sys_alarm */ __SYSCALL(27, sys_ni_syscall) /* 28 was sys_fstat */ diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 1d075ed..ac542c9 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include +#include #include #include #include @@ -1215,7 +1217,7 @@ static int compat_ptrace_sethbpregs(struct task_struct *tsk, compat_long_t num, } #endif /* CONFIG_HAVE_HW_BREAKPOINT */ -long compat_arch_ptrace(struct task_struct *child, compat_long_t request, +static long compat_a32_ptrace(struct task_struct *child, compat_long_t request, compat_ulong_t caddr, compat_ulong_t cdata) { unsigned long addr = caddr; @@ -1292,8 +1294,95 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, return ret; } + +COMPAT_SYSCALL_DEFINE4(aarch32_ptrace, compat_long_t, request, compat_long_t, pid, + compat_long_t, addr, compat_long_t, data) +{ + struct task_struct *child; + long ret; + + if (request == PTRACE_TRACEME) { + ret = ptrace_traceme(); + goto out; + } + + child = ptrace_get_task_struct(pid); + if (IS_ERR(child)) { + ret = PTR_ERR(child); + goto out; + } + + if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { + ret = ptrace_attach(child, request, addr, data); + goto out_put_task_struct; + } + + ret = ptrace_check_attach(child, request == PTRACE_KILL || + request == PTRACE_INTERRUPT); + if (!ret) { + ret = compat_a32_ptrace(child, request, addr, data); + if (ret || request != PTRACE_DETACH) + ptrace_unfreeze_traced(child); + } + + out_put_task_struct: + put_task_struct(child); + out: + return ret; +} + #endif /* CONFIG_AARCH32_EL0 */ +#ifdef CONFIG_ARM64_ILP32 + +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + sigset_t new_set; + + switch (request) { + case PTRACE_GETSIGMASK: + if (caddr != sizeof(compat_sigset_t)) + return -EINVAL; + + return put_sigset_t((compat_sigset_t __user *) (u64) cdata, + &child->blocked); + + case PTRACE_SETSIGMASK: + if (caddr != sizeof(compat_sigset_t)) + return -EINVAL; + + if (get_sigset_t(&new_set, (compat_sigset_t __user *) (u64) cdata)) + return -EFAULT; + + sigdelsetmask(&new_set, sigmask(SIGKILL)|sigmask(SIGSTOP)); + + /* + * Every thread does recalc_sigpending() after resume, so + * retarget_shared_pending() and recalc_sigpending() are not + * called here. + */ + spin_lock_irq(&child->sighand->siglock); + child->blocked = new_set; + spin_unlock_irq(&child->sighand->siglock); + + return 0; + + default: + return compat_ptrace_request(child, request, caddr, cdata); + } +} + +#elif defined(CONFIG_COMPAT) + +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + return 0; +} + +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { #ifdef CONFIG_AARCH32_EL0 diff --git a/arch/arm64/kernel/sys32.c b/arch/arm64/kernel/sys32.c index a40b134..3752443 100644 --- a/arch/arm64/kernel/sys32.c +++ b/arch/arm64/kernel/sys32.c @@ -38,6 +38,7 @@ asmlinkage long compat_sys_fadvise64_64_wrapper(void); asmlinkage long compat_sys_sync_file_range2_wrapper(void); asmlinkage long compat_sys_fallocate_wrapper(void); asmlinkage long compat_sys_mmap2_wrapper(void); +asmlinkage long compat_sys_aarch32_ptrace(void); #undef __SYSCALL #define __SYSCALL(nr, sym) [nr] = sym, diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 504c98a..75887a0 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h @@ -97,6 +97,12 @@ int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr, unsigned long data); int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr, unsigned long data); +int ptrace_traceme(void); +struct task_struct *ptrace_get_task_struct(pid_t pid); +int ptrace_attach(struct task_struct *task, long request, + unsigned long addr, unsigned long flags); +int ptrace_check_attach(struct task_struct *child, bool ignore_state); +void ptrace_unfreeze_traced(struct task_struct *task); /** * ptrace_parent - return the task that is tracing the given task diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 2a99027..5638880 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c @@ -138,7 +138,7 @@ static bool ptrace_freeze_traced(struct task_struct *task) return ret; } -static void ptrace_unfreeze_traced(struct task_struct *task) +void ptrace_unfreeze_traced(struct task_struct *task) { if (task->state != __TASK_TRACED) return; @@ -170,7 +170,7 @@ static void ptrace_unfreeze_traced(struct task_struct *task) * RETURNS: * 0 on success, -ESRCH if %child is not ready. */ -static int ptrace_check_attach(struct task_struct *child, bool ignore_state) +int ptrace_check_attach(struct task_struct *child, bool ignore_state) { int ret = -ESRCH; @@ -294,7 +294,7 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) return !err; } -static int ptrace_attach(struct task_struct *task, long request, +int ptrace_attach(struct task_struct *task, long request, unsigned long addr, unsigned long flags) { @@ -408,7 +408,7 @@ static int ptrace_attach(struct task_struct *task, long request, * Performs checks and sets PT_PTRACED. * Should be used by all ptrace implementations for PTRACE_TRACEME. */ -static int ptrace_traceme(void) +int ptrace_traceme(void) { int ret = -EPERM; @@ -1057,7 +1057,7 @@ int ptrace_request(struct task_struct *child, long request, return ret; } -static struct task_struct *ptrace_get_task_struct(pid_t pid) +struct task_struct *ptrace_get_task_struct(pid_t pid) { struct task_struct *child;