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 B52E3C43387 for ; Mon, 7 Jan 2019 09:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78EB42070C for ; Mon, 7 Jan 2019 09:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546853989; bh=UOD0A/C/Z9o9KuZD+sOUtOr3QFUKIjw7cllTyvA+dco=; h=Subject:To:Cc:From:Date:List-ID:From; b=kattH+YFcECCt2qtbfnbmCG0hTOgyCdAd0+5b7+74/ibpotxmKALzOVU/aBYKIcxf TU/NdnZOw90bxgD1CM0w/svLjJctxvqaLZobg4zQyBtALkxP7Y46ygA853binmbBIZ WyWnDVvEUx9ockcMBOAFxYJyNwdTcYYg8yOUuLpQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726673AbfAGJjs (ORCPT ); Mon, 7 Jan 2019 04:39:48 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:60695 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbfAGJjs (ORCPT ); Mon, 7 Jan 2019 04:39:48 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9CD0A2153B; Mon, 7 Jan 2019 04:39:47 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 07 Jan 2019 04:39:47 -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=Jx8J7E YXPh53CZJP/TuUhC/UT38Ex7bWOl8Vk22z4/c=; b=RRW2Qu4rOG48gu9ii/5Boe sKk/HVMYnbcgHEX+kuMQZLZIwBhCrtBX7HYD16XkBxC1fU4HOxIA+bAfZfmVSGtu rOiENvdykj9DJX83JQkmAH6g06sqpox/aif99qaRt++e5LmcHC8j+/Sqr9C0vDzf j63PAYJyr4I109hUlRqtirMK37vH07+An5dXZlrXJoalb2eltD8u8DGTUzhYx+iz vNlqAJ2ho2bFCnRla2lzCoU8HIfMCf37wkZtYkAr/9O8OESi2L9Dl8FlzfLTM/L0 9P3FFv2emRzfPxM9o/1/h/AF8KIu7gHeAY+vitI7AmeWjZmYaIq+PnQgFQu6XMMw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrvdejgddtgeculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepfe 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 F1D4FE453B; Mon, 7 Jan 2019 04:39:46 -0500 (EST) Subject: FAILED: patch "[PATCH] arm64: compat: Avoid sending SIGILL for unallocated syscall" failed to apply to 4.9-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:45 +0100 Message-ID: <154685398511341@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.9-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; }