Received: by 10.223.185.116 with SMTP id b49csp1013304wrg; Wed, 21 Feb 2018 10:33:50 -0800 (PST) X-Google-Smtp-Source: AH8x2278qc1mO8lf1pgft08PW8lMzIHx78PLlulhgWLfueX7Lx6LMZ9aLdYF2GZ/C45OX7VUlZ7d X-Received: by 10.99.167.75 with SMTP id w11mr3493080pgo.246.1519238029954; Wed, 21 Feb 2018 10:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519238029; cv=none; d=google.com; s=arc-20160816; b=V+Z0tQzpZDrobHt9ZvIo0jqZlotPW7PG33WsEyAH4gFK5zVasCm1e6e8jcCmQJj+pb s/LiVLD0ZO1uqibDaMBfj+fNlhMIv4HlW2ldMvwfsAfJls50pkLnrOB8VZUs2jMDuDNf w5BzTCLUfsDkhlbNN/MUhh4i9p0HJ7UbJBXcit799lUMVPgrHzvk0bel3OLBunEWJiaJ nj7voNT6BNk1l2ggP7xB4jVEtTJRMnTSVpt0b8GuLaIrrcnQqvQ04kMNMBnZIgcI3ihm hDoEO2b0PerrTsvzRNx5ZZJU7RZvqv2hlxFCCYgt5rHd8fDVHoiVEmstgq+1jZxOStYX 0Msg== 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=XCWJnXnAfZSyXdwhsdIpbKnJ7M41/bIkq5X4+cIu9nQ=; b=TvDezwmIX4WBU+4lsL3HVlb6vUERCTbmoR+Ef+WnYlQDDP/pmabhmhRjZFLAKqkY7u sQVS6n2IwJ2UZZDO7d5OLsqJ2B/ZptLGAYHPXgERrujmvkAP+cE4v1FIH51cZrXMrYqv g5rUP8Vni36ItdCr/JTv3nXBWUosp5TD/ONvVTykQCKLLXd6X+veQ8NFt4UT3gaPsY7k 35chE9BCOadwwG5m0Kj7K7dabXNiECn/uecxUUA7AOSQF5/jho2d44YDP6e/9Ll9GQhD FRYdBUpMmEzY9BVwECGKmx8huRtElN+tgxiNE1L/lNp/jiBH5SXpEEWflRN86mMAn41s TYmw== 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 g1-v6si2715157pln.818.2018.02.21.10.33.30; Wed, 21 Feb 2018 10:33:49 -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 S965326AbeBUNIT (ORCPT + 99 others); Wed, 21 Feb 2018 08:08:19 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42322 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753577AbeBUNIQ (ORCPT ); Wed, 21 Feb 2018 08:08:16 -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 C60B4104C; Wed, 21 Feb 2018 13:08:15 +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.15 026/163] s390: fix handling of -1 in set{,fs}[gu]id16 syscalls Date: Wed, 21 Feb 2018 13:47:35 +0100 Message-Id: <20180221124531.659085883@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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)