Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1506292

Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer to rng->read()

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer to rng->read()
Date 2016-10-21 23:10 +0200
Message-ID <suPeG-2CB-13@gated-at.bofh.it> (permalink)
References <suOVj-2gP-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Oct 21, 2016 at 1:48 PM, Laszlo Ersek <lersek@redhat.com> wrote:
> The virtio-rng backend for hwrng passes the buffer that it receives for
> filling to sg_set_buf() directly, in:
>
> virtio_read()       [drivers/char/hw_random/virtio-rng.c]
>   register_buffer() [drivers/char/hw_random/virtio-rng.c]
>     sg_init_one()   [lib/scatterlist.c]
>       sg_set_buf()  [include/linux/scatterlist.h]
>
> In turn, the sg_set_buf() function, when built with CONFIG_DEBUG_SG,
> actively enforces (justifiedly) that the buffer used within the
> scatter-gather list live in physically contiguous memory:
>
>   BUG_ON(!virt_addr_valid(buf));
>
> The combination of the above two facts means that whatever calls
> virtio_read() -- via the hwrng.read() method -- has to allocate the
> recipient buffer in physically contiguous memory.

Indeed.  This bug should be fixed by:

https://git.kernel.org/cgit/linux/kernel/git/herbert/cryptodev-2.6.git/commit/?id=6d4952d9d9d4dc2bb9c0255d95a09405a1e958f7

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RESEND] hwrng: core - don't pass stack allocated buffer to rng->read() Laszlo Ersek <lersek@redhat.com> - 2016-10-21 22:50 +0200
  Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer to rng->read() Andy Lutomirski <luto@amacapital.net> - 2016-10-21 23:10 +0200
    Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer  to rng->read() "Richard W.M. Jones" <rjones@redhat.com> - 2016-10-21 23:20 +0200
      Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer to  rng->read() Laszlo Ersek <lersek@redhat.com> - 2016-10-21 23:40 +0200
    Re: [PATCH RESEND] hwrng: core - don't pass stack allocated buffer to  rng->read() Laszlo Ersek <lersek@redhat.com> - 2016-10-21 23:40 +0200

csiph-web