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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 13 Jun 2023 16:52:08 -0600
From:   "Gustavo A. R. Silva" <gustavoars@...nel.org>
To:     Kees Cook <keescook@...omium.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        kernel test robot <oliver.sang@...el.com>,
        kernel test robot <lkp@...el.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Jó Ágila Bitsch <jgilab@...il.com>,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] usb: ch9: Replace 1-element array with flexible array

On Tue, Jun 13, 2023 at 02:04:04PM -0700, Kees Cook wrote:
> With "-fstrict-flex-arrays=3" enabled, UBSAN_BOUNDS no longer pretends
> 1-element arrays are unbounded. Walking wData will trigger a warning,
> so make it a proper flexible array. Add a union to keep the struct size
> identical for userspace in case anything was depending on the old size.
> 
> Reported-by: kernel test robot <oliver.sang@...el.com>
> Closes: https://lore.kernel.org/oe-lkp/202306102333.8f5a7443-oliver.sang@intel.com
> Fixes: df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")

I always have mixed feelings about a 'Fixes' tag applied to a commit
like this (one that enables a compiler option that avoids the introduction
of buggy code), when we are addressing the potentially buggy code that
the option is inteded to prevent. (thinkingface)

> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: kernel test robot <lkp@...el.com>
> Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: "Jó Ágila Bitsch" <jgilab@...il.com>
> Signed-off-by: Kees Cook <keescook@...omium.org>

Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>

Thanks!
--
Gustavo

> ---
>  include/uapi/linux/usb/ch9.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
> index b17e3a21b15f..82ec6af71a1d 100644
> --- a/include/uapi/linux/usb/ch9.h
> +++ b/include/uapi/linux/usb/ch9.h
> @@ -376,7 +376,10 @@ struct usb_string_descriptor {
>  	__u8  bLength;
>  	__u8  bDescriptorType;
>  
> -	__le16 wData[1];		/* UTF-16LE encoded */
> +	union {
> +		__le16 legacy_padding;
> +		__DECLARE_FLEX_ARRAY(__le16, wData);	/* UTF-16LE encoded */
> +	};
>  } __attribute__ ((packed));
>  
>  /* note that "string" zero is special, it holds language codes that
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ