Patch "kdb: Fix a potential buffer overflow in kdb_local()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kdb: Fix a potential buffer overflow in kdb_local()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kdb-fix-a-potential-buffer-overflow-in-kdb_local.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7757b952b28f0ada9fbb477a58ecff1e9268f861
Author: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Date:   Sat Nov 25 13:05:04 2023 +0100

    kdb: Fix a potential buffer overflow in kdb_local()
    
    [ Upstream commit 4f41d30cd6dc865c3cbc1a852372321eba6d4e4c ]
    
    When appending "[defcmd]" to 'kdb_prompt_str', the size of the string
    already in the buffer should be taken into account.
    
    An option could be to switch from strncat() to strlcat() which does the
    correct test to avoid such an overflow.
    
    However, this actually looks as dead code, because 'defcmd_in_progress'
    can't be true here.
    See a more detailed explanation at [1].
    
    [1]: https://lore.kernel.org/all/CAD=FV=WSh7wKN7Yp-3wWiDgX4E3isQ8uh0LCzTmd1v9Cg9j+nQ@xxxxxxxxxxxxxx/
    
    Fixes: 5d5314d6795f ("kdb: core for kgdb back end (1 of 2)")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
    Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
index ead4da947127..23723c5727aa 100644
--- a/kernel/debug/kdb/kdb_main.c
+++ b/kernel/debug/kdb/kdb_main.c
@@ -1350,8 +1350,6 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs,
 		/* PROMPT can only be set if we have MEM_READ permission. */
 		snprintf(kdb_prompt_str, CMD_BUFLEN, kdbgetenv("PROMPT"),
 			 raw_smp_processor_id());
-		if (defcmd_in_progress)
-			strncat(kdb_prompt_str, "[defcmd]", CMD_BUFLEN);
 
 		/*
 		 * Fetch command from keyboard




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux