lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200418213828.GA10666@embeddedor>
Date:   Sat, 18 Apr 2020 16:38:28 -0500
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Kees Cook <keescook@...omium.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [GIT PULL] flexible-array member convertion patches for 5.7-rc2

The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:

  Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-member-5.7-rc2

for you to fetch changes up to 43951585e1308b322c8ee31a4aafd08213f5c5d7:

  xattr.h: Replace zero-length array with flexible-array member (2020-04-18 15:44:56 -0500)

----------------------------------------------------------------
flexible-array member convertion patches for 5.7-rc2

Hi Linus,

Please, pull the following patches that replace zero-length arrays with
flexible-array members.

The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member convertions) will also
help to get completely rid of those sorts of issues.

Notice that all of these patches have been baking in linux-next for
quite a while now and, 238 more of these patches have already been
merged into 5.7-rc1.

There are a couple hundred more of these issues waiting to be addressed
in the whole codebase.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Thanks

----------------------------------------------------------------
Gustavo A. R. Silva (28):
      bio: Replace zero-length array with flexible-array member
      blk-mq: Replace zero-length array with flexible-array member
      blk_types: Replace zero-length array with flexible-array member
      can: dev: peak_canfd.h: Replace zero-length array with flexible-array member
      digsig.h: Replace zero-length array with flexible-array member
      dirent.h: Replace zero-length array with flexible-array member
      enclosure.h: Replace zero-length array with flexible-array member
      energy_model.h: Replace zero-length array with flexible-array member
      ethtool.h: Replace zero-length array with flexible-array member
      genalloc.h: Replace zero-length array with flexible-array member
      igmp.h: Replace zero-length array with flexible-array member
      ihex.h: Replace zero-length array with flexible-array member
      irq.h: Replace zero-length array with flexible-array member
      lib: cpu_rmap: Replace zero-length array with flexible-array member
      list_lru.h: Replace zero-length array with flexible-array member
      memcontrol.h: Replace zero-length array with flexible-array member
      platform_data: wilco-ec.h: Replace zero-length array with flexible-array member
      posix_acl.h: Replace zero-length array with flexible-array member
      rio.h: Replace zero-length array with flexible-array member
      rslib.h: Replace zero-length array with flexible-array member
      sched: topology.h: Replace zero-length array with flexible-array member
      skbuff.h: Replace zero-length array with flexible-array member
      swap.h: Replace zero-length array with flexible-array member
      ti_wilink_st.h: Replace zero-length array with flexible-array member
      tpm_eventlog.h: Replace zero-length array with flexible-array member
      uapi: linux: dlm_device.h: Replace zero-length array with flexible-array member
      uapi: linux: fiemap.h: Replace zero-length array with flexible-array member
      xattr.h: Replace zero-length array with flexible-array member

 include/linux/bio.h                    | 2 +-
 include/linux/blk-mq.h                 | 2 +-
 include/linux/blk_types.h              | 2 +-
 include/linux/can/dev/peak_canfd.h     | 4 ++--
 include/linux/cpu_rmap.h               | 2 +-
 include/linux/digsig.h                 | 4 ++--
 include/linux/dirent.h                 | 2 +-
 include/linux/enclosure.h              | 2 +-
 include/linux/energy_model.h           | 2 +-
 include/linux/ethtool.h                | 4 ++--
 include/linux/genalloc.h               | 2 +-
 include/linux/igmp.h                   | 2 +-
 include/linux/ihex.h                   | 2 +-
 include/linux/irq.h                    | 4 ++--
 include/linux/list_lru.h               | 2 +-
 include/linux/memcontrol.h             | 4 ++--
 include/linux/platform_data/wilco-ec.h | 2 +-
 include/linux/posix_acl.h              | 2 +-
 include/linux/rio.h                    | 4 ++--
 include/linux/rslib.h                  | 2 +-
 include/linux/sched/topology.h         | 2 +-
 include/linux/skbuff.h                 | 2 +-
 include/linux/swap.h                   | 2 +-
 include/linux/ti_wilink_st.h           | 6 +++---
 include/linux/tpm_eventlog.h           | 6 +++---
 include/linux/xattr.h                  | 2 +-
 include/uapi/linux/dlm_device.h        | 4 ++--
 include/uapi/linux/fiemap.h            | 2 +-
 28 files changed, 39 insertions(+), 39 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ