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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 25 Jul 2023 17:59:09 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=FjubPeh4Jz3Yoa+t0Yupgqs8qC+4/GGxRdLSxVPAqt4=; b=OpNuWmEOpg6Ol8m0eL56hOGYvaDG2ABIAMf2951DsEmviSPi5frSPGMy2u2KR5VPN4lHyUzjUMvOOhIhcjBRuMuH6EDntL/pNTdtVn2FbB1m7CGkCyYBHiJaVI8B6s2VnyeFQhZUFTK9XK0ege7tbgWjZkLT9bu0SKRpSuICv2+qLDqE2Pt/alG80RmqR4w1WAsgrwscSwyeErZrUBwDNT+pG5j7PRFawcL1FFxFFxL/nvB9LxWCw/ydKciCBpMTmrKA6FBQZeXgeJ6EZT9YF27McflE0/xbbej1WvphQV4mQpJW6e9Ycj0LbxAuTyT6OTSPw2cfVh6y+Nrob8o26Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GWAQuypXv/wTLk59zWP1r8ffzMSB+eZMVZe0X1Rjtik8vFFTSG/3uSfucXl46x7D2Pw4v/quedQFm+SqCwybs4MO4WroEojWF8HdqsVWUau3xzMKbPJ/rvMtUbGhvuw2dQC9cE/svT92xCy2Z/TU9z0MyZDR5UYgo2RGYgkedbpmQMVNW8trcs69PKUUTbbhXekdaLwl/3eHj6GUS3M5HacJSBabs9gWrHomou8gqf8WN8pPJKH9f+cHWf7e5Dc2lGEesNdkLpwsv38rzst3m0npsqtrDpPo0L04vpvYtjC6CPhYkleuJRb/1BjS8vz3XB3xlUOGmSxrJJxsh5HOkg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 25 Jul 2023 16:59:29 +0000
  • Ironport-data: A9a23:jZ4oIa3taI0+uki04/bD5fpwkn2cJEfYwER7XKvMYLTBsI5bpzUGn zNNCGzSPf6NazGmLtklO47ipE0E6MeByIVkQFE/pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK6ULWeUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8teTb8XuDgNyo4GlD5gNkOKgS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfGFFw7 scxchM2TkqGgOztg5KEbfRnv5F2RCXrFNt3VnBI6xj8Vaxja7aaBqLA6JlfwSs6gd1IEbDGf c0FZDFzbRPGJRpSJlMQD5F4l+Ct7pX9W2QA9BTJ+uxqui6Pk2Sd05C0WDbRUvWMSd9YgQCzo WXe8n6iKhobKMae2XyO9XfEaurnxHqkBNtMROPmnhJsqHKjwX0xGiQ9aXK+n8WGs3OvfYkDA GVBr0LCqoB3riRHVOLVXRe1vXqFtR40QMdLHqsx7wTl4qjb+QGCHUAfUyVMLtchsaceVTEsk 1OEgd7tLThuq6GOD2KQ8K+OqjG/MjRTKnUNDRLoViMA6tjn5Ys11xTGS445FLbv1oGqXzbt3 zqNsS4ywa0JitIG3Lm6+laBhC+wop/OTUg+4QC/sn+Z0z6VrbWNP+SAgWU3J94aRGpFZjFtZ EQ5pvU=
  • Ironport-hdrordr: A9a23:fEwHu6NxhuWn7MBcTv6jsMiBIKoaSvp037Dk7TEJdfU1SL3hqy nKpp4mPHDP+VMssR0b6LK90ey7MBDhHP1OgLX5X43SODUO0VHAROpfBMnZowEIcBeOkdK1u5 0QFZSWy+edMbG5t6vHCcWDfOrICePozJyV
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

>  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.

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.

~Andrew



 


Rackspace

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