[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/public: fix flexible array definitions


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 26 Jul 2023 07:52:55 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aS6UQ+TKDV/R5njROLJvzhx0AdGNSS1JKv1CcpTuLz8=; b=Z6UC9yt0R9JvmxUmtFv/m+mO/UDdIVQSrr5FAUqFYh4RqEMcLpnMYgZmSJWBhb1O7GiUNuBGa4EzrgKVCtkGQd/ZHAGC8tZTQ0yqnmEgfwnTGjRztNCT2aH63jDlUtGzjmWyESR0v7/laGzaEA2A2z9rxp7j7wrelQX4kYUEsHSdV82YecpybciVjOnoZ3FuEfg7+9c6riaXoc7DjtlJXp7XIeYPp10djqThad7JGKYDWRUs/cmrS1R8Osolz5QdMgBz+m1fg+3a7f74TRy0BCaImyxKVR2Rspttw3kxPJ3uop+yZjmtLOJ85vpsipIjq/tsbFCwzcnOjfIf+PshoA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gxNSldRVJi9nkXyvlTADH84U0QjSr4eW0DFLza0l8O9d8+lNjElFa4Z+hfL1ROiFD8ct5QJowmDgZFji+VBoDLE3OSeph1Y0Z0/uCXxve9Tk4TtkDKNCUfnxvRFq6AFd0O0GdKnL7BJYBTBwk/UbKHWoXd9oPe4LcmuXAjUfws8jUAWhdU1xFDGZkSWXNxJ2kAnq8X8niaXnarG/3jLTnQu1V5fyToeI5NDj2hkbPzv4cd95IDJ7OjUcbP2kPFxsxSa0iYcOvFmtTvZA7cPWiXR5PNuS1zvwXn3sGV2kF+D2n4oV2l2k0ITJ2oa02Gode5DvCy5RzaIIFxyWL/tlrA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Wed, 26 Jul 2023 05:53:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 25.07.2023 18:59, Andrew Cooper wrote:
> On 25/07/2023 5:16 pm, Jan Beulich wrote:
>> On 25.07.2023 15:55, Juergen Gross wrote:
>>> Flexible arrays in public headers can be problematic with some
>>> compilers.
>>>
>>> Replace them with arr[XEN_FLEX_ARRAY_DIM] in order to avoid compilation
>>> errors.
>>>
>>> This includes arrays defined as "arr[1]", as seen with a recent Linux
>>> kernel [1].
>>>
>>> [1]: https://bugzilla.kernel.org/show_bug.cgi?id=217693
>>>
>>> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
>> I think we need to be careful here: What if someone somewhere applies
>> sizeof() to any of the types you alter?
> 
> Then the code was most likely wrong already.

That's possible to judge only when seeing the code in question.

>>  The resulting value would
>> change with the changes you propose, which we cannot allow to happen
>> in a stable interface. Therefore imo it can only be an opt-in feature
>> to have these arrays no longer be one-element ones.
> 
> I don't consider this an issue.
> 
> If people take an update to the headers and their code stops compiling,
> then of course they fix the compilation issue.  That's normal.

The code may continue to compile fine, and even appear to work initially.

> It's unreasonable to take opt-in features to a set of headers intended
> to be vendored in the first place, to work around a corner case that's
> likely buggy already.

The original intention clearly was to allow use of these headers as is.
Anyway, I've voiced my view, yet if there are enough people agreeing
with you, then so be it.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.