From patchwork Wed Jul 19 17:58:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9852919 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5238B60393 for ; Wed, 19 Jul 2017 17:59:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 593DD286CB for ; Wed, 19 Jul 2017 17:59:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E149286CF; Wed, 19 Jul 2017 17:59:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 77BA6286CB for ; Wed, 19 Jul 2017 17:59:39 +0000 (UTC) Received: (qmail 19811 invoked by uid 550); 19 Jul 2017 17:59:31 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 19720 invoked from network); 19 Jul 2017 17:59:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UtRmaJlOpL4Kvxiq49KR8w5Z9hT2bfOw5Mex35eP/Ts=; b=f3dwMNBYvR6RgfTGVLgOSZpx643QB4HiDB/5JSibLBdqhq2QVtBt/VWHZnOCSU6BJa bur2GUxX/xdJ3C/nJmn/mgTSqQJBrTLdZ7Bc6TDw4G6znLqk68R6t5cAMLKZaPscZXeo xJ448/eeiGcVLxXo68qKtWcGaGFwRDkaldqRsa5sduAqQGYXBk8u1vJBVvm6//uiG4Lq iPZf+a7x+f7GnL0QmoWP73gZjHZGgDqP8DM3VUhpjM4GQs51MFVlz05LNdzC3M8Vuh/C ZhTrLdNmh+pvv4xarI3qR12mrfQEaXchy6Vm7ZCwSUyOIAipBSyOCMWQT/Tm4K2NBNoO jXrA== 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:in-reply-to :references; bh=UtRmaJlOpL4Kvxiq49KR8w5Z9hT2bfOw5Mex35eP/Ts=; b=Od7JHJ4ZXjYq3mUn9qFYxQKlCCSCqpaXeLax/Na7oKhx1KVEvHzIWh+8mSbcdfnFkE nxdeHelTCe6GkI/TbUJhiD1WewQd5yLwnwlpnfUfIfYm2wbYX9a6EwMo8zXPkfLMguIs k3NNdKtH0BnoEvqfZ0x6XzrHHCraHKTAnAuQ33vuVLS7SH2tlLwiUoAt/iUTgMmKZs6a TgREECTsPAJdli3zNAA3XG50N5Wc6ayNVC0j3kdr2cNzHHT3NBk7b6wTDQNjjOOwd5NA 5ATlYW3tOZgfHhc+ATv7e19kz5Lrij+uZ2UkGg6QpkFy30jVtfi8CD11x7kpDGy+zfIS oZiw== X-Gm-Message-State: AIVw110Nf3bR2kknIqvI1ulnZ0SfyptGp6OT3jw7lJ0koW2sV4Z4UqsN 65WrmFFpg6WJixrI X-Received: by 10.84.215.144 with SMTP id l16mr942156pli.381.1500487158300; Wed, 19 Jul 2017 10:59:18 -0700 (PDT) From: Thomas Garnier To: Russell King , Thomas Garnier , Thomas Gleixner , Catalin Marinas , Will Deacon , Dave Martin , Chris Metcalf , Pratyush Anand , leonard.crestez@nxp.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Date: Wed, 19 Jul 2017 10:58:59 -0700 Message-Id: <20170719175900.124074-2-thgarnie@google.com> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog In-Reply-To: <20170719175900.124074-1-thgarnie@google.com> References: <20170719175900.124074-1-thgarnie@google.com> Subject: [kernel-hardening] [PATCH 2/3] arm/syscalls: Optimize work flags assembly check X-Virus-Scanned: ClamAV using ClamSMTP Remove the double branch and use tsteq instead. Suggested-by: Russell King Signed-off-by: Thomas Garnier --- arch/arm/kernel/entry-common.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index e33c32d56193..6e094b639d83 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -42,8 +42,7 @@ ret_fast_syscall: disable_irq_notrace @ disable interrupts ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing tst r1, #_TIF_SYSCALL_WORK - bne fast_work_pending - tst r1, #_TIF_WORK_MASK + tsteq r1, #_TIF_WORK_MASK bne fast_work_pending /* perform architecture specific actions before user return */ @@ -70,14 +69,12 @@ ret_fast_syscall: disable_irq_notrace @ disable interrupts ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing tst r1, #_TIF_SYSCALL_WORK - bne fast_work_pending - tst r1, #_TIF_WORK_MASK + tsteq r1, #_TIF_WORK_MASK beq no_work_pending UNWIND(.fnend ) ENDPROC(ret_fast_syscall) /* Slower path - fall through to work_pending */ -fast_work_pending: #endif tst r1, #_TIF_SYSCALL_WORK