From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 A76ECC4727D for ; Fri, 25 Sep 2020 15:31:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D2A6620878 for ; Fri, 25 Sep 2020 15:30:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D2A6620878 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5D8686B0098; Fri, 25 Sep 2020 11:30:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5626B6B0099; Fri, 25 Sep 2020 11:30:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42A9F6B009A; Fri, 25 Sep 2020 11:30:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id 25DB06B0098 for ; Fri, 25 Sep 2020 11:30:59 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D96702489 for ; Fri, 25 Sep 2020 15:30:58 +0000 (UTC) X-FDA: 77301971796.15.jeans96_1c1043527168 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 97D7E1814B0C8 for ; Fri, 25 Sep 2020 15:30:58 +0000 (UTC) X-HE-Tag: jeans96_1c1043527168 X-Filterd-Recvd-Size: 8045 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 25 Sep 2020 15:30:57 +0000 (UTC) Received: from mail-qk1-f172.google.com ([209.85.222.172]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MXXZf-1jwMs315xf-00YxUE for ; Fri, 25 Sep 2020 17:30:56 +0200 Received: by mail-qk1-f172.google.com with SMTP id t138so3188228qka.0 for ; Fri, 25 Sep 2020 08:30:55 -0700 (PDT) X-Gm-Message-State: AOAM530riRD+OwaR9OfKKAHh8+qbZyPhboE7UpyysVaIE3rwg3oG3Hyf r2RbjuACeqGe8hBdU6WgQA/t7Mf2C/lQM/d+mAs= X-Google-Smtp-Source: ABdhPJwViFuhR693mJsi/dMIOSfPt325VJh7VG9UX6ruHa7SF+GVqx2YpXQOMKPH5JMPhgn7i6oNEU0/IDo4ojtcxQA= X-Received: by 2002:a37:a483:: with SMTP id n125mr521612qke.286.1601047854526; Fri, 25 Sep 2020 08:30:54 -0700 (PDT) MIME-Version: 1.0 References: <20200918124624.1469673-1-arnd@arndb.de> <20200919081906.GV1551@shell.armlinux.org.uk> In-Reply-To: From: Arnd Bergmann Date: Fri, 25 Sep 2020 17:30:38 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/9] ARM: remove set_fs callers and implementation To: Russell King - ARM Linux admin Cc: Christoph Hellwig , Alexander Viro , "linux-kernel@vger.kernel.org" , Linux ARM , linux-arch , Linux-MM Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:hM3KQ0BI2Sr8Jkqc0KxzNRPGmoEtJ7QRYcBAT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ic6XXoMH6xspdF5/lov4Ui3N7lll3xDKHJ xvk7jRV6eGqPMriw1GE7MQ2chLUz9rvgtqEG35QnvmaUb17D9dZCiDC8idyeIFxryNCgl2Ib7 42uiPxFwn5jciqeQPB8IaBg2RhLkZ1wp9lCl9KF5GihcdM47/K38x X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 25, 2020 at 4:08 PM Arnd Bergmann wrote: > On Sat, Sep 19, 2020 at 10:19 AM Russell King - ARM Linux admin > wrote: > > > > On Fri, Sep 18, 2020 at 02:46:15PM +0200, Arnd Bergmann wrote: > > > Hi Christoph, Russell, > > > > > > Here is an updated series for removing set_fs() from arch/arm, > > > based on the previous feedback. > > > > > > I have tested the oabi-compat changes using the LTP tests for the three > > > modified syscalls using an Armv7 kernel and a Debian 5 OABI user space, > > > and I have lightly tested the get_kernel_nofault infrastructure by > > > loading the test_lockup.ko module after setting CONFIG_DEBUG_SPINLOCK. > > > > I'm not too keen on always saving the syscall number, but for the gain > > of getting rid of set_fs() I think it's worth it. However... > > > > I think there are some things to check - what value do you end up > > with as the first number in /proc/self/syscall when you do: > > > > strace cat /proc/self/syscall > > > > ? > > > It should be 3, not 0x900003. I suspect you're getting the latter > > with these changes. IIRC, task_thread_info(task)->syscall needs to > > be the value _without_ the offset, otherwise tracing will break. > > It seems broken in different ways, depending on the combination > of kernel and userland: > > 1. EABI armv5-versatile kernel, EABI Debian 5: > $ cat /proc/self/syscall > 0 0x1500000000003 0x1500000000400 0x1500000000400 0x60000013c7800480 > 0xc0008668c0112f8c 0xc0112d14c68e1f68 0xbeab06f8 0xb6e80d4c > $ strace -f cat /proc/self/syscall > execve("/bin/cat", ["cat", "/proc/self/syscall"], [/* 16 vars */]) = > -1 EINTR (Interrupted system call) > dup(2) = -1 EINTR (Interrupted system call) > write(2, "strace: exec: Interrupted system "..., 38) = -1 EINTR > (Interrupted system call) > exit_group(1) = ? Both the missing number and the broken strace are fixed with diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 610e32273c81..2c0bde14fba6 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -226,7 +226,8 @@ ENTRY(vector_swi) * get the old ABI syscall table address. */ bics r10, r10, #0xff000000 - str r10, [tsk, #TI_SYSCALL] + strne r10, [tsk, #TI_SYSCALL] + streq scno, [tsk, #TI_SYSCALL] eorne scno, r10, #__NR_OABI_SYSCALL_BASE ldrne tbl, =sys_oabi_call_table #elif !defined(CONFIG_AEABI) It was already working with CONFIG_AEABI=y and CONFIG_OABI_COMPAT=n > 2. EABI kernel, OABI Debian 5: > $ cat /proc/self/syscall > 3 0x1500000000003 0x13ccc00000400 0x1500000000400 0x60000013c7800480 > 0xc0008de0c0112f8c 0xc0112d14c7313f68 0xbeed27d0 0xb6eab324 > $ strace cat /proc/self/syscall > execve("/bin/cat", ["cat", "/proc/self/syscall"], [/* 16 vars */]) = -1090648236 > --- SIGILL (Illegal instruction) @ 0 (0) --- > +++ killed by SIGILL +++ This was caused by me after all, here is my fix: --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -25,6 +25,7 @@ #include #include +#include #include #define CREATE_TRACE_POINTS @@ -898,11 +899,11 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs) return -1; #else /* XXX: remove this once OABI gets fixed */ - secure_computing_strict(current_thread_info()->syscall); + secure_computing_strict(syscall_get_nr(current, regs)); #endif /* Tracer or seccomp may have changed syscall. */ - scno = current_thread_info()->syscall; + scno = syscall_get_nr(current, regs); if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) trace_sys_enter(regs, scno); > 3. OABI kernel, OABI Debian 5: > cat /proc/self/syscall > 9437187 0x1500000000003 0x13ccc00000400 0x1500000000400 0x100060000013 > 0x15000c72cff6c 0xc72cfe9000000000 0xbece27d0 0xb6f2f324 This one is fixed by --- a/arch/arm/include/asm/syscall.h +++ b/arch/arm/include/asm/syscall.h @@ -22,7 +22,7 @@ extern const unsigned long sys_call_table[]; static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { - if (!IS_ENABLED(CONFIG_OABI_COMPAT)) + if (IS_ENABLED(CONFIG_AEABI) && !IS_ENABLED(CONFIG_OABI_COMPAT)) return task_thread_info(task)->syscall; return task_thread_info(task)->syscall & ~__NR_OABI_SYSCALL_BASE; I'll send an updated patch once I've addressed Christoph's comments. Arnd