linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Pascal Bouchareine <kalou@tfz.net>
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Alexey Dobriyan" <adobriyan@gmail.com>,
	"Al Viro" <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH v2 1/2] mm: add GFP mask param to strndup_user
Date: Fri, 21 Aug 2020 20:51:54 -0700	[thread overview]
Message-ID: <20200821205154.365e230dbf6f2b93a47443c4@linux-foundation.org> (raw)
In-Reply-To: <20200822032827.6386-1-kalou@tfz.net>

On Fri, 21 Aug 2020 20:28:26 -0700 Pascal Bouchareine <kalou@tfz.net> wrote:

> Let caller specify allocation.
> Preserve existing calls with GFP_USER.
> 
>  21 files changed, 65 insertions(+), 43 deletions(-)

Why change all existing callsites so that one callsite can pass in a
different gfp_t?

> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 1ca609f66fdf..3d94ba811f4b 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -326,7 +326,7 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll)
>   */
>  static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf)
>  {
> -	char *name = strndup_user(buf, DMA_BUF_NAME_LEN);
> +	char *name = strndup_user(buf, DMA_BUF_NAME_LEN, GFP_USER);
>  	long ret = 0;

Wouldn't

#include <linux/gfp.h>

char *__strndup_user(const char __user *s, long n, gfp_t gfp);

static inline char *strndup_user(const char __user *s, long n)
{
	return __strndup_user(s, n, GFP_USER);
}

be simpler?



Also...

why does strndup_user() use GFP_USER?  Nobody will be mapping the
resulting strings into user pagetables (will they?).  This was done by
Al's 6c2c97a24f096e32, which doesn't have a changelog :(


In [patch 2/2],

+	desc = strndup_user(user_desc, SK_MAX_DESC_SIZE, GFP_KERNEL_ACCOUNT);

if GFP_USER is legit then shouldn't this be GFP_USER_ACCOUNT (ie,
GFP_USER|__GFP_ACCOUNT)?


  parent reply	other threads:[~2020-08-22  3:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 18:23 [RFC PATCH 0/2] proc,socket: attach description to sockets Pascal Bouchareine
2020-08-15 18:23 ` [PATCH 1/2] mm: add GFP mask param to strndup_user Pascal Bouchareine
2020-08-15 22:42   ` Al Viro
2020-08-16 16:10     ` Alexey Dobriyan
2020-08-15 18:23 ` [PATCH 2/2] net: socket: implement SO_DESCRIPTION Pascal Bouchareine
2020-08-16  5:02   ` kernel test robot
2020-08-16  7:33   ` kernel test robot
2020-08-16  7:33   ` [RFC PATCH] net: socket: sock_set_description() can be static kernel test robot
2020-08-16  9:00   ` [PATCH 2/2] net: socket: implement SO_DESCRIPTION kernel test robot
2020-08-16 18:15   ` Eric Dumazet
2020-08-16 19:30     ` Pascal Bouchareine
2020-08-22  3:28 ` [PATCH v2 1/2] mm: add GFP mask param to strndup_user Pascal Bouchareine
2020-08-22  3:28   ` [PATCH v2 2/2] net: socket: implement SO_DESCRIPTION Pascal Bouchareine
2020-08-22  6:57     ` kernel test robot
2020-08-22 19:36     ` David Miller
2020-08-22 19:59       ` Pascal Bouchareine
2020-08-22 20:19         ` Pascal Bouchareine
2020-08-22 20:53           ` Pascal Bouchareine
2020-08-22 21:01             ` David Miller
2020-08-23 22:28               ` Pascal Bouchareine
2020-08-22  3:51   ` Andrew Morton [this message]
2020-08-22 19:36     ` [PATCH v2 1/2] mm: add GFP mask param to strndup_user Pascal Bouchareine

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=20200821205154.365e230dbf6f2b93a47443c4@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kalou@tfz.net \
    --cc=kuba@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).