[lttng-dev] [PATCH lttng-ust 2.7 2.8] ABI: refuse non-matching ABI minor version on event registration

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Mon Nov 6 21:37:16 UTC 2017


Merged into UST 2.7 and 2.8, thanks!

Mathieu

----- On Nov 6, 2017, at 4:10 PM, Jonathan Rajotte jonathan.rajotte-julien at efficios.com wrote:

> ---
> Apply to stable 2.7 and stable 2.8 ONLY.
> Both are considered EOL but this is a major issue that need to be fixed.
> ---
> 
> In scenarios where a lttng-tools 2.8 (lttng-ust 2.8) stack is running
> and an application linked against a lttng-ust 2.7, event registration
> will fail on fields size validation [1]. This is not expected based on the
> ABI versioning exposed by lttng-ust 2.7 (6.0) and lttng-ust 2.8 (6.1).
> 
> The same happen if the scenario is reversed
> 
> This is the result off a change in _ustctl_basic_type.
> 2.8 introduced enumeration to _ustctl_basic_type. The defined padding is
> of 296 while the new union member is 312 (310 of real data + 2 for
> alignment) pushing the structure size to 312 instead of the previous
> 296. This should have been an major ABI break but until now the problem
> did not surface.
> 
> To prevent this, refuse non matching minor version. No need to check for
> particular major,minor version since only 6.0 (ust 2.7) and 6.1 (ust
> 2.8) exist until a major ABI break.
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
> liblttng-ust-ctl/ustctl.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
> 
> diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c
> index d08e7edc..bc7cccaf 100644
> --- a/liblttng-ust-ctl/ustctl.c
> +++ b/liblttng-ust-ctl/ustctl.c
> @@ -1824,6 +1824,17 @@ int ustctl_recv_reg_msg(int sock,
> 		return -LTTNG_UST_ERR_UNSUP_MAJOR;
> 	}
> 
> +	/*
> +	 * Addition of enumeration inside _ustclt_basic_type should have been a
> +	 * marked as a breaking ABI change since it blows past the included
> +	 * padding hence result in bigger than expected struct. Refuse
> +	 * registration for non-matching minor version since only two minor
> +	 * version exist for ust-2.7(6.0) and 2.8(6.1).
> +	 */
> +	if (reg_msg.minor != LTTNG_UST_ABI_MINOR_VERSION) {
> +		return -LTTNG_UST_ERR_UNSUP_MAJOR;
> +	}
> +
> 	return 0;
> }
> 
> --
> 2.11.0

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list