Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	linux-sound@vger.kernel.org, llvm@lists.linux.dev,
	patches@lists.linux.dev, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] ALSA: pcm: Revert bufs move in snd_pcm_xfern_frames_ioctl()
Date: Wed, 07 Jan 2026 09:05:10 +0100	[thread overview]
Message-ID: <87jyxtetl5.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260106-pcm_native-revert-var-move-free-for-old-clang-v1-1-06a03693423d@kernel.org>

On Wed, 07 Jan 2026 00:08:18 +0100,
Nathan Chancellor wrote:
> 
> When building with clang older than 17 targeting architectures that use
> asm goto for their get_user() and put_user(), such as arm64, after
> commit f3d233daf011 ("ALSA: pcm: Relax __free() variable declarations"),
> there are bogus errors around skipping over a variable declared with the
> cleanup attribute:
> 
>   sound/core/pcm_native.c:3308:6: error: cannot jump from this asm goto statement to one of its possible targets
>           if (put_user(result, &_xfern->result))
>               ^
>   ...
>   arch/arm64/include/asm/uaccess.h:298:2: note: expanded from macro '__put_mem_asm'
>           asm goto(
>           ^
>   sound/core/pcm_native.c:3295:6: note: possible target of asm goto statement
>           if (put_user(0, &_xfern->result))
>               ^
>   ...
>   sound/core/pcm_native.c:3300:8: note: jump exits scope of variable with __attribute__((cleanup))
>           void *bufs __free(kfree) =
>                 ^
> 
> clang-17 fixed a bug in clang's jump scope checker [1] where all labels
> in a function were checked as valid targets for all asm goto instances
> in a function, regardless of whether they were actual targets in a
> paricular asm goto's provided list of labels.
> 
> To workaround this, revert the change done to
> snd_pcm_xfern_frames_ioctl() by commit f3d233daf011 ("ALSA: pcm: Relax
> __free() variable declarations") to avoid a variable declared with
> cleanup from existing between multiple uses of asm goto. There are no
> other uses of cleanup in this function so there should be low risk from
> moving this variable back to the top of the function.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/1886 [1]
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512190802.i4Jzbcsl-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

I hoped that this mess is addressed in the put_user() side, but it
doesn't seem happening, so I took your workaround now.


thanks,

Takashi

      reply	other threads:[~2026-01-07  8:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06 23:08 [PATCH] ALSA: pcm: Revert bufs move in snd_pcm_xfern_frames_ioctl() Nathan Chancellor
2026-01-07  8:05 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jyxtetl5.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=justinstitt@google.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=patches@lists.linux.dev \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox