All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries"
@ 2020-04-01  9:55 Tobias Witek
  2020-04-01 13:22 ` [Bug 1870098] " Kevin Wolf
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tobias Witek @ 2020-04-01  9:55 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

In current qemu versions (observed in 5.0.0-rc1 as well as
2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic VPCs
are written with an incorrect "block allocation table entries" value.

https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
corresponding spec) states that:

"Max Table Entries
This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

Inside the qemu code, the value is "disk size divided by the block size
*plus one*".

Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
*should* fix the issue.

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] cynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  New

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1870098] Re: [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries"
  2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
@ 2020-04-01 13:22 ` Kevin Wolf
  2020-04-02  6:44 ` Tobias Witek
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2020-04-01 13:22 UTC (permalink / raw)
  To: qemu-devel

Is there any actual bug resulting from this that you're observing? As I
read the spec, having a longer BAT is merely unconventional, not
strictly wrong. So if another application fails to deal with such
images, it's probably a bug in that application.

Of course, I can't see a reason for making the BAT longer than necessary
either. We do, however, need to round up if the disk size is not a
multiple of the image block size. So I think what it really should be
is:

num_bat_entries = DIV_ROUND_UP(total_sectors, block_size / 512)

If you agree, please let me know if I should submit a patch or if you
would like to do that yourself. (See
https://wiki.qemu.org/Contribute/SubmitAPatch)

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] cynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  New

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1870098] Re: [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries"
  2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
  2020-04-01 13:22 ` [Bug 1870098] " Kevin Wolf
@ 2020-04-02  6:44 ` Tobias Witek
  2020-04-02 12:02 ` [Bug 1870098] Re: [block/vpc] dynamic " Kevin Wolf
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Tobias Witek @ 2020-04-02  6:44 UTC (permalink / raw)
  To: qemu-devel

Ah, sorry, I failed to mention this: Due to this bug, qemu currently
cannot create VHDs that are suitable for upload to Azure (because Azure
expects disks that are aligned exactly to 1MB).

If it would not be too much trouble for you to submit the patch, I would
appreciate that a lot. I've never submitted a patch to qemu and the
contribution doc reads somewhat complex, so I'm a bit concerned about
dragging a very small patch out longer than strictly necessary.

Thanks a lot!

** Summary changed:

- [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries"
+ [block/vpc] dynamic disk header: off-by-one error for "num_bat_entries"

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] dynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  New

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1870098] Re: [block/vpc] dynamic disk header: off-by-one error for "num_bat_entries"
  2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
  2020-04-01 13:22 ` [Bug 1870098] " Kevin Wolf
  2020-04-02  6:44 ` Tobias Witek
@ 2020-04-02 12:02 ` Kevin Wolf
  2020-04-08  8:04 ` Tobias Witek
  2020-04-30 13:32 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2020-04-02 12:02 UTC (permalink / raw)
  To: qemu-devel

As I don't have your email address, I could not CC you on the patch
email. Can you please verify if the following patch on the mailing list
fixes your problem?

https://lists.gnu.org/archive/html/qemu-block/2020-04/msg00086.html

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] dynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  New

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1870098] Re: [block/vpc] dynamic disk header: off-by-one error for "num_bat_entries"
  2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
                   ` (2 preceding siblings ...)
  2020-04-02 12:02 ` [Bug 1870098] Re: [block/vpc] dynamic " Kevin Wolf
@ 2020-04-08  8:04 ` Tobias Witek
  2020-04-30 13:32 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Tobias Witek @ 2020-04-08  8:04 UTC (permalink / raw)
  To: qemu-devel

Thanks a lot for looking into it!

Yes, we were able to verify that this patch does fix the problem.

Many thanks!

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] dynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  New

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug 1870098] Re: [block/vpc] dynamic disk header: off-by-one error for "num_bat_entries"
  2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
                   ` (3 preceding siblings ...)
  2020-04-08  8:04 ` Tobias Witek
@ 2020-04-30 13:32 ` Laurent Vivier
  4 siblings, 0 replies; 6+ messages in thread
From: Laurent Vivier @ 2020-04-30 13:32 UTC (permalink / raw)
  To: qemu-devel

Fixed here:
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=3f6de653b946


** Changed in: qemu
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1870098

Title:
  [block/vpc] dynamic disk header: off-by-one error for
  "num_bat_entries"

Status in QEMU:
  Fix Released

Bug description:
  In current qemu versions (observed in 5.0.0-rc1 as well as
  2833ad487cfff7dc33703e4731b75facde1c561e), disk headers for dynamic
  VPCs are written with an incorrect "block allocation table entries"
  value.

  https://www.microsoft.com/en-us/download/details.aspx?id=23850 (the
  corresponding spec) states that:

  "Max Table Entries
  This field holds the maximum entries present in the BAT. This should be equal to the number of blocks in the disk (that is, the disk size divided by the block size)."

  Inside the qemu code, the value is "disk size divided by the block
  size *plus one*".

  Calculating "num_bat_entries" as "total_sectors/(block_size / 512)"
  *should* fix the issue.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1870098/+subscriptions


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-30 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01  9:55 [Bug 1870098] [NEW] [block/vpc] cynamic disk header: off-by-one error for "num_bat_entries" Tobias Witek
2020-04-01 13:22 ` [Bug 1870098] " Kevin Wolf
2020-04-02  6:44 ` Tobias Witek
2020-04-02 12:02 ` [Bug 1870098] Re: [block/vpc] dynamic " Kevin Wolf
2020-04-08  8:04 ` Tobias Witek
2020-04-30 13:32 ` Laurent Vivier

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.