Patch "kcsan: test: don't put the expect array on the stack" has been added to the 5.10-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

    kcsan: test: don't put the expect array on the stack

to the 5.10-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:
     kcsan-test-don-t-put-the-expect-array-on-the-stack.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 90d8adcb6d7c4a3817008ee44fc0f28db2922b89
Author: Max Filippov <jcmvbkbc@xxxxxxxxx>
Date:   Thu Dec 22 23:28:21 2022 -0800

    kcsan: test: don't put the expect array on the stack
    
    [ Upstream commit 5b24ac2dfd3eb3e36f794af3aa7f2828b19035bd ]
    
    Size of the 'expect' array in the __report_matches is 1536 bytes, which
    is exactly the default frame size warning limit of the xtensa
    architecture.
    As a result allmodconfig xtensa kernel builds with the gcc that does not
    support the compiler plugins (which otherwise would push the said
    warning limit to 2K) fail with the following message:
    
      kernel/kcsan/kcsan_test.c:257:1: error: the frame size of 1680 bytes
        is larger than 1536 bytes
    
    Fix it by dynamically allocating the 'expect' array.
    
    Signed-off-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
    Reviewed-by: Marco Elver <elver@xxxxxxxxxx>
    Tested-by: Marco Elver <elver@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/kcsan/kcsan-test.c b/kernel/kcsan/kcsan-test.c
index ebe7fd245104..8a8ccaf4f38f 100644
--- a/kernel/kcsan/kcsan-test.c
+++ b/kernel/kcsan/kcsan-test.c
@@ -149,7 +149,7 @@ static bool report_matches(const struct expect_report *r)
 	const bool is_assert = (r->access[0].type | r->access[1].type) & KCSAN_ACCESS_ASSERT;
 	bool ret = false;
 	unsigned long flags;
-	typeof(observed.lines) expect;
+	typeof(*observed.lines) *expect;
 	const char *end;
 	char *cur;
 	int i;
@@ -158,6 +158,10 @@ static bool report_matches(const struct expect_report *r)
 	if (!report_available())
 		return false;
 
+	expect = kmalloc(sizeof(observed.lines), GFP_KERNEL);
+	if (WARN_ON(!expect))
+		return false;
+
 	/* Generate expected report contents. */
 
 	/* Title */
@@ -241,6 +245,7 @@ static bool report_matches(const struct expect_report *r)
 		strstr(observed.lines[2], expect[1])));
 out:
 	spin_unlock_irqrestore(&observed.lock, flags);
+	kfree(expect);
 	return ret;
 }
 



[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