From patchwork Fri Nov 22 10:29:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 180013 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp51012ilf; Fri, 22 Nov 2019 03:04:57 -0800 (PST) X-Google-Smtp-Source: APXvYqw1o1xB0MhjuEtIg9In5cI7p2qoMsie54LPidy2FnEfs0Dmg30wAlXBGK1IR36Nu3rC9ocg X-Received: by 2002:a05:6402:3cf:: with SMTP id t15mr312802edw.21.1574420697587; Fri, 22 Nov 2019 03:04:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420697; cv=none; d=google.com; s=arc-20160816; b=rtB6Vm7nVQgg5dcliO+Gyw0W4YJpAZTAvu+r8HZ2vMrbTCekmA2SBQTl2shdS++N7p MgdrHqKGZ7N9ZMjhgBrhsQ16J028H0jRqaVPnV3XQ9h5akPKFJStP9mSriKpcxdufpH8 qZ5rvw4EYOTtsYHCkK8MrMU8L1ibfJB1Pb+iJQJDYtrRqx/gGqLzGcu6uAWPJ5b4Tro5 F3CgTdB8+s16kKyPFxfOnw5Qq8EDFpdz9yHRhHLaJFy9A3JNpeiV5hxJ14sLTXFyhQNG LzvhrL9ku7JMscciRpnQJRsPCGc7nPQF2sjJR6x65zauH6vJuV56vytVGpoJZkJzI1RP ekhQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QtHw2OKiLuScLgg45ofsvz8NLHuarOWvZ0R7KLBZk8w=; b=nKFjo7GuThQu72dpNStlsEKJBEBTfEu8JsNVOURepRAgp4KZHUHPeiwgPpaHpuEHy0 bYsQeMiQxCpMjFDel+IUNM5Frt17RMMdu5VspwbVCCMYZFsyOfYKvUmIOqo9yw2UGpFN nK5f6rVYjp/wtUZPE9TFJHDMmVpItPXlE/IFkiYH+4Ry/HbwqryTMyn2IaYtKBFtC+yW mNrj8HBl2XZFYeai3IlgT+EhzevH1+Pc9cmikX/zrUnhVa4thHkyPb+NcUYeZJVTpA/N V4tDNW1zIfhD/b8S908B+ahWo3KYWkhd+TVVEGSoFtF8wCNd3O7McOcyBLM+1KJxOahK wQGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j5YJmY1A; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si672188eja.168.2019.11.22.03.04.57; Fri, 22 Nov 2019 03:04:57 -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=@kernel.org header.s=default header.b=j5YJmY1A; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730850AbfKVLEz (ORCPT + 15 others); Fri, 22 Nov 2019 06:04:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:60236 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731623AbfKVLEy (ORCPT ); Fri, 22 Nov 2019 06:04:54 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 551F12075E; Fri, 22 Nov 2019 11:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420693; bh=3vv9mKqjlqzcNlPk2/3YHwP3R4O5k91q1kEKE6OVLRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j5YJmY1ACCrAbzYe6IOfpJxaiRxNsiEKYbN/7Q7uRAgTGklB7EtFBQVGQiIEhZXiX ViB/lkjP/xaQRMSkp6D6yVlLPrs2V9Ht26Htu+MTaoNn5kguh9j9uKFtWDQrZ1NaBU /0vEpdGdk7RkVojlaGQsW9vDraZFZbFOfhsvHX9s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timothy E Baldwin , Eugene Syromyatnikov , Kees Cook , Russell King , Sasha Levin Subject: [PATCH 4.19 194/220] ARM: 8802/1: Call syscall_trace_exit even when system call skipped Date: Fri, 22 Nov 2019 11:29:19 +0100 Message-Id: <20191122100927.998475274@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Timothy E Baldwin [ Upstream commit f18aef742c8fbd68e280dff0a63ba0ca6ee8ad85 ] On at least x86 and ARM64, and as documented in the ptrace man page a skipped system call will still cause a syscall exit ptrace stop. Previous to this commit 32-bit ARM did not, resulting in strace being confused when seccomp skips system calls. This change also impacts programs that use ptrace to skip system calls. Fixes: ad75b51459ae ("ARM: 7579/1: arch/allow a scno of -1 to not cause a SIGILL") Signed-off-by: Timothy E Baldwin Signed-off-by: Eugene Syromyatnikov Reviewed-by: Kees Cook Tested-by: Kees Cook Tested-by: Eugene Syromyatnikov Signed-off-by: Russell King Signed-off-by: Sasha Levin --- arch/arm/kernel/entry-common.S | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 746565a876dcd..0465d65d23de5 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -296,16 +296,15 @@ __sys_trace: cmp scno, #-1 @ skip the syscall? bne 2b add sp, sp, #S_OFF @ restore stack - b ret_slow_syscall -__sys_trace_return: - str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 +__sys_trace_return_nosave: + enable_irq_notrace mov r0, sp bl syscall_trace_exit b ret_slow_syscall -__sys_trace_return_nosave: - enable_irq_notrace +__sys_trace_return: + str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 mov r0, sp bl syscall_trace_exit b ret_slow_syscall