mbox series

[GIT,PULL] flexible-array transformations in UAPI for 6.0-rc1

Message ID Yug4IJHugXBzPWFH@work (mailing list archive)
State Mainlined
Commit e2b542100719a93f8cdf6d90185410d38a57a4c1
Headers show
Series [GIT,PULL] flexible-array transformations in UAPI for 6.0-rc1 | expand

Pull-request

git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1

Message

Gustavo A. R. Silva Aug. 1, 2022, 8:31 p.m. UTC
The following changes since commit b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3:

  Linux 5.19-rc2 (2022-06-12 16:11:37 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1

for you to fetch changes up to 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381:

  treewide: uapi: Replace zero-length arrays with flexible-array members (2022-06-28 21:26:05 +0200)

----------------------------------------------------------------
flexible-array transformations in UAPI for 6.0-rc1

Hi Linus,

Please, pull the following treewide patch that replaces zero-length arrays
with flexible-array members in UAPI. This patch has been baking in
linux-next for 5 weeks now.

-fstrict-flex-arrays=3 is coming and we need to land these changes
to prevent issues like these in the short future:

../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
but the source string has length 2 (including NUL byte) [-Wfortify-source]
		strcpy(de3->name, ".");
		^

Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
this breaks anything, we can use a union with a new member name.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836

Thanks
--
Gustavo

----------------------------------------------------------------
Gustavo A. R. Silva (1):
      treewide: uapi: Replace zero-length arrays with flexible-array members

 arch/m68k/include/uapi/asm/bootinfo.h           |  4 +-
 arch/mips/include/uapi/asm/ucontext.h           |  2 +-
 arch/s390/include/uapi/asm/hwctrset.h           |  6 +--
 arch/x86/include/uapi/asm/bootparam.h           |  2 +-
 arch/x86/include/uapi/asm/kvm.h                 | 12 ++---
 include/uapi/drm/i915_drm.h                     |  6 +--
 include/uapi/linux/blkzoned.h                   |  2 +-
 include/uapi/linux/bpf.h                        |  2 +-
 include/uapi/linux/btrfs.h                      | 10 ++--
 include/uapi/linux/btrfs_tree.h                 |  2 +-
 include/uapi/linux/can/bcm.h                    |  2 +-
 include/uapi/linux/connector.h                  |  2 +-
 include/uapi/linux/cycx_cfm.h                   |  2 +-
 include/uapi/linux/dm-ioctl.h                   |  8 +--
 include/uapi/linux/dm-log-userspace.h           |  2 +-
 include/uapi/linux/ethtool.h                    | 28 +++++-----
 include/uapi/linux/fanotify.h                   |  2 +-
 include/uapi/linux/fiemap.h                     |  2 +-
 include/uapi/linux/firewire-cdev.h              | 12 ++---
 include/uapi/linux/fs.h                         |  2 +-
 include/uapi/linux/if_alg.h                     |  2 +-
 include/uapi/linux/if_arcnet.h                  |  6 +--
 include/uapi/linux/if_pppox.h                   |  4 +-
 include/uapi/linux/if_tun.h                     |  2 +-
 include/uapi/linux/igmp.h                       |  6 +--
 include/uapi/linux/inet_diag.h                  |  2 +-
 include/uapi/linux/inotify.h                    |  2 +-
 include/uapi/linux/ip.h                         |  4 +-
 include/uapi/linux/ip_vs.h                      |  4 +-
 include/uapi/linux/iso_fs.h                     |  4 +-
 include/uapi/linux/jffs2.h                      |  8 +--
 include/uapi/linux/kcov.h                       |  2 +-
 include/uapi/linux/kvm.h                        |  8 +--
 include/uapi/linux/minix_fs.h                   |  4 +-
 include/uapi/linux/mmc/ioctl.h                  |  2 +-
 include/uapi/linux/ndctl.h                      | 10 ++--
 include/uapi/linux/net_dropmon.h                |  4 +-
 include/uapi/linux/netfilter/x_tables.h         |  4 +-
 include/uapi/linux/netfilter_arp/arp_tables.h   |  6 +--
 include/uapi/linux/netfilter_bridge/ebt_among.h |  2 +-
 include/uapi/linux/netfilter_ipv4/ip_tables.h   |  6 +--
 include/uapi/linux/netfilter_ipv6/ip6_tables.h  |  4 +-
 include/uapi/linux/perf_event.h                 |  2 +-
 include/uapi/linux/pkt_cls.h                    |  4 +-
 include/uapi/linux/raid/md_p.h                  |  2 +-
 include/uapi/linux/random.h                     |  2 +-
 include/uapi/linux/romfs_fs.h                   |  4 +-
 include/uapi/linux/rtnetlink.h                  |  2 +-
 include/uapi/linux/sctp.h                       | 10 ++--
 include/uapi/linux/seg6.h                       |  2 +-
 include/uapi/linux/seg6_iptunnel.h              |  2 +-
 include/uapi/linux/stm.h                        |  2 +-
 include/uapi/linux/target_core_user.h           |  2 +-
 include/uapi/linux/usb/audio.h                  |  2 +-
 include/uapi/linux/usb/cdc.h                    |  6 +--
 include/uapi/linux/usb/ch9.h                    |  2 +-
 include/uapi/linux/usb/raw_gadget.h             |  4 +-
 include/uapi/linux/usbdevice_fs.h               |  4 +-
 include/uapi/linux/vhost_types.h                |  4 +-
 include/uapi/linux/virtio_9p.h                  |  2 +-
 include/uapi/linux/xfrm.h                       | 10 ++--
 include/uapi/rdma/hfi/hfi1_user.h               |  2 +-
 include/uapi/rdma/ib_user_verbs.h               | 72 ++++++++++++-------------
 include/uapi/rdma/rdma_user_cm.h                |  2 +-
 include/uapi/rdma/rdma_user_ioctl_cmds.h        |  2 +-
 include/uapi/scsi/fc/fc_els.h                   | 18 +++----
 include/uapi/scsi/scsi_bsg_fc.h                 |  2 +-
 include/uapi/sound/asound.h                     |  2 +-
 include/uapi/sound/firewire.h                   |  6 +--
 include/uapi/sound/skl-tplg-interface.h         |  2 +-
 include/uapi/sound/sof/header.h                 |  2 +-
 include/uapi/sound/usb_stream.h                 |  2 +-
 tools/arch/x86/include/uapi/asm/kvm.h           | 12 ++---
 tools/include/uapi/drm/i915_drm.h               |  6 +--
 tools/include/uapi/linux/fs.h                   |  2 +-
 tools/include/uapi/linux/if_tun.h               |  2 +-
 tools/include/uapi/linux/kvm.h                  |  8 +--
 tools/include/uapi/linux/perf_event.h           |  2 +-
 tools/include/uapi/linux/pkt_cls.h              |  4 +-
 tools/include/uapi/linux/seg6.h                 |  4 +-
 tools/include/uapi/linux/usbdevice_fs.h         |  4 +-
 tools/include/uapi/sound/asound.h               |  2 +-
 82 files changed, 216 insertions(+), 216 deletions(-)

Comments

pr-tracker-bot@kernel.org Aug. 3, 2022, 3:23 a.m. UTC | #1
The pull request you sent on Mon, 1 Aug 2022 15:31:28 -0500:

> git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e2b542100719a93f8cdf6d90185410d38a57a4c1

Thank you!
Jason Gunthorpe Aug. 18, 2022, 12:28 p.m. UTC | #2
On Mon, Aug 01, 2022 at 03:31:28PM -0500, Gustavo A. R. Silva wrote:
> The following changes since commit b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3:
> 
>   Linux 5.19-rc2 (2022-06-12 16:11:37 -0700)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1
> 
> for you to fetch changes up to 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381:
> 
>   treewide: uapi: Replace zero-length arrays with flexible-array members (2022-06-28 21:26:05 +0200)
> 
> ----------------------------------------------------------------
> flexible-array transformations in UAPI for 6.0-rc1
> 
> Hi Linus,
> 
> Please, pull the following treewide patch that replaces zero-length arrays
> with flexible-array members in UAPI. This patch has been baking in
> linux-next for 5 weeks now.
> 
> -fstrict-flex-arrays=3 is coming and we need to land these changes
> to prevent issues like these in the short future:
> 
> ../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
> but the source string has length 2 (including NUL byte) [-Wfortify-source]
> 		strcpy(de3->name, ".");
> 		^
> 
> Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
> this breaks anything, we can use a union with a new member name.

This has trobuled the RDMA userspace by creating new compiler warnings..

We discussed this and I thought you agreed not to send these changes?

https://lore.kernel.org/linux-rdma/20220628135623.GA25163@embeddedor/

Jason
Gustavo A. R. Silva Aug. 18, 2022, 2:21 p.m. UTC | #3
Hi!

On 8/18/22 07:28, Jason Gunthorpe wrote:
> On Mon, Aug 01, 2022 at 03:31:28PM -0500, Gustavo A. R. Silva wrote:
>> The following changes since commit b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3:
>>
>>    Linux 5.19-rc2 (2022-06-12 16:11:37 -0700)
>>
>> are available in the Git repository at:
>>
>>    git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1
>>
>> for you to fetch changes up to 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381:
>>
>>    treewide: uapi: Replace zero-length arrays with flexible-array members (2022-06-28 21:26:05 +0200)
>>
>> ----------------------------------------------------------------
>> flexible-array transformations in UAPI for 6.0-rc1
>>
>> Hi Linus,
>>
>> Please, pull the following treewide patch that replaces zero-length arrays
>> with flexible-array members in UAPI. This patch has been baking in
>> linux-next for 5 weeks now.
>>
>> -fstrict-flex-arrays=3 is coming and we need to land these changes
>> to prevent issues like these in the short future:
>>
>> ../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
>> but the source string has length 2 (including NUL byte) [-Wfortify-source]
>> 		strcpy(de3->name, ".");
>> 		^
>>
>> Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
>> this breaks anything, we can use a union with a new member name.
> 
> This has trobuled the RDMA userspace by creating new compiler warnings..
>
> We discussed this and I thought you agreed not to send these changes?

Yep; and as I said in that thread, I went and removed all the changes that
were causing trouble, based on this report by 0-day:

https://lore.kernel.org/lkml/202206241055.Eh9MKMAE-lkp@intel.com/

For instance, 0-day reported this warning:

 >> usr/include/rdma/ib_user_verbs.h:1091:2: warning: field '' with variable sized type 'union ib_uverbs_flow_spec_gre::(anonymous at 
usr/include/rdma/ib_user_verbs.h:1091:2)' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
            union {
            ^

then I went to look for the union ib_uverbs_flow_spec_gre and reverted the
change that was causing trouble in struct ib_uverbs_flow_spec_hdr:

gus@work:~/gustavoars-linux$ git grep -nwW 'ib_uverbs_flow_spec_gre\s{'

include/uapi/rdma/ib_user_verbs.h:1090:struct ib_uverbs_flow_spec_gre {

include/uapi/rdma/ib_user_verbs.h-1091- union {

include/uapi/rdma/ib_user_verbs.h-1092-         struct ib_uverbs_flow_spec_hdr hdr;

include/uapi/rdma/ib_user_verbs.h-1093-         struct {

include/uapi/rdma/ib_user_verbs.h-1094-                 __u32 type;

include/uapi/rdma/ib_user_verbs.h-1095-                 __u16 size;

include/uapi/rdma/ib_user_verbs.h-1096-                 __u16 reserved;

include/uapi/rdma/ib_user_verbs.h-1097-         };

include/uapi/rdma/ib_user_verbs.h-1098- };

include/uapi/rdma/ib_user_verbs.h-1099- struct ib_uverbs_flow_gre_filter     val;

include/uapi/rdma/ib_user_verbs.h-1100- struct ib_uverbs_flow_gre_filter     mask;

include/uapi/rdma/ib_user_verbs.h-1101-};

gus@work:~/gustavoars-linux$ git grep -nwW 'struct\sib_uverbs_flow_spec_hdr\s{'

include/uapi/rdma/ib_user_verbs.h:900:struct ib_uverbs_flow_spec_hdr {

include/uapi/rdma/ib_user_verbs.h-901-  __u32 type;

include/uapi/rdma/ib_user_verbs.h-902-  __u16 size;

include/uapi/rdma/ib_user_verbs.h-903-  __u16 reserved;

include/uapi/rdma/ib_user_verbs.h-904-  /* followed by flow_spec */

include/uapi/rdma/ib_user_verbs.h-905-  __aligned_u64 flow_spec_data[0];

include/uapi/rdma/ib_user_verbs.h-906-};

and the issue that you reported in:

https://lore.kernel.org/linux-rdma/20220628004052.GM23621@ziepe.ca/

was fixed at the time:

$ git grep -nwW 'struct\sib_uverbs_create_cq_resp\s{'

include/uapi/rdma/ib_user_verbs.h:429:struct ib_uverbs_create_cq_resp {

include/uapi/rdma/ib_user_verbs.h-430-  __u32 cq_handle;

include/uapi/rdma/ib_user_verbs.h-431-  __u32 cqe;

include/uapi/rdma/ib_user_verbs.h-432-  __aligned_u64 driver_data[0];

include/uapi/rdma/ib_user_verbs.h-433-};

However, it would be helpful to know all the details about the warnings
that you are seeing now, so I can take a look. :)

Thanks
--
Gustavo

> 
> https://lore.kernel.org/linux-rdma/20220628135623.GA25163@embeddedor/
> 
> Jason
Jason Gunthorpe Aug. 18, 2022, 6:43 p.m. UTC | #4
On Thu, Aug 18, 2022 at 09:21:54AM -0500, Gustavo A. R. Silva wrote:
> Hi!
> 
> On 8/18/22 07:28, Jason Gunthorpe wrote:
> > On Mon, Aug 01, 2022 at 03:31:28PM -0500, Gustavo A. R. Silva wrote:
> > > The following changes since commit b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3:
> > > 
> > >    Linux 5.19-rc2 (2022-06-12 16:11:37 -0700)
> > > 
> > > are available in the Git repository at:
> > > 
> > >    git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-transformations-UAPI-6.0-rc1
> > > 
> > > for you to fetch changes up to 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381:
> > > 
> > >    treewide: uapi: Replace zero-length arrays with flexible-array members (2022-06-28 21:26:05 +0200)
> > > 
> > > ----------------------------------------------------------------
> > > flexible-array transformations in UAPI for 6.0-rc1
> > > 
> > > Hi Linus,
> > > 
> > > Please, pull the following treewide patch that replaces zero-length arrays
> > > with flexible-array members in UAPI. This patch has been baking in
> > > linux-next for 5 weeks now.
> > > 
> > > -fstrict-flex-arrays=3 is coming and we need to land these changes
> > > to prevent issues like these in the short future:
> > > 
> > > ../fs/minix/dir.c:337:3: warning: 'strcpy' will always overflow; destination buffer has size 0,
> > > but the source string has length 2 (including NUL byte) [-Wfortify-source]
> > > 		strcpy(de3->name, ".");
> > > 		^
> > > 
> > > Since these are all [0] to [] changes, the risk to UAPI is nearly zero. If
> > > this breaks anything, we can use a union with a new member name.
> > 
> > This has trobuled the RDMA userspace by creating new compiler warnings..
> > 
> > We discussed this and I thought you agreed not to send these changes?
> 
> Yep; and as I said in that thread, I went and removed all the changes that
> were causing trouble, based on this report by 0-day:
> 
> https://lore.kernel.org/lkml/202206241055.Eh9MKMAE-lkp@intel.com/
> 
> For instance, 0-day reported this warning:

Yes, I took it for granted that the patch wouldn't cause more kernel
warnings :)

So, this is what we ended up doing in userspace:

https://github.com/linux-rdma/rdma-core/pull/1207

So, maybe it is OK.

Jason