From patchwork Tue Sep 29 22:14:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 54262 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 133AE22B1E for ; Tue, 29 Sep 2015 22:16:05 +0000 (UTC) Received: by labjk1 with SMTP id jk1sf11773769lab.0 for ; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :spamdiagnosticoutput:spamdiagnosticmetadata:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=V41O0ddnVn0hQCmsl/RgxNNTJOEvn/oj9ad+0FKl48A=; b=bcVjg+R1TAIeCvyZWnEopGSug3Ga9SlmkDr2cXz7P4YG5Xesdh/0qMKCwZlmXpoTOc y30EWGa3fp/1jU65TzRmOo0S1PnkGc0f/wXWCR+sOsuVyO9eKrHxmWvh7TY5WTjuzGRG UzRET5txhXExPiesFjKJJSvBKueBbOQqTU3Iu717YcJs/RrBiZR3JaSKEodXvcHkUOa+ luafgAkotDLoDxvA9n8ZqVejCrw/YN6/KFXt+P/XbFnKLnabO90NFAi0qPi+uX2KR4px 99a0i1FnS1btDdJn2tnZTm7+1iazsIJMkTFSETbM7u5wK0kJI/ydWXJcrKO7GTpuZV67 sXZA== X-Gm-Message-State: ALoCoQmc9wB6kEJrynGJWnpp0IkXwLFBhcQkQLuZHAGrkqGxckK7EMyKvwsggEAdES652HJm2kRv X-Received: by 10.152.3.131 with SMTP id c3mr46186lac.4.1443564963536; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.15.40 with SMTP id e40ls6603lfi.14.gmail; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) X-Received: by 10.112.172.165 with SMTP id bd5mr93053lbc.51.1443564963386; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id w6si11972800laa.29.2015.09.29.15.16.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 15:16:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by laclj5 with SMTP id lj5so25363200lac.3 for ; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) X-Received: by 10.25.211.201 with SMTP id k192mr70310lfg.32.1443564963234; Tue, 29 Sep 2015 15:16:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2396928lbq; Tue, 29 Sep 2015 15:16:02 -0700 (PDT) X-Received: by 10.68.245.164 with SMTP id xp4mr473190pbc.100.1443564962016; Tue, 29 Sep 2015 15:16:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wd7si40486236pab.213.2015.09.29.15.16.01; Tue, 29 Sep 2015 15:16:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756171AbbI2WP7 (ORCPT + 30 others); Tue, 29 Sep 2015 18:15:59 -0400 Received: from mail-bn1on0056.outbound.protection.outlook.com ([157.56.110.56]:61365 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755379AbbI2WPm (ORCPT ); Tue, 29 Sep 2015 18:15:42 -0400 Received: from localhost (91.78.158.8) by BY2PR07MB616.namprd07.prod.outlook.com (10.141.222.156) with Microsoft SMTP Server (TLS) id 15.1.280.20; Tue, 29 Sep 2015 22:15:39 +0000 From: Yury Norov To: , , , , , CC: , , , , , Yury Norov Subject: [PATCH v5 04/23] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Date: Wed, 30 Sep 2015 01:14:01 +0300 Message-ID: <1443564860-31208-5-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> References: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [91.78.158.8] X-ClientProxiedBy: DB5PR02CA0014.eurprd02.prod.outlook.com (25.161.237.24) To BY2PR07MB616.namprd07.prod.outlook.com (10.141.222.156) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB616; 2:ihLvBLKv1JzPIUmobQeYyWJIfzAAMVvXWhqxXUEGf9U/OO9z8Va+I4yZ0b6Uq7kgpn6IFzY+p+h88EY8U+Gn8R91zJtzXzlh2hfNH1fXl8FHqH7VZhet/MaCCdsOtQO/Kep6pIgUxO2r7DXUNsxxM06gRYX6OLPFXss5F4PZSXk=; 3:+diB6u3Lc1gx+0rPcw9eRrwyeBvZ+zvdQmZtyjiY4yateQt9aDbm/nBGYXZ3cCcHYCzBqtjfaG/ortRiS9BbAkn/fjaBYraRWdvCGu5f5Rn2awmS6yeKEldmBGV/bDWgzSVJuGgNC/nYYJAr7wM7iw==; 25:DYB1a8rOg2y1EyB98IorWFympW4/zJ+jb7ITkH8eORv2mAH+g2PLhEll9dmXvq4DJGDVQQ1/ys1TnhveApXqXCY84ppHWCHgao4KDq+sqMSfde7KatT/ZnfT47HBUagu8RLPPJ3FUlo06PrHGp7cGsRauX/KdyE+xL8wxOKS0Zsdk7olTrlBxms0VxkBuufUvTEFnL3O7NKIJXZARPWLyUzZPFceJ4yq9Hyk14p4OEtEFmFfaz88B/bQwiiZ9Sq4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB616; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB616; 20:zkGelvpo5TNd5++ioWWB6vug0DY+dqh/t+cAT1dX5MO47w9cXYikJaLdBNzrtJCTptIPPMW2nYUx9cCZcM5SKFbWCvzuMVqlehyG5VZkGrbmr1ixpHhudgSqGKn74giXFRTzfo/tEd9qgsFwgarkTs5G/DZUlBLY4JhokwI7DCK/Nttt/Jx8MlToryhAEE3rh6g7heKJqf9SIjb/97IEgPpaqimQ8KFY5vN+BBunIsZ+htQevR6Rz4Bb5KNYlj558aM+v9yllZ4K3l2tCoWflTrlkTHVwzcUHJdQhEyzqNWmvNmclp/5+xI9deXCs3wj0EmoIXT1SIuZMM87Xt6iWUAUqN/sLYz6l3FxmEnfOQLMK3Bns7Qs+BvWpF87ly5neFZOzsAcQMoWEaWxFg65Fi4cq2zdl0ixYcvWo6GS3MaUz/yVokOznHlNBE+fwntwUI6BX48OHt4IX/vdOiPfzXSYXI0kB0YMlocoKEV7ryaSrHWJoBUtkVRztrGprxiZe9uXQfIc2rS7LYmq689Mgqw56ot31M288NTJaLrpvs4xlaE+hOj85PV5nLiqt7G0fwZIIl7BXfL22JZZ3ZZyLQdr1Jl6F2jz9b5UA11Z0gQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001); SRVR:BY2PR07MB616; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB616; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB616; 4:j+0Sa4wX2cE6bjKEv7Jaimg7uRJcVO7Br1d+vcfHpEodYEapuUnaS2fMFfOsIJUI38EpV2JRdOQaf6nws92DuM56QrnfitLxX+xVbSq7YymnhYBiB7HXke1EVw3nnyP4l6zO9CoMDVfUGA4GE1rWkCBQWZJ7ICDD0902c3ycIEYjQYU7cv3DjehxeuasrdoMFo7EsiyV3jha0i76Kw1tj7wr7PJNzPYDCI8GpvZ+ErLn9u5TXMVAxINTPDQcxZsb4eJMr/kt6TmzmUB0HL7oqWUtPLZcv1y4VdUBzPqCqjPUtEibG5vU+cWLnAQ/55CZhAOjyntqmy82lOPhnj/jW6kZVzm8qJCyKA4lEP5eV3Q= X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(6069001)(189002)(199003)(5001860100001)(46102003)(47776003)(5004730100002)(66066001)(101416001)(2201001)(5001770100001)(42186005)(2950100001)(122386002)(36756003)(5001960100002)(189998001)(5003940100001)(107886002)(575784001)(76506005)(77096005)(106356001)(229853001)(50466002)(50226001)(19580405001)(5007970100001)(15975445007)(4001540100001)(40100003)(50986999)(68736005)(105586002)(33646002)(48376002)(64706001)(87976001)(19580395003)(76176999)(97736004)(77156002)(81156007)(62966003)(5001830100001)(5008740100001)(92566002)(2101003)(4001430100001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB616; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; BY2PR07MB616; 23:jvr8nHsvxBl7trHzIMFuZRaf7EqkrX/+QQvfKLzUdT?= =?us-ascii?Q?hcbMM4QpDopUiP6KniWxTgGrJqc8S4FkU9re6qF+mhe2pScAmvln661zu8En?= =?us-ascii?Q?ilQ+6ScfHoThQJ/OaITjgKhrB5n/Jy1v10LxGCiUkfhw8cNg5WH9l9r5+3Ss?= =?us-ascii?Q?JMkJPXRIWUm37VXfcVwijq/a/tJMqNIzUTtLjwkA20fxBB4xYOWEmpe2gnvH?= =?us-ascii?Q?1N5Vfs1fRSlj31JUMgnkMROqpCu99go91C41/jxvq6h1rFPjf3P4IQ4+dCrP?= =?us-ascii?Q?4ljVEjVxk5u7swWVh3beYOmHuO2/JkeJksShKE6mC0EKC1SR48A6EekKgPBP?= =?us-ascii?Q?jPGeS+8iB8Fu8VWyFio16mNLWKiFrF+K+dFvyNUAjsHCn8jxgkq+xawR9Z96?= =?us-ascii?Q?4stS3OOqag9jCT2Tl9BKeK875EtWp3e9WRFKiJZedW8W3Ww1l4gyGldk3Rg5?= =?us-ascii?Q?CqOlKApfgeftnlnMnsa3TM56kTOutVqxx5CDlLQu5XkqRrnLpNbYTlVYHIDV?= =?us-ascii?Q?98FhypHqG7KQqF6zPjtlTClK65OkTDbOkdMBGmWlickVE7zyoV2AVaG6Sr4H?= =?us-ascii?Q?ECqdeFX67Q44NwAlwQQdP/aF5V3tUZcmfk8F27qH993t7h4BrMugIW5AT9Br?= =?us-ascii?Q?Zlx9nYVB9/9We10DIy2yEMiUjgPLSvkXjdoNjb88zZpw7ypVMn3kdIk+jqVg?= =?us-ascii?Q?/yMf95IgZ2oYg9CtNmylMdpjK0UnXgkRDKwlDibaSRsUzwa4xOYhF52AQ7hH?= =?us-ascii?Q?evQinH/H7egynk8Jti1lN10e47D9sOA09SZESLhGipjs0V+SusbzK/bfxpo1?= =?us-ascii?Q?5MAD7qi+mBmUZhc9qjnxz6NBCjNBvL2VEPp7CCARZSF61Odb/TP99j+DmRnJ?= =?us-ascii?Q?LrLJyR24HTQE0eaGeI1QBNoDZCX5FsIlPbMOPiAcCRlpZDFhqqwcRnj5cP8C?= =?us-ascii?Q?/1D/i9xpSPS7SGL1pOuw7V0n5mFHMiwnCuqoIzDk8OHjGnvCEFwMu92+aiXR?= =?us-ascii?Q?KU+a4E9kQMyZqUIE+vx6+83UHvSoi5BXtWzCPHAXiSUs3s4EcN0dx1RK7RVV?= =?us-ascii?Q?tLsN8MiFobzLWMne/+Wn/aEMUzKjUMvEEvib4UPf17Ul88AAtvOWZhb4Cc8k?= =?us-ascii?Q?zxDXjfuO7H2Dj8oQmFDhEahuwXCCIKOPmTKBAJluVwanq13/huugZLCHZdxV?= =?us-ascii?Q?VR9Yq7WNw/reoFoKU3ZRJAVEkZ206iBorpf56rGsU51Iwi2rPk6Ne3k67QVB?= =?us-ascii?Q?5TU0rXtKCJhcCOKjdkK2ffH7ZFG7nUyEoYUJ3G/hkv0qhzZbpZ5CS04ynzgp?= =?us-ascii?Q?Dy+NjD/7N7COBma9rlYJ7Dz4+Wldx75suAi7NgPwDgWXxIQ8h7ba9cSbvzJA?= =?us-ascii?Q?qpjDiXITNGfaQOdMJZP0rXJ7VOq9FtJC1Y/CwfJmrA/36r7uaKezPl2jdybm?= =?us-ascii?Q?vJUEr4RzK8WlEzTpzd4ORcy6QF1kW5aeSy6YvqAP6qQiODcyfy?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB616; 5:N/OHkt00GYsRDF67kImWbP97XX58QLTTt7X1cVhNEASGQD/xNSXv2LTrhle2J25yrSU4t7R4/UQCbzad8k1PohW5j117GmkaJ4mWG7E/otLM75zcKcDexZaW1c60jgBE9yQw4l4tdxc3Ar79D2RbVQ==; 24:cwL0Upds0j9OA6rDqy1yD53UeahusGE+FIgnBNp1CWq+iwLbsXECnwd2ZyrNbNBJerF1opSAsLV9od1UxPgqPse6AX/fCjil2ai2swWS2yE=; 20:oq1KF2RHDjXFA32a32tPeSyYaX1Qhky66iLLId00NMp5kIitorcP85Mt7d7dHZbOWhGAejAx1v2drYOul7X8Mw== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2015 22:15:39.3643 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB616 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Andrew Pinski Signed-off-by: Philipp Tomsich Signed-off-by: Christoph Muellner Signed-off-by: Yury Norov diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index faad6df..f40c51b 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -166,10 +166,13 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm, #define COMPAT_ELF_ET_DYN_BASE (2 * TASK_SIZE_32 / 3) + +#ifdef CONFIG_AARCH32_EL0 + /* AArch32 registers. */ -#define COMPAT_ELF_NGREG 18 +#define COMPAT_A32_ELF_NGREG 18 typedef unsigned int compat_elf_greg_t; -typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; +typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_A32_ELF_NGREG]; /* AArch32 EABI. */ #define EF_ARM_EABI_MASK 0xff000000 @@ -179,11 +182,25 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG]; #define compat_start_thread compat_start_thread #define COMPAT_SET_PERSONALITY(ex) set_thread_flag(TIF_32BIT); #define COMPAT_ARCH_DLINFO + + extern int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp); #define compat_arch_setup_additional_pages \ aarch32_setup_vectors_page +#else + +typedef elf_greg_t compat_elf_greg_t; +typedef elf_gregset_t compat_elf_gregset_t; +#define compat_a32_elf_check_arch(x) 0 +#define COMPAT_SET_PERSONALITY(ex) +#define COMPAT_ARCH_DLINFO + +#endif + +#define compat_elf_check_arch(x) compat_a32_elf_check_arch(x) + #endif /* CONFIG_COMPAT */ #endif diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 50f559f..63b19f1 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -52,7 +52,7 @@ struct fpsimd_partial_state { }; -#if defined(__KERNEL__) && defined(CONFIG_COMPAT) +#if defined(__KERNEL__) && defined(CONFIG_AARCH32_EL0) /* Masks for extracting the FPSR and FPCR from the FPSCR */ #define VFP_FPSCR_STAT_MASK 0xf800009f #define VFP_FPSCR_CTRL_MASK 0x07f79f00 diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 536274e..1059b3f 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h @@ -120,7 +120,7 @@ struct pt_regs { #define arch_has_single_step() (1) -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #define compat_thumb_mode(regs) \ (((regs)->pstate & COMPAT_PSR_T_BIT)) #else diff --git a/arch/arm64/include/asm/signal32.h b/arch/arm64/include/asm/signal32.h index eeaa975..4302909 100644 --- a/arch/arm64/include/asm/signal32.h +++ b/arch/arm64/include/asm/signal32.h @@ -20,6 +20,7 @@ #ifdef CONFIG_COMPAT #include +#ifdef CONFIG_AARCH32_EL0 #define AARCH32_KERN_SIGRET_CODE_OFFSET 0x500 extern const compat_ulong_t aarch32_sigret_code[6]; @@ -47,6 +48,7 @@ static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t static inline void compat_setup_restart_syscall(struct pt_regs *regs) { } +#endif /* CONFIG_AARCH32_EL0 */ #endif /* CONFIG_COMPAT */ #endif /* __KERNEL__ */ #endif /* __ASM_SIGNAL32_H */ diff --git a/arch/arm64/include/asm/stat.h b/arch/arm64/include/asm/stat.h index 15e3559..af04276 100644 --- a/arch/arm64/include/asm/stat.h +++ b/arch/arm64/include/asm/stat.h @@ -22,6 +22,7 @@ #include +#ifdef CONFIG_AARCH32_EL0 /* * struct stat64 is needed for compat tasks only. Its definition is different * from the generic struct stat64. @@ -59,3 +60,4 @@ struct stat64 { #endif #endif +#endif diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index 3bc498c..759c433 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #define __ARCH_WANT_COMPAT_SYS_GETDENTS64 #define __ARCH_WANT_COMPAT_STAT64 #define __ARCH_WANT_SYS_GETHOSTNAME @@ -26,7 +26,9 @@ #define __ARCH_WANT_COMPAT_SYS_SENDFILE #define __ARCH_WANT_SYS_FORK #define __ARCH_WANT_SYS_VFORK +#endif +#ifdef CONFIG_COMPAT /* * Compat syscall numbers used by the AArch64 kernel. */ diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 22dc9bc..1470332 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -20,7 +20,7 @@ arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ cpufeature.o alternative.o cacheinfo.o \ smp.o smp_spin_table.o topology.o -arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ +arm64-obj-$(CONFIG_AARCH32_EL0) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o \ ../../arm/kernel/opcodes.o arm64-obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 8d89cf8..e3bcf77 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -51,7 +51,7 @@ int main(void) DEFINE(S_X7, offsetof(struct pt_regs, regs[7])); DEFINE(S_LR, offsetof(struct pt_regs, regs[30])); DEFINE(S_SP, offsetof(struct pt_regs, sp)); -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 DEFINE(S_COMPAT_SP, offsetof(struct pt_regs, compat_sp)); #endif DEFINE(S_PSTATE, offsetof(struct pt_regs, pstate)); diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 4306c93..52be5c8 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -212,7 +212,7 @@ ENTRY(vectors) ventry el0_fiq_invalid // FIQ 64-bit EL0 ventry el0_error_invalid // Error 64-bit EL0 -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 ventry el0_sync_compat // Synchronous 32-bit EL0 ventry el0_irq_compat // IRQ 32-bit EL0 ventry el0_fiq_invalid_compat // FIQ 32-bit EL0 @@ -252,7 +252,7 @@ el0_error_invalid: inv_entry 0, BAD_ERROR ENDPROC(el0_error_invalid) -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 el0_fiq_invalid_compat: inv_entry 0, BAD_FIQ, 32 ENDPROC(el0_fiq_invalid_compat) @@ -414,7 +414,7 @@ el0_sync: b.ge el0_dbg b el0_inv -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 .align 6 el0_sync_compat: kernel_entry 0, 32 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 90d09ed..d11d0b2 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -519,7 +519,7 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems mov x0, #0x33ff msr cptr_el2, x0 // Disable copro. traps to EL2 -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 msr hstr_el2, xzr // Disable CP15 traps to EL2 #endif diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 1971f49..04b4972 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -76,7 +76,7 @@ static void ptrace_hbptriggered(struct perf_event *bp, .si_addr = (void __user *)(bkpt->trigger), }; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 int i; if (!is_compat_task()) @@ -651,7 +651,7 @@ static const struct user_regset_view user_aarch64_view = { .regsets = aarch64_regsets, .n = ARRAY_SIZE(aarch64_regsets) }; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 #include enum compat_regset { @@ -853,7 +853,7 @@ static int compat_tls_set(struct task_struct *target, static const struct user_regset aarch32_regsets[] = { [REGSET_COMPAT_GPR] = { .core_note_type = NT_PRSTATUS, - .n = COMPAT_ELF_NGREG, + .n = COMPAT_A32_ELF_NGREG, .size = sizeof(compat_elf_greg_t), .align = sizeof(compat_elf_greg_t), .get = compat_gpr_get, @@ -1109,8 +1109,8 @@ 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, - compat_ulong_t caddr, compat_ulong_t cdata) +long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) { unsigned long addr = caddr; unsigned long data = cdata; @@ -1186,11 +1186,28 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, return ret; } -#endif /* CONFIG_COMPAT */ +#else /* !CONFIG_AARCH32_EL0 */ +long compat_a32_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + return -1; +} +#endif /* !CONFIG_AARCH32_EL0 */ + +#ifdef CONFIG_COMPAT +long compat_arch_ptrace(struct task_struct *child, compat_long_t request, + compat_ulong_t caddr, compat_ulong_t cdata) +{ + if (is_compat_task()) + return compat_a32_arch_ptrace(child, request, caddr, cdata); + return compat_ptrace_request(child, request, caddr, cdata); +} +#endif + const struct user_regset_view *task_user_regset_view(struct task_struct *task) { -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 /* * Core dumping of 32-bit tasks or compat ptrace requests must use the * user_aarch32_view compatible with arm32. Native ptrace requests on diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index e18c48c..964a2a4 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -414,3 +414,18 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, fpsimd_restore_current_state(); } + +/* + * Some functions are needed for compat ptrace but we don't define + * them if we don't have AARCH32 support compiled in + */ +#if defined CONFIG_COMPAT && !defined CONFIG_AARCH32_EL0 +int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from) +{ + return -EFAULT; +} +int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) +{ + return -EFAULT; +} +#endif diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index f93aae5..9ce9894 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -363,7 +363,7 @@ long compat_arm_syscall(struct pt_regs *regs); asmlinkage long do_ni_syscall(struct pt_regs *regs) { -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 long ret; if (is_compat_task()) { ret = compat_arm_syscall(regs); diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 97bc68f..26352a6 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -49,7 +49,7 @@ static union { } vdso_data_store __page_aligned_data; struct vdso_data *vdso_data = &vdso_data_store.data; -#ifdef CONFIG_COMPAT +#ifdef CONFIG_AARCH32_EL0 /* * Create and map the vectors page for AArch32 tasks. */ @@ -107,7 +107,7 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp) return PTR_ERR_OR_ZERO(ret); } -#endif /* CONFIG_COMPAT */ +#endif /* CONFIG_AARCH32_EL0 */ static struct vm_special_mapping vdso_spec[2];