diff mbox series

Should iov_iter_get_pages*() be EXPORT_SYMBOL_GPL?

Message ID 1464424.1669210515@warthog.procyon.org.uk (mailing list archive)
State New
Headers show
Series Should iov_iter_get_pages*() be EXPORT_SYMBOL_GPL? | expand

Commit Message

David Howells Nov. 23, 2022, 1:35 p.m. UTC
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 <hch@lst.de>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: Matthew Wilcox <willy@infradead.org>
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 mbox series

Patch

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)