All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH 05/15] dbus: Fix _dbus_kernel_calculate_bloom for multiple arguments.
Date: Thu, 24 Mar 2016 09:39:09 -0500	[thread overview]
Message-ID: <56F3FC0D.8020706@gmail.com> (raw)
In-Reply-To: <1458598224-29325-5-git-send-email-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2853 bytes --]

Hi Andrew,

On 03/21/2016 05:10 PM, Andrew Zaborowski wrote:
> It seems that l_dbus_message_iter_get_type can't be used to get the

Its for sure :)

> value of a single argument and be called repeatedly, it might crash if
> the number and types of call arguments don't match the message arguments.
> Add a comment explaining why arguments after first non-string argument
> are not considered.
> ---
>   ell/dbus-message.c | 34 ++++++++++++++++++++++++++++------
>   1 file changed, 28 insertions(+), 6 deletions(-)
>
> diff --git a/ell/dbus-message.c b/ell/dbus-message.c
> index 0b412b2..a7c9699 100644
> --- a/ell/dbus-message.c
> +++ b/ell/dbus-message.c
> @@ -1419,6 +1419,7 @@ bool _dbus_kernel_calculate_bloom(struct l_dbus_message *message,
>   	struct l_dbus_message_iter iter;
>   	uint8_t argn;
>   	char buf[256];
> +	bool (*get_basic)(struct l_dbus_message_iter *, char, void *);
>
>   	/* The string "interface:" suffixed by the interface name */
>   	attr = l_dbus_message_get_interface(message);
> @@ -1462,17 +1463,38 @@ bool _dbus_kernel_calculate_bloom(struct l_dbus_message *message,
>
>   	body = _dbus_message_get_body(message, &body_size);
>
> -	if (_dbus_message_is_gvariant(message))
> -		_gvariant_iter_init(&iter, message, signature, NULL,
> -					body, body_size);
> -	else
> +	if (_dbus_message_is_gvariant(message)) {
> +		if (!_gvariant_iter_init(&iter, message, signature, NULL,
> +						body, body_size))
> +			return false;
> +
> +		get_basic = _gvariant_iter_next_entry_basic;
> +	} else {
>   		_dbus1_iter_init(&iter, message, signature, NULL,
> -				body, body_size);
> +					body, body_size);
> +
> +		get_basic = _dbus1_iter_next_entry_basic;
> +	}
>
>   	argn = 0;
>
> +	/*
> +	 * Stop iteration on the first non-string argument even though
> +	 * this may lead to legitimate signals not reaching peers that
> +	 * have set up seemingly correct kernel-side filters.

What's this 'legitimate' business ;)  Can we simply quote DBUS1-PORTING 
document or whatever from libsystemd sd-bus?

> +	 *
> +	 * "If the first argument of the message is a string,
> +	 * "arg0-slash-prefix" suffixed with the first argument, and also
> +	 * all prefixes of the argument (cut off at "/"), also prefixed
> +	 * with "arg0-slash-prefix".
> +	 *
> +	 * Similar for all further arguments that are strings up to 63,
> +	 * for the arguments and their "dot" and "slash" prefixes. On the
> +	 * first argument that is not a string, addition to the bloom
> +	 * filter should be stopped however."
> +	 */
>   	while (*signature == 's' || *signature == 'o' || *signature == 'g') {
> -		if (!message_iter_next_entry(&iter, &attr))
> +		if (!get_basic(&iter, *signature, &attr))
>   			return false;
>
>   		sprintf(buf, "arg%hhu", argn);
>

Regards,
-Denis

  reply	other threads:[~2016-03-24 14:39 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-21 22:10 [PATCH 01/15] dbus: Add _dbus1_message_iter_skip_entry Andrew Zaborowski
2016-03-21 22:10 ` [PATCH 02/15] gvariant: Add _gvariant_iter_skip_entry Andrew Zaborowski
2016-03-24 14:35   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 03/15] dbus: Add _dbus_message_get_nth_string_argument Andrew Zaborowski
2016-03-24 14:35   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 04/15] dbus: Support 2+ arguments in l_dbus_message_get_error Andrew Zaborowski
2016-03-24 14:36   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 05/15] dbus: Fix _dbus_kernel_calculate_bloom for multiple arguments Andrew Zaborowski
2016-03-24 14:39   ` Denis Kenzior [this message]
2016-03-21 22:10 ` [PATCH 06/15] dbus: Add message filter logic in dbus-filter.c Andrew Zaborowski
2016-03-24 16:36   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 07/15] unit: Add dbus message filter tests Andrew Zaborowski
2016-03-24 16:37   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 08/15] dbus-filter: Name owner change tracking support Andrew Zaborowski
2016-03-24 17:28   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 09/15] dbus: Classic dbus filter_ops implementation Andrew Zaborowski
2016-03-24 17:41   ` Denis Kenzior
2016-03-25 23:30     ` Andrzej Zaborowski
2016-03-26  2:37       ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 10/15] dbus: kdbus " Andrew Zaborowski
2016-03-24 17:51   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 11/15] linux: Update kdbus.h to current github version Andrew Zaborowski
2016-03-24 17:52   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 12/15] dbus-kernel: Update kdbus API usage to current version Andrew Zaborowski
2016-03-24 17:52   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 13/15] dbus: Add message filter public API Andrew Zaborowski
2016-03-24 18:04   ` Denis Kenzior
2016-03-25 23:45     ` Andrzej Zaborowski
2016-03-26  2:42       ` Denis Kenzior
2016-03-26 15:22         ` Andrzej Zaborowski
2016-03-26 21:53           ` Denis Kenzior
2016-03-27  3:48             ` Andrzej Zaborowski
2016-03-21 22:10 ` [PATCH 14/15] unit: Use the message filter API in dbus tests Andrew Zaborowski
2016-03-24 18:06   ` Denis Kenzior
2016-03-21 22:10 ` [PATCH 15/15] dbus: Don't send replies to messages with no reply flag Andrew Zaborowski
2016-03-24 18:12   ` Denis Kenzior
2016-03-25 23:52     ` Andrzej Zaborowski
2016-03-24 14:35 ` [PATCH 01/15] dbus: Add _dbus1_message_iter_skip_entry Denis Kenzior

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=56F3FC0D.8020706@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ell@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.