From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758674AbcEFMG2 (ORCPT ); Fri, 6 May 2016 08:06:28 -0400 Received: from szxga05-in.huawei.com ([119.145.14.199]:27359 "EHLO szxga05-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1758303AbcEFMG0 (ORCPT ); Fri, 6 May 2016 08:06:26 -0400 Subject: Re: [PATCH 15/25] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) To: Yury Norov , , , , References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> <1459894127-17698-16-git-send-email-ynorov@caviumnetworks.com> CC: , , , , , , , , , , , , , , Philipp Tomsich , Andrew Pinski , Hanjun Guo , "Zhangjian (Bamvor)" From: "Zhangjian (Bamvor)" Message-ID: <572C87CC.4090709@huawei.com> Date: Fri, 6 May 2016 20:02:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1459894127-17698-16-git-send-email-ynorov@caviumnetworks.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.72.170] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.572C87E5.0331,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c4cae282c253a5d5b57f3a8f236e6748 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2016/4/6 6:08, Yury Norov wrote: > Based on patch of Andrew Pinski. > > This patch introduces is_a32_compat_task and is_a32_thread so it is > easier to say this is a a32 specific thread or a generic compat thread/task. > Corresponding functions are located in to avoid mess in > headers. > > Some files include both and , > and this is wrong because has already > included. It was fixed too. 1. in "kernel/seccomp.c" There are different list for a32 and LP64. I do not know we should add a new one or align to one of them. Currently, we align ilp32 to a32 list. ``` /* * Secure computing mode 1 allows only read/write/exit/sigreturn. * To be fully secure this must be combined with rlimit * to limit the stack allocations too. */ static int mode1_syscalls[] = { __NR_seccomp_read, __NR_seccomp_write, __NR_seccomp_exit, __NR_seccomp_sigreturn, 0, /* null terminated */ }; #ifdef CONFIG_COMPAT static int mode1_syscalls_32[] = { __NR_seccomp_read_32, __NR_seccomp_write_32, __NR_seccomp_exit_32, __NR_seccomp_sigreturn_32, 0, /* null terminated */ }; #endif static void __secure_computing_strict(int this_syscall) { int *syscall_whitelist = mode1_syscalls; #ifdef CONFIG_COMPAT if (in_compat_syscall()) syscall_whitelist = mode1_syscalls_32; #endif ``` 2. in "kernel/auditsc.c" __audit_seccomp will print if compat or not. But in the same file, it call syscall_get_arch() to get the architecture in which ILP32 is same as LP64. And consequenly, do we need to split in_compat_syscall to in_a32_compat_syscall and in_ilp32 compat_syscall? ``` void __audit_seccomp(unsigned long syscall, long signr, int code) { struct audit_buffer *ab; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP); if (unlikely(!ab)) return; audit_log_task(ab); audit_log_format(ab, " sig=%ld arch=%x syscall=%ld compat=%d ip=0x%lx code=0x%x", signr, syscall_get_arch(), syscall, in_compat_syscall(), KSTK_EIP(current), code); audit_log_end(ab); } ``` Thanks Bamvor