From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752881AbcHOI4G (ORCPT ); Mon, 15 Aug 2016 04:56:06 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:19739 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752455AbcHOI4D (ORCPT ); Mon, 15 Aug 2016 04:56:03 -0400 Subject: Re: [PATCH] fs/pipe: fix shift by 64 in F_SETPIPE_SZ To: Willy Tarreau References: <1471005340-13682-1-git-send-email-vegard.nossum@oracle.com> <20160815080641.GA14695@1wt.eu> <57B17BCE.2060504@oracle.com> <20160815083443.GC14695@1wt.eu> Cc: Al Viro , linux-kernel@vger.kernel.org From: Vegard Nossum Message-ID: <57B18386.8050401@oracle.com> Date: Mon, 15 Aug 2016 10:55:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160815083443.GC14695@1wt.eu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/15/2016 10:34 AM, Willy Tarreau wrote: > On Mon, Aug 15, 2016 at 10:22:38AM +0200, Vegard Nossum wrote: >> In both cases I found it better to be more conservative in what we >> accept, i.e. I haven't checked whether the rest of the code would >> support pipe buffers > INT_MAX on 64-bit and I think it's a slightly >> bigger job to check that (not just for the person making the change, but >> for everybody else looking at/reviewing it) -- it's already tricky >> enough to verify that this change by itself is safe and correct IMHO. > > Well in fact in my opinion it's the opposite, because if we ensure the > function works well over all its argument type's range, the caller has > less trouble figuring what sub-part of the range is OK. This is exactly > the current issue where you have to ensure that : > > unsigned int arg <= INT_MAX It's not just about this one function, but all the other code in pipe.c now has to cope with pipe buffers > INT_MAX as well. For example all the fields in struct pipe_inode_info referring to buffers are unsigned int (nrbufs, curbuf, buffers). Unless we also change those to unsigned long, the code will definitely not support buffer sizes up to LONG_MAX on 64-bit. That's why I think it's a much, much bigger task to review (and make) such a change. Vegard