From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966374AbeAOPT2 (ORCPT + 1 other); Mon, 15 Jan 2018 10:19:28 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37412 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932393AbeAOPT1 (ORCPT ); Mon, 15 Jan 2018 10:19:27 -0500 Date: Mon, 15 Jan 2018 16:19:16 +0100 From: Heiko Carstens To: Eugene Syromiatnikov Cc: linux-s390@vger.kernel.org, Martin Schwidefsky , Paul Gortmaker , Philippe Ombredanne , Greg Kroah-Hartman , Kate Stewart , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390: fix setgid16/setuid16 handling of -1 References: <20180115115242.GA15131@asgard.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180115115242.GA15131@asgard.redhat.com> X-TM-AS-GCONF: 00 x-cbid: 18011515-0012-0000-0000-000005A3E1FF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011515-0013-0000-0000-0000191F50F7 Message-Id: <20180115151916.GC4305@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-15_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801150218 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 15, 2018 at 12:52:42PM +0100, Eugene Syromiatnikov wrote: > For some reason, the implementation of these two 16-bit ID system calls > used cast instead of low2highgid/low2highuid macros for converting [GU]IDs, > which leads to incorrect handling of value of -1 (which ought to be > considered invalid). > > Discovered by strace test suite. > > Signed-off-by: Eugene Syromiatnikov > --- > arch/s390/kernel/compat_linux.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c > index f04db37..e48a31a 100644 > --- a/arch/s390/kernel/compat_linux.c > +++ b/arch/s390/kernel/compat_linux.c > @@ -110,7 +110,7 @@ COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid) > > 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, u16, ruid, u16, euid) > > COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid) > { > - return sys_setuid((uid_t)uid); > + return sys_setuid(low2highuid(uid)); Thank you! Would you mind to fix this also for s390_setfsuid16 and s390_setfsgid16 within the same file, and resend?