From patchwork Mon Nov 26 22:53:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael David Tinoco X-Patchwork-Id: 152094 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp478696ljp; Mon, 26 Nov 2018 14:53:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtMkLeq07DkDjxwkxjC2RW/3D3A47uJhxBdW/1lOtVh86CpyJzwNu2WMYcsr2mLrkpNIHN X-Received: by 2002:a63:d655:: with SMTP id d21mr26812563pgj.280.1543272824617; Mon, 26 Nov 2018 14:53:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543272824; cv=none; d=google.com; s=arc-20160816; b=NN+oiy7JacDOmDv/6VsQ1Z9SHwD4ur/6An0q6rv6cNGm4ToVldpgXs2ZE6TexBfw12 9Kn+Qw77wjT8v7QqgtIS3yiJDFT6876017SOfdMfcyMfKyo40wtlG8x9wU/ScuqawKb2 J/GxHegwh/sk90jq3DiYDd+/i86z8GIFNkAp3bjYjac3SAAhtASHXPTK03bGXdAE9/60 3dj/5y8JYynxC2Hk+QV6Ml8dLaVwf+fHyvLSlf9gPRH2GPvpUDB/Aq21LMl+fbR936oO ZVcvoUz20RdCa2yFvCaULHXhxKY/YT0retfJGNNBKNRXu6MH42GT9GYE3UZTJCVW159W UvmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iNXQazqtwLAEPT7yGKdIR+2AxZuQpxFBdO6FmYo9ZiY=; b=NJx+iviCxL8HijGespUI6hgylTuH8jkDvNn100d6L8m0Ck4YZBTlfluT1ET2bbepuS FiA+hsAdT5bPO3WAvbd2Dc3VFCbksNPDe10YC9bge31H1U5+bjFez6RMwWBji/vJee+4 AOsj3NOp9yL7W4olahSIT+ajgW1VJi1C1ahergEQWQNIL1FOuq7Z/kv6DRd7ML5SLlqy wNFtQ6gYIdHsi3/qZFa7Q8uo/uYRa9v3InEhB8ZGPF60dDW6fRGepqu8wfP4kxVe9B8Q dZnvZVS2BSzBb0FN/OA+sf+vjKCzL63l/x7G6VZL21Jzk6199QcDS/TY/8bvTcC2UMA4 lXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LQR5kBI0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l184si1506861pgd.523.2018.11.26.14.53.44; Mon, 26 Nov 2018 14:53:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LQR5kBI0; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727483AbeK0JtY (ORCPT + 15 others); Tue, 27 Nov 2018 04:49:24 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33215 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbeK0JtY (ORCPT ); Tue, 27 Nov 2018 04:49:24 -0500 Received: by mail-qk1-f194.google.com with SMTP id o89so13492526qko.0 for ; Mon, 26 Nov 2018 14:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iNXQazqtwLAEPT7yGKdIR+2AxZuQpxFBdO6FmYo9ZiY=; b=LQR5kBI0fEDyzPLjKGlv5mlhPpaSghZStSEUcPoPH231GBF3swKb081AKSCQ78ADEh JRbJGAg3GXxUWfV/k14a5eylCR3gG8ft0nltQsNenjTxt7k/JkkWDDfwwpfIGB6iVc/n PxJd8vn8zNaOJFQXkLuOSIpbvFYMfK5I393zM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iNXQazqtwLAEPT7yGKdIR+2AxZuQpxFBdO6FmYo9ZiY=; b=cDKm6j+9kgfEZmlR64q5EQXpnhlg04tIqiBhjUfKAIjFd5vV3Y79bfaBQmI+fRRsVY 3XyRm/tSq40W4yd5KIZSckwc8SLFafz6tnl6wmSK7X3Gr7/+RDVnBWvAeXp9wr0/Le9a K3mzj+nIocjMwvTt/pSC+0VvfSbfvRTp69w9pizXnJTB3fWfSH8BeyhuZFlAKHNLW5xT UwpR6U1eKxkOa7vM7g2Wn/TUmgXz5am5oj6GhkUj93UwgJsgXjaYvuIaSH9Ll6g6+H3D eTrV6kBbIAZDiLFDD5UerD5cYOeqGs9h7iNwYPZ5SRJimXmSxEa3mZ9PXGgCwuwKouwY ONxA== X-Gm-Message-State: AA+aEWZyQcs3pzv/xnvZZ918difruidTyJE+SnBsu2h/kmSXttyaYq6N QaxhaT6lpf4EjSsdfO+/zJrbyw== X-Received: by 2002:a37:4792:: with SMTP id u140mr28058241qka.301.1543272821113; Mon, 26 Nov 2018 14:53:41 -0800 (PST) Received: from workstation.celeiro.br ([138.204.25.29]) by smtp.gmail.com with ESMTPSA id h25sm1337681qtc.49.2018.11.26.14.53.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 14:53:40 -0800 (PST) From: Rafael David Tinoco To: Russell King Cc: Vladimir Murzin , Rafael David Tinoco , Nick Desaulniers , Masahiro Yamada , Thomas Gleixner , Mathieu Desnoyers , Vincent Whitchurch , Timothy E Baldwin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] arm: always update thread_info->syscall Date: Mon, 26 Nov 2018 20:53:35 -0200 Message-Id: <20181126225335.10477-1-rafael.tinoco@linaro.org> X-Mailer: git-send-email 2.20.0.rc1 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Right now, only way for task->thread_info->syscall to be updated is if if _TIF_SYSCALL_WORK is set in current's task thread_info->flags (similar to what has_syscall_work() checks for arm64). This means that "->syscall" will only be updated if we are tracing the syscalls through ptrace, for example. This is NOT the same behavior as arm64, when pt_regs->syscallno is updated in the beginning of svc0 handler for *every* syscall entry. This patch fixes the issue since this behavior is needed for /proc//syscall 1st argument to be correctly updated. Link: https://bugs.linaro.org/show_bug.cgi?id=3783 Cc: # v4.4 v4.9 v4.14 v4.19 Signed-off-by: Rafael David Tinoco --- arch/arm/kernel/asm-offsets.c | 1 + arch/arm/kernel/entry-common.S | 2 ++ 2 files changed, 3 insertions(+) -- 2.20.0.rc1 diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 3968d6c22455..bfe68a98e1c6 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -64,6 +64,7 @@ int main(void) DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp)); DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value)); DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate)); + DEFINE(TI_SYSCALL, offsetof(struct thread_info, syscall)); #ifdef CONFIG_VFP DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate)); #ifdef CONFIG_SMP diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 0465d65d23de..557e2add4e83 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -257,6 +257,8 @@ local_restart: tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? bne __sys_trace + str r7, [tsk, #TI_SYSCALL] @ update thread_info->syscall + invoke_syscall tbl, scno, r10, __ret_fast_syscall add r1, sp, #S_OFF