All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
	linux-kselftest@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>,
	Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v2] kselftest: alsa: Add simplistic test for ALSA mixer controls kselftest
Date: Wed, 8 Dec 2021 14:14:39 -0700	[thread overview]
Message-ID: <f18f28f8-fb78-3ddd-153e-40675e5e6e8e@linuxfoundation.org> (raw)
In-Reply-To: <YbERo5FxA6Rm3bhd@sirena.org.uk>

On 12/8/21 1:12 PM, Mark Brown wrote:
> On Wed, Dec 08, 2021 at 11:59:18AM -0700, Shuah Khan wrote:
>> On 12/8/21 11:39 AM, Mark Brown wrote:
>>> On Wed, Dec 08, 2021 at 10:42:35AM -0700, Shuah Khan wrote:
> 
>>>>> +	snd_ctl_elem_value_alloca(&val);
> 
>>> This is idiomatic for alsa-lib code.
> 
>> This is kernel code that is going into kernel sources. Why follow
>> alsa-lib convention?
> 
> Well, the kernel doesn't generally use alloca() as a pattern given the
> relatively small stack sizes we have and doesn't define helpers like
> these for it...  it's a toss up here between the conventions for use of
> the library we're using and the conventions of the kernel.
> 
>>>>> +	ksft_print_header();
> 
>>>> Add a check for root and skil the test.
> 
>>> There is no need for this test to run as root in most configurations,
>>> it is common to provide direct access to the sound cards to some or all
>>> users - for example with desktop distros the entire userspace audio
>>> subsystem normally runs as the logged in user by default.  alsa-lib's
> 
>> On my system, I don't see any output if run as root. Are there some tests
>> that work as non-root?
> 
> All of them work as non-root if the user they're running as has access
> to a card, if they do or not is system dependent - there may not be any
> cards at all in a given system to find.  Running as root will punch
> through most permission problems but it's not a requirement and a system
> could use a security module like SELinux to restrict what root can do.
> The sound devices are usually in /dev/snd, though userspace can place
> them where it wants - if run as a user that can access the relevant
> devices for the mixer interface (usually /dev/snd/controlC* though again
> userspace can rename them) then the tests will run on those devices.
> 

Sounds good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

WARNING: multiple messages have this Message-ID (diff)
From: Shuah Khan <skhan@linuxfoundation.org>
To: Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>, Shuah Khan <shuah@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>,
	linux-kselftest@vger.kernel.org, alsa-devel@alsa-project.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] kselftest: alsa: Add simplistic test for ALSA mixer controls kselftest
Date: Wed, 8 Dec 2021 14:14:39 -0700	[thread overview]
Message-ID: <f18f28f8-fb78-3ddd-153e-40675e5e6e8e@linuxfoundation.org> (raw)
In-Reply-To: <YbERo5FxA6Rm3bhd@sirena.org.uk>

On 12/8/21 1:12 PM, Mark Brown wrote:
> On Wed, Dec 08, 2021 at 11:59:18AM -0700, Shuah Khan wrote:
>> On 12/8/21 11:39 AM, Mark Brown wrote:
>>> On Wed, Dec 08, 2021 at 10:42:35AM -0700, Shuah Khan wrote:
> 
>>>>> +	snd_ctl_elem_value_alloca(&val);
> 
>>> This is idiomatic for alsa-lib code.
> 
>> This is kernel code that is going into kernel sources. Why follow
>> alsa-lib convention?
> 
> Well, the kernel doesn't generally use alloca() as a pattern given the
> relatively small stack sizes we have and doesn't define helpers like
> these for it...  it's a toss up here between the conventions for use of
> the library we're using and the conventions of the kernel.
> 
>>>>> +	ksft_print_header();
> 
>>>> Add a check for root and skil the test.
> 
>>> There is no need for this test to run as root in most configurations,
>>> it is common to provide direct access to the sound cards to some or all
>>> users - for example with desktop distros the entire userspace audio
>>> subsystem normally runs as the logged in user by default.  alsa-lib's
> 
>> On my system, I don't see any output if run as root. Are there some tests
>> that work as non-root?
> 
> All of them work as non-root if the user they're running as has access
> to a card, if they do or not is system dependent - there may not be any
> cards at all in a given system to find.  Running as root will punch
> through most permission problems but it's not a requirement and a system
> could use a security module like SELinux to restrict what root can do.
> The sound devices are usually in /dev/snd, though userspace can place
> them where it wants - if run as a user that can access the relevant
> devices for the mixer interface (usually /dev/snd/controlC* though again
> userspace can rename them) then the tests will run on those devices.
> 

Sounds good to me.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

  reply	other threads:[~2021-12-08 21:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 16:03 [PATCH v2] kselftest: alsa: Add simplistic test for ALSA mixer controls kselftest Mark Brown
2021-12-06 16:03 ` Mark Brown
2021-12-06 16:27 ` Pierre-Louis Bossart
2021-12-06 16:31   ` Pierre-Louis Bossart
2021-12-06 16:39   ` Mark Brown
2021-12-06 16:39     ` Mark Brown
2021-12-06 17:01     ` Pierre-Louis Bossart
2021-12-06 18:17       ` Mark Brown
2021-12-07  3:20 ` Takashi Sakamoto
2021-12-07  3:20   ` Takashi Sakamoto
2021-12-07  8:05   ` Jaroslav Kysela
2021-12-07 14:25   ` Mark Brown
2021-12-07 14:36     ` Takashi Iwai
2021-12-07 14:36       ` Takashi Iwai
2021-12-07 14:49       ` Mark Brown
2021-12-07 14:49         ` Mark Brown
2021-12-08 14:26     ` Takashi Sakamoto
2021-12-08 14:31       ` Takashi Sakamoto
2021-12-08 16:07       ` Mark Brown
2021-12-08 16:07         ` Mark Brown
2021-12-08 17:42 ` Shuah Khan
2021-12-08 17:42   ` Shuah Khan
2021-12-08 18:39   ` Mark Brown
2021-12-08 18:39     ` Mark Brown
2021-12-08 18:59     ` Shuah Khan
2021-12-08 18:59       ` Shuah Khan
2021-12-08 20:12       ` Mark Brown
2021-12-08 20:12         ` Mark Brown
2021-12-08 21:14         ` Shuah Khan [this message]
2021-12-08 21:14           ` Shuah Khan

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=f18f28f8-fb78-3ddd-153e-40675e5e6e8e@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.