[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] block/null: Enable 'read-zeroes' mode by default
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v2 2/2] block/null: Enable 'read-zeroes' mode by default |
Date: |
Thu, 11 Feb 2021 16:22:50 +0000 |
On Thu, Feb 11, 2021 at 03:26:56PM +0100, Philippe Mathieu-Daudé wrote:
> The null-co driver is meant for (performance) testing.
> By default, read operation does nothing, the provided buffer
> is not filled with zero values and its content is unchanged.
>
> This performance 'feature' becomes an issue from a security
> perspective. For example, using the default null-co driver,
> buf[] is uninitialized, the blk_pread() call succeeds and we
> then access uninitialized memory:
>
> static int guess_disk_lchs(BlockBackend *blk,
> int *pcylinders, int *pheads,
> int *psectors)
> {
> uint8_t buf[BDRV_SECTOR_SIZE];
> ...
>
> if (blk_pread(blk, 0, buf, BDRV_SECTOR_SIZE) < 0) {
> return -1;
> }
> /* test msdos magic */
> if (buf[510] != 0x55 || buf[511] != 0xaa) {
> return -1;
> }
>
> We could audit all the uninitialized buffers and the
> bdrv_co_preadv() handlers, but it is simpler to change the
> default of this testing driver. Performance tests will have
> to adapt and use 'null-co,read-zeroes=off'.
>
> Suggested-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> block/null.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Philippe Mathieu-Daudé, 2021/02/11
- [PATCH v2 1/2] block: Explicit null-co uses 'read-zeroes=false', Philippe Mathieu-Daudé, 2021/02/11
- [PATCH v2 2/2] block/null: Enable 'read-zeroes' mode by default, Philippe Mathieu-Daudé, 2021/02/11
- Re: [PATCH v2 2/2] block/null: Enable 'read-zeroes' mode by default,
Stefan Hajnoczi <=
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Alexander Bulekov, 2021/02/11
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Fam Zheng, 2021/02/13
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Max Reitz, 2021/02/19
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Philippe Mathieu-Daudé, 2021/02/19
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Fam Zheng, 2021/02/22
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Philippe Mathieu-Daudé, 2021/02/22
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Fam Zheng, 2021/02/23
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Max Reitz, 2021/02/23
- Re: [PATCH v2 0/2] block: Use 'read-zeroes=true' mode by default with 'null-co' driver, Fam Zheng, 2021/02/23