lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <773003d9-bbee-4941-a3e7-3590ea80bdb2@kernel.org>
Date: Thu, 27 Feb 2025 09:45:01 +0100
From: Matthieu Baerts <matttbe@...nel.org>
To: Geliang Tang <geliang@...nel.org>
Cc: Geliang Tang <tanggeliang@...inos.cn>, netdev@...r.kernel.org,
 mptcp@...ts.linux.dev, linux-sctp@...r.kernel.org,
 Eric Dumazet <edumazet@...gle.com>, Kuniyuki Iwashima <kuniyu@...zon.com>,
 Paolo Abeni <pabeni@...hat.com>, Willem de Bruijn <willemb@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
 Simon Horman <horms@...nel.org>, David Ahern <dsahern@...nel.org>,
 Neal Cardwell <ncardwell@...gle.com>, Mat Martineau <martineau@...nel.org>,
 Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
 Xin Long <lucien.xin@...il.com>
Subject: Re: [PATCH net-next 1/4] sock: add sock_kmemdup helper

Hi Geliang,

On 27/02/2025 09:23, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@...inos.cn>
> 
> This patch adds the sock version of kmemdup() helper, named sock_kmemdup(),
> to duplicate the input "src" memory block using the socket's option memory
> buffer.

Thank you for suggesting this series.

(...)

> diff --git a/net/core/sock.c b/net/core/sock.c
> index 5ac445f8244b..95e81d24f4cc 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -2819,6 +2819,21 @@ void *sock_kmalloc(struct sock *sk, int size, gfp_t priority)
>  }
>  EXPORT_SYMBOL(sock_kmalloc);
>  
> +/*
> + * Duplicate the input "src" memory block using the socket's
> + * option memory buffer.
> + */
> +void *sock_kmemdup(struct sock *sk, const void *src,
> +		   int size, gfp_t priority)
> +{
> +	void *mem;
> +
> +	mem = sock_kmalloc(sk, size, priority);
> +	if (mem)
> +		memcpy(mem, src, size);
> +	return mem;
> +}


I think you will need to add an EXPORT_SYMBOL() here, if you plan to use
it in SCTP which can be compiled as a module.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ