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: <b4f3bc0d-9ff5-4271-be28-bbace27927bd@rbox.co>
Date: Wed, 4 Jun 2025 21:10:19 +0200
From: Michal Luczaj <mhal@...x.co>
To: Stefano Garzarella <sgarzare@...hat.com>
Cc: virtualization@...ts.linux.dev, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC net-next v2 2/3] vsock/test: Introduce
 get_transports()

On 6/4/25 11:07, Stefano Garzarella wrote:
> On Wed, May 28, 2025 at 10:44:42PM +0200, Michal Luczaj wrote:
>> +static int __get_transports(void)
>> +{
>> +	/* Order must match transports defined in util.h.
>> +	 * man nm: "d" The symbol is in the initialized data section.
>> +	 */
>> +	const char * const syms[] = {
>> +		"d loopback_transport",
>> +		"d virtio_transport",
>> +		"d vhost_transport",
>> +		"d vmci_transport",
>> +		"d hvs_transport",
>> +	};
> 
> I would move this array (or a macro that define it), near the transport 
> defined in util.h, so they are near and we can easily update/review 
> changes.
> 
> BTW what about adding static asserts to check we are aligned?

Something like

#define KNOWN_TRANSPORTS	\
	_(LOOPBACK, "loopback")	\
	_(VIRTIO, "virtio")	\
	_(VHOST, "vhost")	\
	_(VMCI, "vmci")		\
	_(HYPERV, "hvs")

enum transport {
	TRANSPORT_COUNTER_BASE = __COUNTER__ + 1,
	#define _(name, symbol)	\
		TRANSPORT_##name = _BITUL(__COUNTER__ - TRANSPORT_COUNTER_BASE),
	KNOWN_TRANSPORTS
	TRANSPORT_NUM = __COUNTER__ - TRANSPORT_COUNTER_BASE,
	#undef _
};

static char * const transport_ksyms[] = {
	#define _(name, symbol) "d " symbol "_transport",
	KNOWN_TRANSPORTS
	#undef _
};

static_assert(ARRAY_SIZE(transport_ksyms) == TRANSPORT_NUM);

?

Note that I keep pushing for naming HVS a TRANSPORT_HYPERV. Perhaps it's
better to stick to TRANSPORT_HVS after all?

>> diff --git a/tools/testing/vsock/util.h b/tools/testing/vsock/util.h
>> index 0afe7cbae12e5194172c639ccfbeb8b81f7c25ac..63953e32c3e18e1aa5c2addcf6f09f433660fa84 100644
>> --- a/tools/testing/vsock/util.h
>> +++ b/tools/testing/vsock/util.h
>> @@ -3,8 +3,19 @@
>> #define UTIL_H
>>
>> #include <sys/socket.h>
>> +#include <linux/bitops.h>
>> #include <linux/vm_sockets.h>
>>
>> +#define KALLSYMS_PATH		"/proc/kallsyms"
>> +#define KALLSYMS_LINE_LEN	512
> 
> We don't need to expose them in util.h IMO, we can keep in util.c

OK, sure.

Thanks,
Michal


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ