Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp669595ybg; Mon, 1 Jun 2020 11:14:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8e39h3Ls0z8r91szRbCqG8itXOEbJoIwytk+7iFyvVpyj+GQByn5+7cjo5hQbAcfA0l5r X-Received: by 2002:a17:906:5f93:: with SMTP id a19mr18706806eju.10.1591035258844; Mon, 01 Jun 2020 11:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035258; cv=none; d=google.com; s=arc-20160816; b=Nz+fCbMvxq0dpRjXRuuzr+ul7JAqaaIxCDZRmzcgjnmlgyahy/WohD0510yU1cscnc fpaT9QoAlTM2wRfDW6arPaH5/2FFKOYr/mFmPetayzkBgJ370N11+hV//SiIkVAS7klt t7nvMZ5N5ok1ohCggLOcJjh2GgO+ZjvNMg5BiHPZKYkishH+CLd1ahrwvi4vFJWPkYi6 zI/57AzplLbF2EdCXtn/uHEpPhEP/i0qimBhCnR4Y361iugGl1vRKqMFBOxFjV2kjn3X 7GtqJuHmAoXSy9UNTCX1uOUscOPDIari/nq1gI4pKGP547fWT/lpszI2j5XbgGuhacDL oukg== 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=FX0fF+HKX4gaUXnVJfxoE2TTeJeZDClMgUQ0lnu+NpQ=; b=TB6bpSQU8iktAWhNv68eyakJBs9PjDJEukm+/xD5Df6/aD7U4RdKNEb/cLw9FNoJJ0 4uWB+LS/dL4/SHjRF81YRIhVsC0ae7mLLBTezRh0JrAQ2/CHrVHfVpN3x4wiO41v7iU+ D7q4WH+cO172CMeI64fEamMyZRPNrotGeID1GhNGI0JtBQQ8gtSaCoprS/RCjZ7+bgGR yOP1VAzuiE5WxmZw74TUWNMOXS7Irygb+pVgOYJCM608Z3LiJEs7ore6+4SPXuoyr+EM rhnSMg97ippbcWvO25SJzZy+5g6uQCGHbIFiW0XnHJdJXGk8wPw+4iNyko3Eys9ANZ++ MJxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSckfL0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd24si76329edb.336.2020.06.01.11.13.55; Mon, 01 Jun 2020 11:14:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JSckfL0P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731127AbgFASLg (ORCPT + 99 others); Mon, 1 Jun 2020 14:11:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:58626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731097AbgFASL1 (ORCPT ); Mon, 1 Jun 2020 14:11:27 -0400 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 A7BE52065C; Mon, 1 Jun 2020 18:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591035087; bh=b/EUArRdVQdkWs2IhRIZmaWX7WUowYSahHk7SFy+5q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JSckfL0POvKlA/JAIJTwtebov8XxnEBCaptzGkOO33vPQ1ciTHlnzzu8AE+zMYzAb NIyOa8cGl0DrigniN+bbuuseXM4Z37RKFHHO05GHSH7wP0B7SMTycxXSBMLLldUkBq eNw8P0N7nGc5o3q6ew0RyK83QNag2drKN6zA0b4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thorsten Glaser , Andy Lutomirski , Borislav Petkov , stable@kernel.org Subject: [PATCH 5.4 108/142] x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" Date: Mon, 1 Jun 2020 19:54:26 +0200 Message-Id: <20200601174049.134783758@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@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: Andy Lutomirski commit 700d3a5a664df267f01ec8887fd2d8ff98f67e7f upstream. Revert 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long") and add a comment to discourage someone else from making the same mistake again. It turns out that some user code fails to compile if __X32_SYSCALL_BIT is unsigned long. See, for example [1] below. [ bp: Massage and do the same thing in the respective tools/ header. ] Fixes: 45e29d119e99 ("x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long") Reported-by: Thorsten Glaser Signed-off-by: Andy Lutomirski Signed-off-by: Borislav Petkov Cc: stable@kernel.org Link: [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954294 Link: https://lkml.kernel.org/r/92e55442b744a5951fdc9cfee10badd0a5f7f828.1588983892.git.luto@kernel.org Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/uapi/asm/unistd.h | 11 +++++++++-- tools/arch/x86/include/uapi/asm/unistd.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) --- a/arch/x86/include/uapi/asm/unistd.h +++ b/arch/x86/include/uapi/asm/unistd.h @@ -2,8 +2,15 @@ #ifndef _UAPI_ASM_X86_UNISTD_H #define _UAPI_ASM_X86_UNISTD_H -/* x32 syscall flag bit */ -#define __X32_SYSCALL_BIT 0x40000000UL +/* + * x32 syscall flag bit. Some user programs expect syscall NR macros + * and __X32_SYSCALL_BIT to have type int, even though syscall numbers + * are, for practical purposes, unsigned long. + * + * Fortunately, expressions like (nr & ~__X32_SYSCALL_BIT) do the right + * thing regardless. + */ +#define __X32_SYSCALL_BIT 0x40000000 #ifndef __KERNEL__ # ifdef __i386__ --- a/tools/arch/x86/include/uapi/asm/unistd.h +++ b/tools/arch/x86/include/uapi/asm/unistd.h @@ -3,7 +3,7 @@ #define _UAPI_ASM_X86_UNISTD_H /* x32 syscall flag bit */ -#define __X32_SYSCALL_BIT 0x40000000UL +#define __X32_SYSCALL_BIT 0x40000000 #ifndef __KERNEL__ # ifdef __i386__