Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp483992ybl; Wed, 4 Dec 2019 06:07:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzNOaHkLvgawYVF/tuaMmeR/+BS7PE4iUdYzZ3nsdjo6LMLpBi7YHajRXomlebiwkzjM2PC X-Received: by 2002:a9d:7586:: with SMTP id s6mr2473129otk.342.1575468444242; Wed, 04 Dec 2019 06:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575468444; cv=none; d=google.com; s=arc-20160816; b=Gw/J1HTBKFKzFj1FjOIC11lo4z9REdbYaxXnOy+fPPDTDK3+nwVW9fBuu8E3cvQObg qHW3IR6u7gr7Z/ov2OYhn+QpBJ0AllSmX4oF9B9MoZvrq0AcMEWnIEmqNIptJPEQ1k4H kbmA3nRR++2p5QiZOtFF9W6BKLUeh4x3Q6pkxOPF0ClaV1yt7ky40pPtEn0Z+0zkhPbt bZLGDocvx7hwkjuSObiImHxdW0Xa5Glb3hvRRs+q5Q4zoD1mzG87R2+claqIB8PYJ+JQ e9H6a36u3io2GnlhcMf2uvsDS7Wua7yv1lanCRSWo621j7LrPvX6+vnrv2AVhYTz/2mv 7ktA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=3pDMBDXLIxm347ub8B5Ps0oyt6NR44k9ekVbqzawQ9Q=; b=CHZXwfCoSVaAUNyYFiF6Eqn5TYGM7riXFa4iL2DZzLYscGUORMvlUmCxW9LYLHURew C9tWW5PELy+IsaRYc1iec8h1uWWGI2Y2PcM5xVw8lgDL5UxxV+SkaF+m5eHoyWP/3SVu WuLKx+SyHHMw/7FG3rK/KI36jV6nuauh5h8Yme4Ff9anLeHCpt6qE3qTUxvrYyR3GCen nlLuvuqeJ6MCMCa/19ty5FULbbFpQSEBd1j/+Jg222EhcqLz8vYvr0wp7jIe311sKYAB wzCuu8Vxp9U2yq/ERv3zFbaxz5wKn0m/N0FqLT5V3o27PJoZqoWUQgdIu3ORqbM+1n8W Cgcw== 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 m5si3081072ote.187.2019.12.04.06.06.38; Wed, 04 Dec 2019 06:07:24 -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 S1727991AbfLDOFd (ORCPT + 99 others); Wed, 4 Dec 2019 09:05:33 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:50247 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727828AbfLDOFc (ORCPT ); Wed, 4 Dec 2019 09:05:32 -0500 Received: from mail-qk1-f175.google.com ([209.85.222.175]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MirX2-1i6Rn50Zng-00ev0t; Wed, 04 Dec 2019 15:05:31 +0100 Received: by mail-qk1-f175.google.com with SMTP id q28so7198988qkn.10; Wed, 04 Dec 2019 06:05:30 -0800 (PST) X-Gm-Message-State: APjAAAUsxupyB35Eg91X2CCVgjevsbc+DPAi1dkr6WyAuKf85HWRPZ9N OmU1XbjO2IHuTdIRgkv+tYx664ym8c9qeVZsQcc= X-Received: by 2002:ae9:eb12:: with SMTP id b18mr2945260qkg.3.1575468329900; Wed, 04 Dec 2019 06:05:29 -0800 (PST) MIME-Version: 1.0 References: <1575137443.5563.18.camel@HansenPartnership.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 4 Dec 2019 15:05:09 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] first round of SCSI updates for the 5.4+ merge window To: Linus Torvalds Cc: James Bottomley , Al Viro , Andrew Morton , linux-scsi , linux-kernel , Doug Gilbert Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:PrJhNMzdEgu7HmHaW+4RW1cXQjySBFOSIdr0MN+9q8+AAumf1ZC /TtNLgSii9Az1L54qsdqb0uigh2N6vR0vs4+82h5TlbWTett89W8mB/GZo9Mg6FUXdUpH24 bSN1WLvdmqoEvPBYf78vkh41nVblJYfnTg4eTqc2S9aRZQRmIeSaOjJN9+4WxtPOZya03QE qSY9EUxrqm5ulPtPdUbag== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:lFv8KiEf6Aw=:YEgixR4fabBY/FVMQbUVqM lZY7gBr2acWKbCobF3jNMCJK+ls92OP09fAd73jHzRkoyna8it37BiRle7KLp2LRO31/Ro1U+ U8+0+PO4lTleqRLK7Xyfzu/mENEVSZ7LdOl+OSmDhytga9Nuiuf1IvM/53s7y5sfbNIUY8Mfq 3kBKLqZNNnXU+Od+PhiczIjxDt+u7Y3W0H4C0NLnqANQ7ehALKiqRVW0s+QrpIdzPkh8CXZvX iDc2p6KRJQXRPdO836rKCitcoSc6eTXe5tTXxgyN4dL0qbd175BCTa+lm+2FxCUwNJn7mFYZS 9nya4sxsEg8sMJhOvZ5LMARY4uln+at0p10Sz8FozrzFebjsOZheFMqWIHDq3sCpjFBqW5J1t s5YUFYcEsCsJaHjk9VcUrwr4TOCZtbf1qtaS96FMNve+PhbfKAGoaDHCyneqVtpd41LtgBKCG AEuFvaxCWjTg7nU/E4LVvVDptjVZkpEbjTvGlGo+caV2XsuzhGl3y9esZ83zHEGnEy8gnCk9m 4KNq1F6ysMfK47q6IifGdp2VDdG8hFWGFtReLGR48AHMEyiOElt8GHe3ZZAGChKtHormBaevt NlgGWRbHj1yNiIpEdgQXoOUfTTrqn/D3cEbIkvPpy2i4qM/kOPlvo4huw2dimCaRKwX0lnMM+ I0E1wZL8E34PsMRi8BY623L4ssrcNZMThWMOY9sIDuPilqw4aeF+TyWKy/Y4rTXFdNelTFyVh xxQATf0Vml7RznJ+KaOmUnhrj1NDoFpNw4sw9BC5XjJvIHiaLiptOvFvN38i4rQoFioN8O+Ct I6Qyv2CysvUW6Ia7uwyghGZEPVavUvUukZdtAvXTIDKDyka7dOXSkHBY7se1FikYQLsfF2GXR iumaF+m0hcsOd0Ta94MQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 2, 2019 at 10:58 PM Linus Torvalds wrote: > > Anyway, the sg copyin/out changes by Al conflicted fairly badly with > Arnd's compat_ioctl changes. > > Al did > > c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of > userland sg_io_hdr_t") > > which avoided doing a whole allocation of an 'sg_io_hdr_t' to just > read the one field of it. > > But Arnd did > > 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling") > > which created a get_sg_io_hdr() helper that copied the 'sg_io_hdr_t' > from user space the right way for both compat and native, which > basically relied on the old approach. Right, I also failed to notice that the linux-next conflict resolution was breaking my changes, the fixup looked simple enough there. :-( > since it turns out that the one 'pack_id' field we want does have the > same format in compat mode as in native mode ("int" and > "compat_int_t" are the same), it's just at different offsets. But the > definition of 'compat_sg_io_hdr' isn't available in that place. > > I'm leaving it to Al and Arnd to decide if they want to fix the > stupidity. I tried to make the minimally invasive merge resolution. > > Al, Arnd? Comments? > > It looks like linux-next punted on this entirely, and took Al's > simplified version that doesn't work with the compat case. Maybe I > should have done the same - if you use read() on the /dev/sg* device, > you deserve to get broken for the compat case. And it didn't > historically work anyway. But it was kind of sad to see how Arnd fixed > it, and then it got broken again. I've tried now to move the pack_id logic into a separate function and, in doing so noticed a bug in my own patch: sg_new_read() needs to check for the compat_sg_io_hdr size, which also depends on the struct definition. I've drafted a patch that should do this right, but we could also just -EINVAL in compat mode here if that's too complex. Arnd