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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7778FC433DB for ; Sat, 2 Jan 2021 13:20:24 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE260224D4 for ; Sat, 2 Jan 2021 13:20:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE260224D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1kvgpQ-0004ej-AP; Sat, 02 Jan 2021 08:20:20 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1kvgpN-0004Y3-7t for Kernelnewbies@kernelnewbies.org; Sat, 02 Jan 2021 08:20:17 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 527F25C00EC; Sat, 2 Jan 2021 08:20:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 02 Jan 2021 08:20:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=UsrBlN5lngfqE2pSEqxDeMvS4i2 PO9mCdCCuXLRMgBU=; b=Den/j/gt03hR9YQa/oukhPwopohoP+EkDtTOM/3lP+y 57TX53yJR4ufoLEkr9VnmY7ZzDYTjwOdqfOuicsk519gwWFREFwEYcOMlvP5Aen1 shu9awceZh3NC1Y3QcnAUDYsXjZOoLvNhg+UpPJ/VnpZJU2T2/kGbi0loTk3H98g ANbJ7DzGMnUKfFlJBO6p34LDAjSyKKsJQoll8dRi7iWVWXyqdi9MEsUDeN+DApc9 f2KfyeeucEVQsBLY2HFTAriSfTC1Xblyx5oG+YAZI1JuZB19dCZn4jq0hlw/HF8P KKXZO7kaEnBMGbomu34BOhi+qQcgbTzYCZc0tiq0skQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=UsrBlN 5lngfqE2pSEqxDeMvS4i2PO9mCdCCuXLRMgBU=; b=C4dHr3dwmpnvVSJ6XdJMkc O68Em28L7SPvjM6DpswYfVEOjXLHFySOMWQJxxetCQbEon6vQXHyj3DPCA1ecLjL 4jUfE3jy9GlfYtdAgHaN5UZ/Bp5iTNuSW+ARa4UsZxb+0RSiQOX87d6XQLZzin4b 4J7ihhUOeRUjlDZZsllUYrbZgfX5ZaA0oencbzNOGsx7OnUPDx4LOHz+2YYQpICR DpD9zUj/u17gKUDO1RKV4j2VJLjGKHF5fd7xS2LXuRur1T2aJAiwsGLHIaPZ6XZf RWGImi3R1cRdfPxTvsXK2YWYldKbdCZht51g1KMlZX9ip0e2eiRZAwTTVO3abbow == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddvledgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeevueehje fgfffgiedvudekvdektdelleelgefhleejieeugeegveeuuddukedvteenucfkphepkeef rdekiedrjeegrdeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id 948B4240057; Sat, 2 Jan 2021 08:20:12 -0500 (EST) Date: Sat, 2 Jan 2021 14:20:09 +0100 From: Greg KH To: Sadanand Warrier Subject: Re: get_user_pages and pinning Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: Kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Sat, Jan 02, 2021 at 07:39:08AM -0500, Sadanand Warrier wrote: > Folks > Since Linux uses lazy evaluation with respect to allocating memory > what happens if a user process allocates memory using malloc in excess > of say 8 or nine pages and calls a device ioctl and passes the user > space pointer to it to be used to pin pages using get_user_pages(). > This buffer is to be used for a dma read from a device. > What happens if the memory isn't actually allocated (no initialization > with memset or calloc etc. and all PTEs are pointing to some zero > filled page) and there is no IOMMU? You should get an error of -EFAULT when you try to do this when the kernel tries to access memory you don't have. But the best way to be sure is to actually try it yourself and see! There's nothing preventing you from doing that, right? :) good luck! greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies