mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Luczaj <mhal@rbox.co>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: virtualization@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC net-next v2 2/3] vsock/test: Introduce get_transports()
Date: Wed, 4 Jun 2025 21:10:19 +0200	[thread overview]
Message-ID: <b4f3bc0d-9ff5-4271-be28-bbace27927bd@rbox.co> (raw)
In-Reply-To: <wzbyv7fvzgpf4ta775of6k4ozypnfe6szysvnz4odd3363ipsp@2v3h5w77cr7a>

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


  reply	other threads:[~2025-06-04 19:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 20:44 [PATCH RFC net-next v2 0/3] vsock/test: Improve transport_uaf test Michal Luczaj
2025-05-28 20:44 ` [PATCH RFC net-next v2 1/3] vsock/test: Introduce vsock_bind_try() helper Michal Luczaj
2025-06-04  9:08   ` Stefano Garzarella
2025-05-28 20:44 ` [PATCH RFC net-next v2 2/3] vsock/test: Introduce get_transports() Michal Luczaj
2025-06-04  9:07   ` Stefano Garzarella
2025-06-04 19:10     ` Michal Luczaj [this message]
2025-06-05 10:46       ` Stefano Garzarella
2025-06-06  7:51         ` Michal Luczaj
2025-06-11 14:20           ` Stefano Garzarella
2025-06-11 20:35             ` Michal Luczaj
2025-05-28 20:44 ` [PATCH RFC net-next v2 3/3] vsock/test: Cover more CIDs in transport_uaf test Michal Luczaj
2025-06-04  9:37   ` Stefano Garzarella
2025-06-04 19:11     ` Michal Luczaj
2025-06-05 10:49       ` Stefano Garzarella

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=b4f3bc0d-9ff5-4271-be28-bbace27927bd@rbox.co \
    --to=mhal@rbox.co \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /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®