mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Christoph Hellwig <hch@lst.de>, Al Viro <viro@zeniv.linux.org.uk>,
	Matthew Wilcox <willy@infradead.org>
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?
Date: Wed, 23 Nov 2022 13:35:15 +0000	[thread overview]
Message-ID: <1464424.1669210515@warthog.procyon.org.uk> (raw)

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 --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)


                 reply	other threads:[~2022-11-23 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464424.1669210515@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®