Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp26933ybl; Thu, 5 Dec 2019 14:31:26 -0800 (PST) X-Google-Smtp-Source: APXvYqw+0oruEOWddLMsF9q7IocR+b9OKMdhEhRClGPWGEEaHnrFAMup2tBvMqgJILti+TwGwFSJ X-Received: by 2002:a9d:4543:: with SMTP id p3mr8855643oti.350.1575585086653; Thu, 05 Dec 2019 14:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575585086; cv=none; d=google.com; s=arc-20160816; b=pt2+wJndyFaOlcOcXQeyLAQvAldYngCRo5joyOmqPB5ZBjmG3Lkd99cjYW0GAFr5I6 SsPj/Oxanq9XIOKin54c5UN0bC8z6oJJGHc4UXocN6+tXuNVFBAbduAa1MydNH5nCHNm H3EM5EmvbFo/qReujgj1uP4KPMXuXdMsrsRDP72po5VxprirXTQE2YEw50CIz/K7zoXY nLDOLfbtQ126zz0m4ss058C9zsTSdmDCTiEf5xamMBIpAIc1nI1NetRRk1a4LEpysh0c tJZrKLIjpf69CZxMcBBgSHV0ntk0eaLlHYLqqdJQUsoqAVoDOCrSDXFVvnnQ6H0Zvfti d0hQ== 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 :user-agent:message-id:date:cc:to:from:subject:dkim-signature; bh=w7E5oF+2cttm86IlVc5CeQ8v5MMj9XUUWT8eYB5XTvc=; b=OviHJVF2MEvwuelbU8fTvwt3POAXoYN84FOdCvHG6Zdx4z6YRKzjz6aE8Z7PuENYO8 iAUY0lV6ucR+JEPgVFOLGT9VSSlkNMt+CK3q3HtiWiSarUHrZzJ4RDVnv/2+Smkf492X DmZlkXPp3/i1xrhKJtRdCtb6atfursYccHsPzOOVHbRVjyk7Pes3Om/z3BYziAh5K35j uWUWmheoJpMd3RN2iNg/j+vf197nbI7/ojzrOLJZ1uEx6BfTgqNanvoNufXYX003FCtv YmB/coYbaAP01BQPHBtWuqtGF6rThfHOng4qS/JXg5/I/Ha0nBm2hiFFubYT6vuJZjmK B7uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cYrkGVm9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si5837607oib.23.2019.12.05.14.31.14; Thu, 05 Dec 2019 14:31:26 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cYrkGVm9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727681AbfLEWaa (ORCPT + 99 others); Thu, 5 Dec 2019 17:30:30 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:37301 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727650AbfLEWaa (ORCPT ); Thu, 5 Dec 2019 17:30:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575585028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w7E5oF+2cttm86IlVc5CeQ8v5MMj9XUUWT8eYB5XTvc=; b=cYrkGVm9d6O8XnC1j+3jk5FbbRkeb4Z7Q+0AaKWO+LTw+d9oA6TFbqZjUp4WCjN/5gbJef fsLijeIaho8rXZXvnO7/o68Kw6sReMPbAP2mm186rKJEz0UKRj7jemrS8uf7/o6AKgmEPY A6Ri2jJC+UyzcuYt99xY8MqHDO2MIKM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-NP7vG2PUNGuKNWjTY0R3_g-1; Thu, 05 Dec 2019 17:30:25 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B92888024C0; Thu, 5 Dec 2019 22:30:24 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-250.rdu2.redhat.com [10.10.120.250]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8197A1001901; Thu, 5 Dec 2019 22:30:23 +0000 (UTC) Subject: [PATCH 0/2] pipe: Fixes [ver #2] From: David Howells To: torvalds@linux-foundation.org, ebiggers@kernel.org Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 05 Dec 2019 22:30:22 +0000 Message-ID: <157558502272.10278.8718685637610645781.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: NP7vG2PUNGuKNWjTY0R3_g-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, Eric, Here are a couple of patches to fix bugs syzbot found in the pipe changes: (1) An assertion check will sometimes trip when polling a pipe because the ring size and indices used are approximate and may be being changed simultaneously. An equivalent approximate calculation was done previously, but without the assertion check, so I've just dropped the check. To make it accurate, the pipe mutex would need to be taken or the spin lock could be used - but usage of the spinlock would need to be rolled out into splice, iov_iter and other places for that. (2) The index mask and the max_usage values cannot be cached across pipe_wait() as F_SETPIPE_SZ could have been called during the wait. This can cause pipe_write() to break. David --- David Howells (2): pipe: Remove assertion from pipe_poll() pipe: Fix missing mask update after pipe_wait() fs/pipe.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)