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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 08EDCC432C3 for ; Fri, 22 Nov 2019 10:54:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4AC620706 for ; Fri, 22 Nov 2019 10:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420081; bh=FQxdcPlHeuxk12YE2UCy2y47gJFvSt793ga4V9vyrog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MRKlPiHakP/3uA8L4ZhWlv7RFDKIw0fYjFcnvAG6wHSzLSL9GVswl4NK4iGazJBnC 2PlPNGPqz7ieyugrM9QTYU/DUB0nG78pwvX8VCivC81Gz85rQYl5RFL6X3iKYD60yW WE+QPcurwhmkD/CC+AQTXf17Z737zMf81S9FzhI8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730360AbfKVKyk (ORCPT ); Fri, 22 Nov 2019 05:54:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:40414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730351AbfKVKyh (ORCPT ); Fri, 22 Nov 2019 05:54:37 -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 EF87C2072E; Fri, 22 Nov 2019 10:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420077; bh=FQxdcPlHeuxk12YE2UCy2y47gJFvSt793ga4V9vyrog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x3+BwOdxuGyUysXRzVx33hVmo7SS3uTx6WnbZT+saHih6IJWkoVOvKLWZDmSFWTwu xDWDp2pakjy4ymzd58Bnke7byunbt5l+Q8Ysw3SHoKMmdjuTUJgwv230QKq2KPovzF +3fzUY+q2tZTINCm1sNCggdlp8m8hW8j2RdEHKM8= 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.14 107/122] ARM: 8802/1: Call syscall_trace_exit even when system call skipped Date: Fri, 22 Nov 2019 11:29:20 +0100 Message-Id: <20191122100833.086512348@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100722.177052205@linuxfoundation.org> References: <20191122100722.177052205@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index d7dc808a3d154..08a7132f56006 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -282,16 +282,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 -- 2.20.1