Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2343912imm; Thu, 7 Jun 2018 09:05:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKUzERmlEONkcvbkKVw+Jb9tRaBB6GK3FRijt6Bpb4zqNO+7EltPkys0h+7Jar4Vla4hqcy X-Received: by 2002:a17:902:aa83:: with SMTP id d3-v6mr2712641plr.323.1528387541183; Thu, 07 Jun 2018 09:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387541; cv=none; d=google.com; s=arc-20160816; b=E9u3SRi27EGWZy4+J7EFU4qynCEnAGCe+aB4ccX2+6JTS/80ZHzCkr+zlIbRoAl8qP e50VTEuXbG+GhwmPr0rmRrNletz/9+CXSQnSyvOYt4hfaomYSBUnSse25xZt9covAz3n 9nq3VoaivfMlsMUK1hKOGdOcl+TdLkx2qo+3ZQppOa+el/xJEYAed9Pfw3LDRW+sbbXh pmQSW+X3xu0bTXIEtnZYFc66THitFqVAhve7kgM4U1ozGIMNEqfWxw2aAvumqfWNgTOK NUsWkXvo59wg/EV60viWvZ5kbMFcUCdAX8VhrNpDdvvlAKULit3UE/hmwwDUfEJhhKPO GYqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=d4NABy9kOROxpU0AFAUdX6I/1GhjaSw7TkTfldkVPrM=; b=1GY+X1BTfZYG9zwWKo0dM1ZNN3abwEFRtBRf+HHeZ7Cm7IZHoERVx6j5fYdvATclDL 3WhJo0egweKwCjpfJDJG6z18SwwFa7Q/3by//NF019Wt68ZjCnrvGLlj/fdVTnSP72bP Ol/zEiMgdYTbm+MLbTHwuoduQwNV0P3QPUJryYYv3RFjM6/2c95tfPS0JyqLZcKt+q4J yVMAhUsRGbESU8WobXs6gYhGDZcTaM8ytW4op9sLnStsUZoM+IRdz2hGY6dFC5IFe4Bo z4CC27OKGNclRynP31A8FHyQqeIUJIiN7EE5C+5/OJX4SavB8aAcYT4Zf+IzNsGgc06z qI/Q== 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 a4-v6si12495205pfi.353.2018.06.07.09.05.26; Thu, 07 Jun 2018 09:05:41 -0700 (PDT) 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 S935331AbeFGQAe (ORCPT + 99 others); Thu, 7 Jun 2018 12:00:34 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39336 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933049AbeFGOJH (ORCPT ); Thu, 7 Jun 2018 10:09:07 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvb7-0005Zt-K8; Thu, 07 Jun 2018 15:09:05 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb3-0002vq-Uj; Thu, 07 Jun 2018 15:09:01 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Martin Schwidefsky" , "Heiko Carstens" , "Eugene Syromiatnikov" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 161/410] s390: fix handling of -1 in set{,fs}[gu]id16 syscalls In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 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. Signed-off-by: Eugene Syromiatnikov Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky Signed-off-by: Ben Hutchings --- 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)