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: <nmtyovnsn4edb2leysure4hjriwdkcjpvppcaatqbqifohupw5@osqesr4xh3y6>
Date: Fri, 14 Nov 2025 04:44:30 -0800
From: Breno Leitao <leitao@...ian.org>
To: Gustavo Luiz Duarte <gustavold@...il.com>
Cc: Andre Carvalho <asantostc@...il.com>, Simon Horman <horms@...nel.org>, 
	Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Shuah Khan <shuah@...nel.org>, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH net-next v2 2/4] netconsole: Split userdata and sysdata

On Thu, Nov 13, 2025 at 08:42:19AM -0800, Gustavo Luiz Duarte wrote:
> Separate userdata and sysdata into distinct buffers to enable independent
> management. Previously, both were stored in a single extradata_complete
> buffer with a fixed size that accommodated both types of data.
> 
> This separation allows:
> - userdata to grow dynamically (in subsequent patch)
> - sysdata to remain in a small static buffer
> - removal of complex entry counting logic that tracked both types together
> 
> The split also simplifies the code by eliminating the need to check total
> entry count across both userdata and sysdata when enabling features,
> which allows to drop holding su_mutex on sysdata_*_enabled_store().
> 
> No functional change in this patch, just structural preparation for
> dynamic userdata allocation.
> 
> Signed-off-by: Gustavo Luiz Duarte <gustavold@...il.com>

Reviewed-by: Breno Leitao <leitao@...ian.org>

<snip>
> @@ -1608,13 +1575,24 @@ static void send_fragmented_body(struct netconsole_target *nt,
>  		buf_offset += this_chunk;
>  		data_sent += this_chunk;
>  
> -		/* after msgbody, append extradata */
> -		if (extradata_ptr && extradata_left) {
> -			this_chunk = min(extradata_left,
> +		/* after msgbody, append userdata */
> +		if (userdata_ptr && userdata_left) {
> +			this_chunk = min(userdata_left,
>  					 MAX_PRINT_CHUNK - buf_offset);
>  			memcpy(nt->buf + buf_offset,
> -			       extradata_ptr + extradata_offset, this_chunk);
> -			extradata_offset += this_chunk;
> +			       userdata_ptr + userdata_offset, this_chunk);
> +			userdata_offset += this_chunk;
> +			buf_offset += this_chunk;
> +			data_sent += this_chunk;
> +		}
> +
> +		/* after userdata, append sysdata */
> +		if (sysdata_ptr && sysdata_left) {
> +			this_chunk = min(sysdata_left,
> +					 MAX_PRINT_CHUNK - buf_offset);
> +			memcpy(nt->buf + buf_offset,
> +			       sysdata_ptr + sysdata_offset, this_chunk);
> +			sysdata_offset += this_chunk;

This seems all correct and improved, but, I would like to improve this a bit
better.

I would like to have a function to append_msg_body(), append_sysdata() and append_userdata(),
which is not possible today given these variables.

A possibility is to have a local "struct fat_buffer" that contains all these
pointers and offset, then we can pass the struct to these append_XXXXX(struct
fat_buffer *) in a row.

I envision something as:

	int buf_offset = 0;

	while (data_sent < data_len) {
		buf_offset += append_msgbody(&fat_buffer)
		buf_offset += append_sysdata(&fat_buffer)
		buf_offset += append_userdata(&fat_buffer)

		send_udp(nt, nt->buf, buf_offset);
	}

Not sure it will be possible to be as simple as  above, but, it will definitely
make review easier.

Just to be clear, this is not a request for this patch, but, something that I'd
love to have.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ