All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>,
	Bard liao <yung-chuan.liao@linux.intel.com>
Cc: daniel.baluta@gmail.com, andriy.shevchenko@intel.com,
	alsa-devel@alsa-project.org, liam.r.girdwood@linux.intel.com,
	vkoul@kernel.org, broonie@kernel.org,
	sound-open-firmware@alsa-project.org, alan@linux.intel.com
Subject: Re: [PATCH v3 09/14] ASoC: SOF: Add firmware, loader support
Date: Thu, 20 Dec 2018 09:07:54 -0600	[thread overview]
Message-ID: <05d38b48-559f-75ce-6299-e1dfd3a62c30@linux.intel.com> (raw)
In-Reply-To: <s5h8t0kobov.wl-tiwai@suse.de>


>>>> +		snd_sof_dsp_block_write(sdev, offset,
>>>> +					(void *)block + sizeof(*block),
>>>> +					block->size);
>>>> +
>>>> +		/* next block */
>>>> +		block = (void *)block + sizeof(*block) + block->size;
>>> This may lead to an unaligned access.
>> Did you mean we should double check the block->size to
>> prevent access to an invalid address?
> You need two types of checks for the given data:
> - The bounce check of block->size;
>    We need to avoid out-of-bounce access.
s/bounce/bounds ?
>
> - Alignment of block->size;
>    For some non-x86 platforms, the access to an unaligned address might
>    be illegal.

Maybe I am missing something but I don't see any sort of explicit 
restriction on alignment in the SOF tools. it looks implicit based on 
address offsets and bases.

Liam, do you see any negative side effects if we enforce a 32-bit 
alignment for all blocks (which essentially means all block sizes are 
multiple of 4)? we can try and experiment but it's better if we have an 
agreement on the design.

>
> Oh, and recently another thing is sometimes needed for avoiding
> Spectre.  This can be covered by array_index_nospec().
>
>
>>> Also how is the endianess guaranteed?
>> Did you mean we should guarantee the driver can work no
>> matter what kernel's endianess is?
>> ie. Use le32_to_cpu() to handle it?
> Depends on the implementation.  IIRC, topology API refuses the data
> in a different endianess by checking the magic number at beginning.
snd_sof_dsp_block_write() is implemented with a platform-specific 
callback, I'd expect any endianess issues to be handled in that 
platform-specific code?

  reply	other threads:[~2018-12-20 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3934.1544619824.753.alsa-devel@alsa-project.org>
2018-12-20  2:11 ` [PATCH v3 09/14] ASoC: SOF: Add firmware, loader support Bard liao
2018-12-20  8:16   ` Takashi Iwai
2018-12-20 15:07     ` Pierre-Louis Bossart [this message]
2018-12-21  9:05       ` Bard liao
2018-12-21  9:57         ` Takashi Iwai
2018-12-21 15:43           ` Liam Girdwood
2018-12-11 21:23 [PATCH v3 00/14] Sound Open Firmware (SOF) core Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 09/14] ASoC: SOF: Add firmware loader support Pierre-Louis Bossart
2018-12-11 22:38   ` Andy Shevchenko
2018-12-11 23:54     ` Pierre-Louis Bossart
2019-01-09 20:55       ` Mark Brown
2018-12-12 11:23   ` Takashi Iwai
2019-01-09 21:02   ` Mark Brown
2019-01-09 21:24     ` Pierre-Louis Bossart

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=05d38b48-559f-75ce-6299-e1dfd3a62c30@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.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 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.