Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1168025ybh; Sat, 14 Mar 2020 19:58:12 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsdBddcXbLUbsRtAZKiyBMOLiImD4MCU9W62o2f68Ny24dgXz/Xpszqnz0VeiGQ171GYi1d X-Received: by 2002:a9d:4702:: with SMTP id a2mr16881928otf.319.1584241092595; Sat, 14 Mar 2020 19:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584241092; cv=none; d=google.com; s=arc-20160816; b=vgN36gvqysz5G6chM+BqGFXda3egwdGHJkrpJVuKG0GLMC60yynJ1qv6/7HfxGDWNV /AejHx/BuH5HndRGbuLgjTn2aS5NVT0uM4PNYynUSP+pt6UlqtBczikWHYthGk1uQDly GOzf02QCMjUIKRcWDeuEfibsHPEV7fdOxgys7QOAbHhnQjM0dHqGyenMMRzOqp2iBxTI 3z5JzF7ADZ7ziqNKYo0t+AUzUHX/pMzdNkoNtr40x66DUxDCJubqVR71dpY4ul4tAncQ Vs2SPVS8joiQCXZpe+CVrW2Mz+5x66iMNYk4yUsvYmgATZsC84IzOGQ0+nEtcFaygCLa PupQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3UmG2dLfBJg16UewZt513QeG2LeOhCqBZGzfG/GGKwk=; b=JLQih2Kx03tAfAl1OxJwu8o6O+7uqpdnkr+mfVKBqnJzaEdt1xj8UqVgOYC83dF9KP J7OSKy4gt0MhCZFy8Zr33np9CfE4SdlXv0zpkbBd/RsTfjuuI48RNs6hQ8+wp8GZEKgr cBeN5ygT2D4EibrSiYomNIQUNWkLwTVB8sTO51mlAVF7WiWCiErVfeAvRA3wNDQdYu5i eDVQ3d4MM4gBI8xky2HrmPfoJPnpUtVJFpWJQjWa/x+PiReqyJGuSt5Ozo4Jo2ILpUl7 WtKtKkZ7V2lUwtpiwXN08R1Acuvc5CZt7HgvG3iwaAi9F/NqEZYec+0qSBEv/3iDeLlw lwew== 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 c14si7608339otm.146.2020.03.14.19.58.00; Sat, 14 Mar 2020 19:58:12 -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 S1727533AbgCOC5Z (ORCPT + 99 others); Sat, 14 Mar 2020 22:57:25 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:65071 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725793AbgCOC5Z (ORCPT ); Sat, 14 Mar 2020 22:57:25 -0400 Received: from 185.80.35.16 (185.80.35.16) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.341) id 00af069952524629; Sat, 14 Mar 2020 11:57:23 +0100 From: "Rafael J. Wysocki" To: Eric Biggers Cc: linux-pm@vger.kernel.org, Len Brown , Pavel Machek , glider@google.com, linux-kernel@vger.kernel.org, syzbot+af962bf9e7e27bccd025@syzkaller.appspotmail.com Subject: Re: [PATCH] PM / hibernate: Remove unnecessary compat ioctl overrides Date: Sat, 14 Mar 2020 11:57:23 +0100 Message-ID: <5664624.X3QHRrgMSY@kreacher> In-Reply-To: <20200308032701.998434-1-ebiggers@kernel.org> References: <20200308032434.GX15444@sol.localdomain> <20200308032701.998434-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sunday, March 8, 2020 4:27:01 AM CET Eric Biggers wrote: > From: Eric Biggers > > Since the SNAPSHOT_GET_IMAGE_SIZE, SNAPSHOT_AVAIL_SWAP_SIZE, and > SNAPSHOT_ALLOC_SWAP_PAGE ioctls produce an loff_t result, and loff_t is > always 64-bit even in the compat case, there's no reason to have the > special compat handling for these ioctls. Just remove this unneeded > code so that these ioctls call into snapshot_ioctl() directly, doing > just the compat_ptr() conversion on the argument. > > (This unnecessary code was also causing a KMSAN false positive.) > > Signed-off-by: Eric Biggers > --- > kernel/power/user.c | 16 +--------------- > 1 file changed, 1 insertion(+), 15 deletions(-) > > diff --git a/kernel/power/user.c b/kernel/power/user.c > index 77438954cc2b..58ed9478787f 100644 > --- a/kernel/power/user.c > +++ b/kernel/power/user.c > @@ -409,21 +409,7 @@ snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > switch (cmd) { > case SNAPSHOT_GET_IMAGE_SIZE: > case SNAPSHOT_AVAIL_SWAP_SIZE: > - case SNAPSHOT_ALLOC_SWAP_PAGE: { > - compat_loff_t __user *uoffset = compat_ptr(arg); > - loff_t offset; > - mm_segment_t old_fs; > - int err; > - > - old_fs = get_fs(); > - set_fs(KERNEL_DS); > - err = snapshot_ioctl(file, cmd, (unsigned long) &offset); > - set_fs(old_fs); > - if (!err && put_user(offset, uoffset)) > - err = -EFAULT; > - return err; > - } > - > + case SNAPSHOT_ALLOC_SWAP_PAGE: > case SNAPSHOT_CREATE_IMAGE: > return snapshot_ioctl(file, cmd, > (unsigned long) compat_ptr(arg)); > Applied as 5.7 material, thanks!