Re: [PATCH] ALSA: emu10k1: Require CAP_SYS_ADMIN for SNDRV_EMU10K1_IOCTL_PCM_POKE
From: Takashi Iwai
Date: Mon Nov 23 2026 - 04:49:42 EST
On Mon, 23 Nov 2026 01:36:20 +0100,
Suyuan Wang via B4 Relay wrote:
>
> From: Suyuan Wang <stevewong@xxxxxxxxxxx>
>
> snd_emu10k1_fx8010_ioctl() requires CAP_SYS_ADMIN for the commands that
> change the FX8010 DSP state: CODE_POKE, TRAM_SETUP, STOP, CONTINUE,
> ZERO_TRAM_COUNTER and SINGLE_STEP. PCM_POKE has no such check, although
> it changes the card's FX8010 PCM configuration. snd_emu10k1_ipcm_poke()
> stores the GPR and TRAM indices given by the caller without checking
> them, and the FX8010 PCM code in emupcm.c later uses them as register
> offsets:
>
> snd_emu10k1_ptr_write(emu,
> TANKMEMADDRREGBASE + 0x80 + pcm->etram[i], ...);
> snd_emu10k1_ptr_write(emu, emu->gpr_base + pcm->gpr_trigger, 0, 1);
>
> So a process that can open the hwdep device can change this card-wide
> configuration, including which registers the PCM code writes, while the
> other DSP configuration commands are limited to CAP_SYS_ADMIN.
>
> Require CAP_SYS_ADMIN for PCM_POKE too, like the other FX8010
> configuration commands.
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
> Signed-off-by: Kaixuan Li <kaixuan.li@xxxxxxxxxx>
> Signed-off-by: Suyuan Wang <stevewong@xxxxxxxxxxx>
Applied to for-next branch. Thanks.
Takashi