From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE46C433F5 for ; Fri, 20 May 2022 09:15:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347524AbiETJPA (ORCPT ); Fri, 20 May 2022 05:15:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231345AbiETJOz (ORCPT ); Fri, 20 May 2022 05:14:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A15C313C1E2 for ; Fri, 20 May 2022 02:14:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0848A61B9C for ; Fri, 20 May 2022 09:14:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C023CC385AA; Fri, 20 May 2022 09:14:52 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="jHiEczQR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1653038091; 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: in-reply-to:in-reply-to:references:references; bh=nZxLeQP280HvIinkfhrGen/yfJsBCLWYeNWFg+K8k64=; b=jHiEczQRzDJATOw45S9amLoCxvnNXHpp0NKrnc/8+cestKWtfdwfByxaB19+zTofNgkasn k2MYn9DlnQ7j34hS0EyOlXP9ucB/OB6p3mmv6JwavsoDYBeXrT04oKQ/Y32i6QFECuJKOo gbeO7SLqTCuMMLDLCidZFPQcKlIQjxo= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 7b893b7a (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 20 May 2022 09:14:51 +0000 (UTC) Date: Fri, 20 May 2022 11:14:49 +0200 From: "Jason A. Donenfeld" To: Al Viro Cc: Jens Axboe , tytso@mit.edu, hch@lst.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] random: convert to using fops->read_iter() Message-ID: References: <20220519233137.20415-1-axboe@kernel.dk> <20220519233137.20415-2-axboe@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Al, On Fri, May 20, 2022 at 03:11:06AM +0000, Al Viro wrote: > > SYSCALL_DEFINE3(getrandom, char __user *, ubuf, size_t, len, > > unsigned int, flags) { + struct iovec iov = { .iov_base = ubuf }; > > + struct iov_iter iter; > > import_single_range(READ, ubuf, len, &iov, &iter) > > (note, BTW, that this'll cap len) I'll incorporate this and send a v4. import_single_range does an access_ok(), but I would hope that copy_to_iter() also does similar checks. Does that make this less efficient? Jason