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]
Message-ID: <20230809153755.GA832145@dev-arch.thelio-3990X>
Date:   Wed, 9 Aug 2023 08:37:55 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Christian König <christian.koenig@....com>
Cc:     boris.brezillon@...labora.com, ndesaulniers@...gle.com,
        maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
        tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch,
        trix@...hat.com, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
        naresh.kamboju@...aro.org, dakr@...hat.com
Subject: Re: [PATCH 1/2] drm/exec: use unique instead of local label

Hi Christian,

Can this be applied to drm-misc? Other drivers are starting to make use
of this API and our builds with clang-17 and clang-18 have been broken
for some time due to this.

Cheers,
Nathan

On Mon, Jul 31, 2023 at 02:36:24PM +0200, Christian König wrote:
> GCC forbids to jump to labels in loop conditions and a new clang
> check stumbled over this.
> 
> So instead using a local label inside the loop condition use an
> unique label outside of it.
> 
> Fixes: commit 09593216bff1 ("drm: execution context for GEM buffers v7")
> Link: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
> Link: https://github.com/ClangBuiltLinux/linux/issues/1890
> Link: https://github.com/llvm/llvm-project/commit/20219106060208f0c2f5d096eb3aed7b712f5067
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
> CC: Boris Brezillon <boris.brezillon@...labora.com>
> Signed-off-by: Christian König <christian.koenig@....com>
> ---
>  include/drm/drm_exec.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/drm/drm_exec.h b/include/drm/drm_exec.h
> index 73205afec162..e0462361adf9 100644
> --- a/include/drm/drm_exec.h
> +++ b/include/drm/drm_exec.h
> @@ -3,6 +3,7 @@
>  #ifndef __DRM_EXEC_H__
>  #define __DRM_EXEC_H__
>  
> +#include <linux/compiler.h>
>  #include <linux/ww_mutex.h>
>  
>  #define DRM_EXEC_INTERRUPTIBLE_WAIT	BIT(0)
> @@ -74,13 +75,12 @@ struct drm_exec {
>   * Since labels can't be defined local to the loops body we use a jump pointer
>   * to make sure that the retry is only used from within the loops body.
>   */
> -#define drm_exec_until_all_locked(exec)				\
> -	for (void *__drm_exec_retry_ptr; ({			\
> -		__label__ __drm_exec_retry;			\
> -__drm_exec_retry:						\
> -		__drm_exec_retry_ptr = &&__drm_exec_retry;	\
> -		(void)__drm_exec_retry_ptr;			\
> -		drm_exec_cleanup(exec);				\
> +#define drm_exec_until_all_locked(exec)					\
> +__PASTE(__drm_exec_, __LINE__):						\
> +	for (void *__drm_exec_retry_ptr; ({				\
> +		__drm_exec_retry_ptr = &&__PASTE(__drm_exec_, __LINE__);\
> +		(void)__drm_exec_retry_ptr;				\
> +		drm_exec_cleanup(exec);					\
>  	});)
>  
>  /**
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ