]> git.alsa-project.org Git - alsa-lib.git/commit
control_hw: Fix issue when applying seccomp policy
authorHsin-Yu Chao <hychao@chromium.org>
Fri, 17 Aug 2018 03:12:27 +0000 (11:12 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sun, 19 Aug 2018 08:08:49 +0000 (10:08 +0200)
commita84916364c1884ba07f5ae5a871b6995e49d6f9a
treea4b41ffcd83950d2f2aee422f36c620e158bdcec
parent040cfea1778a06e2e0e0a73a3e580b5a2c19ecb4
control_hw: Fix issue when applying seccomp policy

When seccomp policy is applied to filter ioctl syscall with
SNDRV_CTL_IOCTL_TLV_COMMAND, SNDRV_CTL_IOCTL_TLV_READ and
SNDRV_CTL_IOCTL_TLV_WRITE in whiltelist, alsa-lib still breaks
in at snd_ctl_hw_elem_tlv().

The problem behind is because ioctl() takes unsigned long cmd
argument, and the signed bit of local int variable could cause
0xff bytes appended after casted to unsigned long.
In kernel, seccomp data struct takes 64 bits argument to check
against seccomp rules, these unexpected 0xff bytes could make
the rule check fail.

Fix the problem by passing unsigned int to ioctl.

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/control_hw.c