Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp462419ybz; Tue, 21 Apr 2020 12:27:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJwedZVB7Muq2BinzS81ErZ4mpwhRUwtEjLdl1Y2LCgvygxXSF6XNhI6mYd7T4xlalZVzoO X-Received: by 2002:a17:906:7c11:: with SMTP id t17mr23370274ejo.73.1587497252300; Tue, 21 Apr 2020 12:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587497252; cv=none; d=google.com; s=arc-20160816; b=v4yjAJRtytumu971iJNB/L9Ul1ex5Ap5kX8WEONPFh02RgY8Z5uS7Ixjhj+Ul4O866 FOQh+BouV0/n9YViUqtiu2b5PLLXl9QGcSma6dVzqygdaPAGpyb5uMy9mISw4SL75evu v+cfhPV7Z7/rgkSvLOer2JAV+GZvCH0qQF9guBRmePmtRa+JKbPp/Ehgch2doLQ1Hdyc ezj7BGMIN4Ky4FkLUElh/PpupyjDNfZsngsQszvKBCk/aezUuh1y+ERiPg10u+oXoIJJ qan/O/S4jIzIFoaMyJzfhx2b4SzPOSV0uIfjHHNCNg0TI0WeyEGZ8an3aouUZdpm8zNi AmpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ol91EcCZ0Iwt5hTZXvLonw1bGzMSBFW8bSYc3a8lAKM=; b=UQ9q9I2yxcykJrFirvnqlcqZToZVjtRMh+DaZzaxNRCHgGcKPekrdJUomuPUVwlyH9 Iqds4Fm5+h5D+U1JPq3SB+nOORkz2Tl7fL8cxxOAB0dnUM0gZGmbXqH5SyMHsdSQkxIo /mSsVRUuWA6SJvHIZ8x+E/vrRGAqtZiPkwai54WC0r/9+mGwymCE9vgbQiMmF+b/RsqH /gASGgT5b0qP6JihNsk/790VJ1yzlk2Fr11+Bh6Jgl+1z0eoK45PHFyAYMkyDyJLhvS+ zR8whSqeunSLtuUIr65w1MlqMQDJAED7bFPbH3+0NQiLIFspCX5aM53mlyR7ZE9TLR1y 2D2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si2168246ede.176.2020.04.21.12.27.08; Tue, 21 Apr 2020 12:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726144AbgDUT0B (ORCPT + 99 others); Tue, 21 Apr 2020 15:26:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725902AbgDUT0B (ORCPT ); Tue, 21 Apr 2020 15:26:01 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E6CC0610D5; Tue, 21 Apr 2020 12:26:01 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jQyWW-007mYP-P6; Tue, 21 Apr 2020 19:25:36 +0000 Date: Tue, 21 Apr 2020 20:25:36 +0100 From: Al Viro To: Christoph Hellwig Cc: Andrew Morton , Jeremy Kerr , Arnd Bergmann , "Eric W . Biederman" , linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/7] powerpc/spufs: simplify spufs core dumping Message-ID: <20200421192536.GG23230@ZenIV.linux.org.uk> References: <20200421154204.252921-1-hch@lst.de> <20200421154204.252921-2-hch@lst.de> <20200421184941.GD23230@ZenIV.linux.org.uk> <20200421190148.GA26071@lst.de> <20200421191909.GF23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421191909.GF23230@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 21, 2020 at 08:19:09PM +0100, Al Viro wrote: > On Tue, Apr 21, 2020 at 09:01:48PM +0200, Christoph Hellwig wrote: > > On Tue, Apr 21, 2020 at 07:49:41PM +0100, Al Viro wrote: > > > > spin_lock(&ctx->csa.register_lock); > > > > - ret = __spufs_proxydma_info_read(ctx, buf, len, pos); > > > > + __spufs_proxydma_info_read(ctx, &info); > > > > + ret = simple_read_from_buffer(buf, len, pos, &info, sizeof(info)); > > > > > > IDGI... What's that access_ok() for? If you are using simple_read_from_buffer(), > > > the damn thing goes through copy_to_user(). Why bother with separate access_ok() > > > here? > > > > I have no idea at all, this just refactors the code. > > Wait a bloody minute, it's doing *what* under a spinlock? ... and yes, I realize that it's been broken the same way. It still needs fixing. AFAICS, that got broken in commit bf1ab978be23 "[POWERPC] coredump: Add SPU elf notes to coredump." when spufs_proxydma_info_read() had copy_to_user() (until then done after dropping the spinlock) moved into an area where blocking is very much *not* allowed.