Received: by 10.223.185.116 with SMTP id b49csp1030849wrg; Wed, 21 Feb 2018 10:52:45 -0800 (PST) X-Google-Smtp-Source: AH8x227FRJx78hTEVQhY2XpRRX677jiZykRIhF3/O/TXmKZy8o1oYj2Nbdb/o9VHZWYv4zV/A//b X-Received: by 2002:a17:902:96a:: with SMTP id 97-v6mr4033376plm.183.1519239165287; Wed, 21 Feb 2018 10:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519239165; cv=none; d=google.com; s=arc-20160816; b=Tgpr4eNtGmdEOnqwUibgZb+We8tQH85J/wIf/+1q9D6SSvESQoPMEf5Xy5oJSDIiIK F5C2uH700a6h8QPuCKW6uof5i+VqyOYRJ/o6GTsa8ISeqmGqDkvSWspzX3Zm0YgvcmAu 2Zpr3mCNcDLJ1S5HDeDE4lep5hwKZ6h0bYN2TlbdjLppqdCpp+odlwnzBWGyxUh/hDuj S0UI8L3mNqI1Apz4vkMByRAnV68sHlF919vxLhGvTTfvEyKGPKGY0vSiYnAXnzsdA989 YdkzAJRHPaTCgpeSMqMMY8dQkKXtdizQYUz9pVPjQE5jaYCtLMhjQ5hhIIYfmc3Z4UPf JzGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xsqZ/KbMe8WfbzIHphiM3G07OeWYaW08T9nf12ntvnU=; b=S4Hx5o3KVcvc0rBJNnfPuhf/ALbFzglLbf4EXJqaxaoaFlC6iHFtNlpC/nApV3piMT Y3ThCrUjJlOuYTKHwjWrHkOTiFRyk4jMRN6TBSsCKf/o1vUiqT9rUPf2eAB1JwuydxCL skaHHrWrs4KiZpZSVJ6+wngqcwwR4pOPQcc0mJEdZG+waqI3vEVcNUEDO3jKzaZx/XBR FxrScbJiwTeUpd6UZOlYBjm5bzgEYMMu4BgJxbqX30Zq1Gim2KFvIhVheIepx+4IURUK bXG5TDx5avJAdD/2L4EwSvpob78a8o2DVT+kWaM9trVe7oUFc5ckNRJC8qcR9/dUNZYc nTJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si3156158pgu.407.2018.02.21.10.52.31; Wed, 21 Feb 2018 10:52:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937731AbeBUOdG (ORCPT + 99 others); Wed, 21 Feb 2018 09:33:06 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34596 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753007AbeBUMzy (ORCPT ); Wed, 21 Feb 2018 07:55:54 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F2F57119F; Wed, 21 Feb 2018 12:55:53 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugene Syromiatnikov , Heiko Carstens , Martin Schwidefsky Subject: [PATCH 4.9 42/77] s390: fix handling of -1 in set{,fs}[gu]id16 syscalls Date: Wed, 21 Feb 2018 13:48:51 +0100 Message-Id: <20180221124433.964726137@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugene Syromiatnikov commit 6dd0d2d22aa363fec075cb2577ba273ac8462e94 upstream. For some reason, the implementation of some 16-bit ID system calls (namely, setuid16/setgid16 and setfsuid16/setfsgid16) used type cast instead of low2highgid/low2highuid macros for converting [GU]IDs, which led to incorrect handling of value of -1 (which ought to be considered invalid). Discovered by strace test suite. Cc: stable@vger.kernel.org Signed-off-by: Eugene Syromiatnikov Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/compat_linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c @@ -110,7 +110,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setregid16, COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid) { - return sys_setgid((gid_t)gid); + return sys_setgid(low2highgid(gid)); } COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid) @@ -120,7 +120,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setreuid16, COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid) { - return sys_setuid((uid_t)uid); + return sys_setuid(low2highuid(uid)); } COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid) @@ -173,12 +173,12 @@ COMPAT_SYSCALL_DEFINE3(s390_getresgid16, COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid) { - return sys_setfsuid((uid_t)uid); + return sys_setfsuid(low2highuid(uid)); } COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid) { - return sys_setfsgid((gid_t)gid); + return sys_setfsgid(low2highgid(gid)); } static int groups16_to_user(u16 __user *grouplist, struct group_info *group_info)