Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp1481274img; Tue, 19 Mar 2019 08:31:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXXxwb67dQAYMSsJkZMmFWvoL3+cFS5vNu2/SKQ25CmUZb7NOfeLu9JLWGm49k7kQyD97h X-Received: by 2002:a17:902:9306:: with SMTP id bc6mr2610397plb.59.1553009501416; Tue, 19 Mar 2019 08:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553009501; cv=none; d=google.com; s=arc-20160816; b=VNNZvq9aNEdoF3nKLsE1c8DvF/DnobOCovf8G4gjtbj54RSeyEw5qY8XPbBTY946DG RggcyTDlXa/U5hIQTJorqZauOKVNSRQJUn92a/E17ZtkTrCIw3SQ+P0IHFpaEMFpbfPj qGw92vrpC7cv5qvl9vtI6Rt0FurHNnzIqsGw14pFwROee0OAgUdj782z2A1IjTroIHyy Rz2sPHIoLi7zM7q6dqoadOAd9o94q6pMNTO/VuP7vzQYV6FLsdSnfgga1crUHAwg6Bqq 1jkcrE9RMMlvpdXfbdtcx21HGrm3GyPrUaIVqz8nkKh1uALtO8yTOteGiVA3sMzAlbSC cGPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tuUUgxmNDvPHeoCaS/B39ohupSnY/F5JmNXASuRQpfA=; b=08q07wxNmRHFjMOSjclZ12ggbdP9947F/8LN9n9YJ9hV9ecP77LWn+RurVPeDuOjeg bsYV0sGrkhBXqtDlcIkagpfuKGZdymhGp6ZUp3qaklMrvr6wGHQpW0E90V/dIj4ArBtz Ax/SfX3X4073OSgZhk5+93OWxfnjLxL7+3bbTUh1VkfScRZUTNgnYvQ8dOoNr6QVcn35 UcE+douC44u3uZ2APwWC8zVsV0isfWyz3eaG5Ih2OCRgMBzldrrqIT4Wx5NS9Jswb8PC wxnitW5X4LvHvKdtX2v2A3YhdLpvrXN9srKOqUy5GDVJGbzu0CxEkTJkdaH5vHii6ai1 E6/w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si10813595pgp.169.2019.03.19.08.31.25; Tue, 19 Mar 2019 08:31: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727845AbfCSPaK (ORCPT + 99 others); Tue, 19 Mar 2019 11:30:10 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:37530 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727018AbfCSPaK (ORCPT ); Tue, 19 Mar 2019 11:30:10 -0400 Received: by mail-yw1-f66.google.com with SMTP id w66so16216536ywd.4; Tue, 19 Mar 2019 08:30:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tuUUgxmNDvPHeoCaS/B39ohupSnY/F5JmNXASuRQpfA=; b=XQgz9JRe7G3v6Bf0k06XNxAYz5ZN1xFugwQpDyYwDLHbTJiv1jvFSHPu4Lf534O1Ut x2SMu1THN/dji7Q8ywYpJK26IZ0aKbPy0X5ngjXfrMjRX+YSy5OCFpLNlvniGSrm7+oV h0HnOdPfBfk6oF9A0CuzvRARumaBbbvLM87e8vuDsXejvKt92GJdozxVHik7D6gOg0Gf 7ergkIAxQ9exNKf8p+LEbmqqurac8vsd7OFdVUcnCnVDmhug/mkPDlK6taM9aem+5cxN fmttMK7NWf9YYOJ94fwlrU0OVBu45mkhwCkdjXFbUIOuZt6oBg9iBt7wVjwN554HQIF4 jLJg== X-Gm-Message-State: APjAAAUC1OG2BSeNY+ntbIU1CffYtxQ4Sy+C8YW9j5faHtXkbULPzJrF zIQBDN52ZfpP0eoFgucnlJ8= X-Received: by 2002:a81:a7ca:: with SMTP id e193mr2503776ywh.410.1553009409114; Tue, 19 Mar 2019 08:30:09 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id b67sm1154399ywb.102.2019.03.19.08.30.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 08:30:07 -0700 (PDT) Received: by 42.do-not-panic.com (sSMTP sendmail emulation); Tue, 19 Mar 2019 15:30:05 +0000 Date: Tue, 19 Mar 2019 15:30:05 +0000 From: Luis Chamberlain To: Eric Sandeen Cc: Eric Sandeen , Linux Kernel Mailing List , fsdevel , netdev@vger.kernel.org, Kees Cook Subject: Re: [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers Message-ID: <20190319153005.GA1146@42.do-not-panic.com> References: <53be40fc-6ec4-c714-a64e-f69c96f7058f@redhat.com> <0ffd0eea-ca64-0128-2835-a9856b224e07@sandeen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0ffd0eea-ca64-0128-2835-a9856b224e07@sandeen.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 04, 2019 at 10:43:09PM -0600, Eric Sandeen wrote: > On 2/20/19 5:32 PM, Eric Sandeen wrote: > > Today, proc_do_large_bitmap() truncates a large write input buffer > > to PAGE_SIZE - 1, which may result in misparsed numbers at the > > (truncated) end of the buffer. Further, it fails to notify the caller > > that the buffer was truncated, so it doesn't get called iteratively > > to finish the entire input buffer. > > > > Tell the caller if there's more work to do by adding the skipped > > amount back to left/*lenp before returning. > > > > To fix the misparsing, reset the position if we have completely > > consumed a truncated buffer (or if just one char is left, which > > may be a "-" in a range), and ask the caller to come back for > > more. > > > > Signed-off-by: Eric Sandeen > > Would be nice to fix this bug. I submitted the test node patch as well > as an attempt to integrate it into the test harness, though there's > wonkiness there still, and I could use more experienced eyes. Sorry for the delay. I'm rolling these changes in with some minor adjustments, can you send me your respective lib/test_sysctl.c changes? I don't see that they had been sent. Luis