* [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace
@ 2024-12-16 9:33 Arnd Bergmann
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Arnd Bergmann @ 2024-12-16 9:33 UTC (permalink / raw)
To: Vinod Koul, Jaroslav Kysela, Takashi Iwai,
Amadeusz Sławiński
Cc: Arnd Bergmann, Yu Jiaoliang, Peter Ujfalusi, linux-sound,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The compression offload code cannot be in a loadable module unless it
imports that namespace:
ERROR: modpost: module snd-compress uses symbol dma_buf_get from namespace DMA_BUF, but does not import it.
ERROR: modpost: module snd-compress uses symbol dma_buf_put from namespace DMA_BUF, but does not import it.
ERROR: modpost: module snd-compress uses symbol dma_buf_fd from namespace DMA_BUF, but does not import it.
Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/core/compress_offload.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 86ed2fbee0c8..ec2485c00e49 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -1247,6 +1247,7 @@ void snd_compr_task_finished(struct snd_compr_stream *stream,
}
EXPORT_SYMBOL_GPL(snd_compr_task_finished);
+MODULE_IMPORT_NS("DMA_BUF");
#endif /* CONFIG_SND_COMPRESS_ACCEL */
static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user()
2024-12-16 9:33 [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Arnd Bergmann
@ 2024-12-16 9:33 ` Arnd Bergmann
2024-12-16 10:16 ` Shengjiu Wang
2024-12-16 16:28 ` Vinod Koul
2024-12-16 10:15 ` [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Shengjiu Wang
` (2 subsequent siblings)
3 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2024-12-16 9:33 UTC (permalink / raw)
To: Vinod Koul, Jaroslav Kysela, Takashi Iwai,
Amadeusz Sławiński
Cc: Arnd Bergmann, Yu Jiaoliang, Peter Ujfalusi, linux-sound,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
On some architectures, get_user() cannot read a 64-bit user variable:
arm-linux-gnueabi-ld: sound/core/compress_offload.o: in function `snd_compr_ioctl':
compress_offload.c:(.text.snd_compr_ioctl+0x538): undefined reference to `__get_user_bad'
Use an equivalent copy_from_user() instead.
Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/core/compress_offload.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index ec2485c00e49..1d6769a66810 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -1180,9 +1180,9 @@ static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg
if (stream->runtime->state != SNDRV_PCM_STATE_SETUP)
return -EPERM;
- retval = get_user(seqno, (__u64 __user *)arg);
- if (retval < 0)
- return retval;
+ retval = copy_from_user(&seqno, (__u64 __user *)arg, sizeof(seqno));
+ if (retval)
+ return -EFAULT;
retval = 0;
if (seqno == 0) {
list_for_each_entry_reverse(task, &stream->runtime->tasks, list)
--
2.39.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace
2024-12-16 9:33 [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Arnd Bergmann
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
@ 2024-12-16 10:15 ` Shengjiu Wang
2024-12-16 16:28 ` Vinod Koul
2024-12-20 8:50 ` Takashi Iwai
3 siblings, 0 replies; 7+ messages in thread
From: Shengjiu Wang @ 2024-12-16 10:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Vinod Koul, Jaroslav Kysela, Takashi Iwai,
Amadeusz Sławiński, Arnd Bergmann, Yu Jiaoliang,
Peter Ujfalusi, linux-sound, linux-kernel
On Mon, Dec 16, 2024 at 5:34 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The compression offload code cannot be in a loadable module unless it
> imports that namespace:
>
> ERROR: modpost: module snd-compress uses symbol dma_buf_get from namespace DMA_BUF, but does not import it.
> ERROR: modpost: module snd-compress uses symbol dma_buf_put from namespace DMA_BUF, but does not import it.
> ERROR: modpost: module snd-compress uses symbol dma_buf_fd from namespace DMA_BUF, but does not import it.
>
> Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Best regards
Shengjiu Wang
> ---
> sound/core/compress_offload.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index 86ed2fbee0c8..ec2485c00e49 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -1247,6 +1247,7 @@ void snd_compr_task_finished(struct snd_compr_stream *stream,
> }
> EXPORT_SYMBOL_GPL(snd_compr_task_finished);
>
> +MODULE_IMPORT_NS("DMA_BUF");
> #endif /* CONFIG_SND_COMPRESS_ACCEL */
>
> static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user()
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
@ 2024-12-16 10:16 ` Shengjiu Wang
2024-12-16 16:28 ` Vinod Koul
1 sibling, 0 replies; 7+ messages in thread
From: Shengjiu Wang @ 2024-12-16 10:16 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Vinod Koul, Jaroslav Kysela, Takashi Iwai,
Amadeusz Sławiński, Arnd Bergmann, Yu Jiaoliang,
Peter Ujfalusi, linux-sound, linux-kernel
On Mon, Dec 16, 2024 at 5:34 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> On some architectures, get_user() cannot read a 64-bit user variable:
>
> arm-linux-gnueabi-ld: sound/core/compress_offload.o: in function `snd_compr_ioctl':
> compress_offload.c:(.text.snd_compr_ioctl+0x538): undefined reference to `__get_user_bad'
>
> Use an equivalent copy_from_user() instead.
>
> Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Best regards
Shengjiu Wang
> ---
> sound/core/compress_offload.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index ec2485c00e49..1d6769a66810 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -1180,9 +1180,9 @@ static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg
>
> if (stream->runtime->state != SNDRV_PCM_STATE_SETUP)
> return -EPERM;
> - retval = get_user(seqno, (__u64 __user *)arg);
> - if (retval < 0)
> - return retval;
> + retval = copy_from_user(&seqno, (__u64 __user *)arg, sizeof(seqno));
> + if (retval)
> + return -EFAULT;
> retval = 0;
> if (seqno == 0) {
> list_for_each_entry_reverse(task, &stream->runtime->tasks, list)
> --
> 2.39.5
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace
2024-12-16 9:33 [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Arnd Bergmann
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
2024-12-16 10:15 ` [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Shengjiu Wang
@ 2024-12-16 16:28 ` Vinod Koul
2024-12-20 8:50 ` Takashi Iwai
3 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2024-12-16 16:28 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jaroslav Kysela, Takashi Iwai, Amadeusz Sławiński,
Arnd Bergmann, Yu Jiaoliang, Peter Ujfalusi, linux-sound,
linux-kernel
On 16-12-24, 10:33, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The compression offload code cannot be in a loadable module unless it
> imports that namespace:
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user()
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
2024-12-16 10:16 ` Shengjiu Wang
@ 2024-12-16 16:28 ` Vinod Koul
1 sibling, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2024-12-16 16:28 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Jaroslav Kysela, Takashi Iwai, Amadeusz Sławiński,
Arnd Bergmann, Yu Jiaoliang, Peter Ujfalusi, linux-sound,
linux-kernel
On 16-12-24, 10:33, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> On some architectures, get_user() cannot read a 64-bit user variable:
>
> arm-linux-gnueabi-ld: sound/core/compress_offload.o: in function `snd_compr_ioctl':
> compress_offload.c:(.text.snd_compr_ioctl+0x538): undefined reference to `__get_user_bad'
>
> Use an equivalent copy_from_user() instead.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace
2024-12-16 9:33 [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Arnd Bergmann
` (2 preceding siblings ...)
2024-12-16 16:28 ` Vinod Koul
@ 2024-12-20 8:50 ` Takashi Iwai
3 siblings, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2024-12-20 8:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Vinod Koul, Jaroslav Kysela, Takashi Iwai,
Amadeusz Sławiński, Arnd Bergmann, Yu Jiaoliang,
Peter Ujfalusi, linux-sound, linux-kernel
On Mon, 16 Dec 2024 10:33:40 +0100,
Arnd Bergmann wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The compression offload code cannot be in a loadable module unless it
> imports that namespace:
>
> ERROR: modpost: module snd-compress uses symbol dma_buf_get from namespace DMA_BUF, but does not import it.
> ERROR: modpost: module snd-compress uses symbol dma_buf_put from namespace DMA_BUF, but does not import it.
> ERROR: modpost: module snd-compress uses symbol dma_buf_fd from namespace DMA_BUF, but does not import it.
>
> Fixes: 04177158cf98 ("ALSA: compress_offload: introduce accel operation mode")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Sorry for the delay, as I've been (still) off.
Applied both patches now. Thanks!
Takashi
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-20 8:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 9:33 [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Arnd Bergmann
2024-12-16 9:33 ` [PATCH 2/2] ALSA: compress_offload: avoid 64-bit get_user() Arnd Bergmann
2024-12-16 10:16 ` Shengjiu Wang
2024-12-16 16:28 ` Vinod Koul
2024-12-16 10:15 ` [PATCH 1/2] ALSA: compress_offload: import DMA_BUF namespace Shengjiu Wang
2024-12-16 16:28 ` Vinod Koul
2024-12-20 8:50 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).