Hi,

On Tue, Nov 17, 2026 at 11:29 PM Alex Kazinsky <[email protected]> wrote:
>
> kdb_md() uses BYTESPERWORD as a divisor when calculating the initial
> repeat count, before validating the word width. A zero width causes a
> division by zero. kdbgetintenv() also casts an unsigned long to int,
> so the resulting width can be negative. If the width is -1 and the
> scaled count is INT_MIN, the quotient overflows and raises a divide
> error on x86.
>
> Return KDB_BADWIDTH for non-positive widths before calculating the
> repeat count.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE static
> analysis tool.
>
> Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)")
> Cc: [email protected]
> Signed-off-by: Alex Kazinsky <[email protected]>
> ---
> v1: https://lore.kernel.org/all/[email protected]/
>
> Changes in v2:
> - Reject negative BYTESPERWORD values as well as zero.
> - Explain the signed division overflow in the commit message.
>
>  kernel/debug/kdb/kdb_main.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Douglas Anderson <[email protected]>


_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to