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=-11.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 5055DC43444 for ; Mon, 7 Jan 2019 09:39:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20A462070C for ; Mon, 7 Jan 2019 09:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546853986; bh=aYvs3/GpBA7C+PCnb5RRi8G90SOUFDHQ6Gv6l1gFUcM=; h=Subject:To:Cc:From:Date:List-ID:From; b=ZM8vsoRmztEqKug7isVG3oPYupf6/SCNFvw+ajPYWJ8QjHABgngZrda16fdxdtc6S tw9+yCV07q5fo1qWrqufAfYwY88Saw3cy6bHWVu3FIIsy3UsJo3eJk045rR9BAnlmn BslJvXHwi+dRY8EADgq3XAWd4GlOatOhM+RzTvKM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbfAGJjo (ORCPT ); Mon, 7 Jan 2019 04:39:44 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:48769 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbfAGJjo (ORCPT ); Mon, 7 Jan 2019 04:39:44 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8D21922145; Mon, 7 Jan 2019 04:39:43 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 07 Jan 2019 04:39:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=9m0JeT Ge1y1mc+ryyKfqrd1NCngK0fYRfWFrnDsiPw4=; b=HyngPw0vO5BzststQyac3T XWl8Q5vcRT8G7fONFtIgGRwjEZ41DhrdfmeJIGrnvddow+Ze5ugcvv7PHzRMTDKS 5YJEfJdwJAG3AuZgrQsWNkwj+8b62I5/nD9iA5wyqFA9L8L0GTGrMy7APlscHMdZ GRJFZtcuGL8Bycn7x0QjiDiX59W0W/ZSVFCTqcytEvfTn8N3Zyej70ZY4zyWHca8 N4wl6SwiymxS1uK0knpumEJTpHAbbrEhfEW757bIHCFzdqjQn7wZJFn1zngn8gKp Tb+K883EY8RjKm6RPQB0NHkVprwlhu7/7CxpNm0Wq8EGIGefYAy5jvuIYpfVmSww == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrvdejgddtgeculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepvd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id D7D84E464E; Mon, 7 Jan 2019 04:39:42 -0500 (EST) Subject: FAILED: patch "[PATCH] arm64: compat: Avoid sending SIGILL for unallocated syscall" failed to apply to 4.14-stable tree To: will.deacon@arm.com, Dave.Martin@arm.com, pihsun@chromium.org, stable@vger.kernel.org Cc: From: Date: Mon, 07 Jan 2019 10:39:41 +0100 Message-ID: <154685398156120@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 169113ece0f29ebe884a6cfcf57c1ace04d8a36a Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 3 Jan 2019 17:45:07 +0000 Subject: [PATCH] arm64: compat: Avoid sending SIGILL for unallocated syscall numbers The ARM Linux kernel handles the EABI syscall numbers as follows: 0 - NR_SYSCALLS-1 : Invoke syscall via syscall table NR_SYSCALLS - 0xeffff : -ENOSYS (to be allocated in future) 0xf0000 - 0xf07ff : Private syscall or -ENOSYS if not allocated > 0xf07ff : SIGILL Our compat code gets this wrong and ends up sending SIGILL in response to all syscalls greater than NR_SYSCALLS which have a value greater than 0x7ff in the bottom 16 bits. Fix this by defining the end of the ARM private syscall region and checking the syscall number against that directly. Update the comment while we're at it. Cc: Cc: Dave Martin Reported-by: Pi-Hsun Shih Signed-off-by: Will Deacon diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h index b13ca091f833..85d5c1026204 100644 --- a/arch/arm64/include/asm/unistd.h +++ b/arch/arm64/include/asm/unistd.h @@ -40,8 +40,9 @@ * The following SVCs are ARM private. */ #define __ARM_NR_COMPAT_BASE 0x0f0000 -#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) -#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) +#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE + 2) +#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) +#define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) #define __NR_compat_syscalls 399 #endif diff --git a/arch/arm64/kernel/sys_compat.c b/arch/arm64/kernel/sys_compat.c index 32653d156747..a79db4e485a6 100644 --- a/arch/arm64/kernel/sys_compat.c +++ b/arch/arm64/kernel/sys_compat.c @@ -102,12 +102,12 @@ long compat_arm_syscall(struct pt_regs *regs) default: /* - * Calls 9f00xx..9f07ff are defined to return -ENOSYS + * Calls 0xf0xxx..0xf07ff are defined to return -ENOSYS * if not implemented, rather than raising SIGILL. This * way the calling program can gracefully determine whether * a feature is supported. */ - if ((no & 0xffff) <= 0x7ff) + if (no < __ARM_NR_COMPAT_END) return -ENOSYS; break; }