From patchwork Wed Nov 23 13:35:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13053656 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FC9DC4332F for ; Wed, 23 Nov 2022 13:35:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48CC06B0071; Wed, 23 Nov 2022 08:35:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4157B6B0073; Wed, 23 Nov 2022 08:35:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B5D46B0074; Wed, 23 Nov 2022 08:35:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1964A6B0071 for ; Wed, 23 Nov 2022 08:35:25 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E27EB1A11D2 for ; Wed, 23 Nov 2022 13:35:24 +0000 (UTC) X-FDA: 80164803768.26.AF84A97 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 3223EA0009 for ; Wed, 23 Nov 2022 13:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669210523; 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=fPZl80clgJEOhCWJTzGU2bHEtRGaUbcwve3HQWi3lhY=; b=YtwI2PfB213+r4KqdW+fu/YtV5sw5aohj/8EJeLmDVDsdFErLIkd0QhbWq2rwc35eRnLi5 tnzas8TJDeJGxN9EmJuKCHVJXZkvhMA7+8XLJ0jk4MchikCHvqrQRZg1Nd38Whsh0RqyVP TeJt8xtgcnEaMubXkqdBxoPGS0Or/hg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-WdEaAAr1MUmDkjhNT0rVJw-1; Wed, 23 Nov 2022 08:35:20 -0500 X-MC-Unique: WdEaAAr1MUmDkjhNT0rVJw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8DF2C29DD9B1; Wed, 23 Nov 2022 13:35:19 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D8EA2028E8F; Wed, 23 Nov 2022 13:35:18 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Christoph Hellwig , Al Viro , Matthew Wilcox cc: dhowells@redhat.com, torvalds@linux-foundation.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Should iov_iter_get_pages*() be EXPORT_SYMBOL_GPL? MIME-Version: 1.0 Content-ID: <1464423.1669210515.1@warthog.procyon.org.uk> Date: Wed, 23 Nov 2022 13:35:15 +0000 Message-ID: <1464424.1669210515@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669210524; a=rsa-sha256; cv=none; b=VGAp/16vYvlTwXlGi7mVYlFxkQ6lvJOByECSdGiB3e3VR3UyeYlJVoi2/CPkKVRaloIq4i zedhqA53i7RREoAVqrfz0s/6dVzGbYauzpKYs8X6GalhgPhFpzZeMa0S/yI9ZviLkwUqED QquKP77B6OWExnoBFUoTd2Q6ffLZPYQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YtwI2PfB; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669210524; h=from:from:sender: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:in-reply-to: references:dkim-signature; bh=fPZl80clgJEOhCWJTzGU2bHEtRGaUbcwve3HQWi3lhY=; b=Fg5sBGOkB/QdE4dd5S7NEXiIoZ9JVBBuGsfrCrd4+X2XEslCN9j3Ht20DVPkgcSCPHd5rW ikjTBIygP9y4rYamEEHjj8B2YLoX6NvX3rrMABqLqaa5WuiEATYQO++TF65ze34GcUrDNG 4LvMCjBzsk24qO9Rl4ynfewiq+ex8TM= X-Rspam-User: X-Rspamd-Queue-Id: 3223EA0009 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YtwI2PfB; spf=pass (imf15.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: utrk6cx68sgkqhmp3p4j9z6ephp71rni X-Rspamd-Server: rspam10 X-HE-Tag: 1669210524-321247 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I recently posted an intended replacement[1] for iov_iter_get_pages*() which, instead of always just getting a ref on the pages it extracts from the iterator it is given, will pin them or leave them unaltered (but still in the list) as appropriate. However, Christoph objected[2] to my using EXPORT_SYMBOL() with it on the basis that: get_user_pages_fast, pin_user_pages_fast are very intentionally EXPORT_SYMBOL_GPL, which should not be bypassed by an iov_* wrapper. but iov_iter_get_pages*() is EXPORT_SYMBOL(), so it's already possible to bypass this restriction. He has also raised other objections[3]. Should we then convert this to EXPORT_SYMBOL_GPL(), as per the attached patch? Link: https://lore.kernel.org/r/166920902005.1461876.2786264600108839814.stgit@warthog.procyon.org.uk/ [1] Link: https://lore.kernel.org/r/Y3zFzdWnWlEJ8X8/@infradead.org/ [2] Link: https://lore.kernel.org/lkml/20221025154143.GA25128@lst.de/ [3] --- iov_iter: Mark iov_iter_get_pages2*() as EXPORT_SYMBOL_GPL() iov_iter_get_pages2*() should be marked EXPORT_SYMBOL_GPL() as the use get_user_pages_fast()[1]. Reported-by: Christoph Hellwig Signed-off-by: David Howells cc: Al Viro cc: Matthew Wilcox cc: linux-mm@kvack.org cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/Y3zFzdWnWlEJ8X8/@infradead.org/ [1] --- iov_iter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 612fc9bf9881..02b02a5fece4 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1502,7 +1502,7 @@ ssize_t iov_iter_get_pages2(struct iov_iter *i, return __iov_iter_get_pages_alloc(i, &pages, maxsize, maxpages, start); } -EXPORT_SYMBOL(iov_iter_get_pages2); +EXPORT_SYMBOL_GPL(iov_iter_get_pages2); ssize_t iov_iter_get_pages_alloc2(struct iov_iter *i, struct page ***pages, size_t maxsize, @@ -1519,7 +1519,7 @@ ssize_t iov_iter_get_pages_alloc2(struct iov_iter *i, } return len; } -EXPORT_SYMBOL(iov_iter_get_pages_alloc2); +EXPORT_SYMBOL_GPL(iov_iter_get_pages_alloc2); size_t csum_and_copy_from_iter(void *addr, size_t bytes, __wsum *csum, struct iov_iter *i)