Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h > > index 118c40258d07..b476809d0bae 100644 > > --- a/include/linux/netdevice.h > > +++ b/include/linux/netdevice.h >

Re: [PATCH v1 1/8] kunit: Run tests when the kernel is fully setup

2024-03-01 Thread kernel test robot
Hi Mickaël, kernel test robot noticed the following build warnings: [auto build test WARNING on d206a76d7d2726f3b096037f2079ce0bd3ba329b] url: https://github.com/intel-lab-lkp/linux/commits/Micka-l-Sala-n/kunit-Run-tests-when-the-kernel-is-fully-setup/20240301-011020 base

Re: [PATCH v2 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Andy Shevchenko
On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > Convert test_string.c to KUnit so it can be easily run with everything > else. Have you run it? ... > if (i < 256) > - return (i << 24) | (j << 16) | k | 0x8000; > - return 0; > + KUNIT_EXPECT_EQ(test,

Re: [PATCH v2 2/2] string: Convert helpers selftest to KUnit

2024-03-01 Thread Andy Shevchenko
On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > Convert test-string_helpers.c to KUnit so it can be easily run with > everything else. ... > -#include > #include > +#include I know the order is broken here, but don't make it worse, please. And stick with one schema where to put kunit/te

Re: [PATCH v2 0/2] string: Convert selftests to KUnit

2024-03-01 Thread Andy Shevchenko
On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > Hi, > > I realized the string selftests hadn't been converted to KUnit yet. Do that. IIRC last time somebody wanted to do that KUnit was completely sucking in supporting the cases we need in these files. (I mean proper messaging when we need to

Re: [PATCH bpf-next RESEND v2 2/2] bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()

2024-03-01 Thread Christophe Leroy
Le 01/03/2024 à 08:57, Christophe Leroy a écrit : > set_memory_rox() can fail, leaving memory unprotected. > > Check return and bail out when bpf_jit_binary_lock_ro() returns > an error. > Definitely not a good day for me. I switched maintainers between patch 1 and patch 2 sorry. Adding hengqi

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Greg KH
On Thu, Feb 29, 2024 at 10:59:10PM -0800, Jakub Kicinski wrote: > On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Introduce a new struct net_device_priv that contains struct net_device > > but also accounts for the commonly trailing bytes through the "size" and > > "data" members. > > I'm

Re: [PATCH] arm64: smp: smp_send_stop() and crash_smp_send_stop() should try non-NMI first

2024-03-01 Thread Daniel Thompson
On Thu, Feb 29, 2024 at 10:34:26AM -0800, Doug Anderson wrote: > Hi, > > On Wed, Feb 28, 2024 at 5:11 AM Daniel Thompson > wrote: > > > > > I'm still hoping to get some sort of feedback here. If people think > > > this is a terrible idea then I'll shut up now and leave well enough > > > alone, but

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Alexander Lobakin
From: Eric Dumazet Date: Fri, 1 Mar 2024 09:03:55 +0100 > On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: >> >> On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: Re WARN_ONCE() in netdev_priv(): netdev_priv() is VERY hot, I'm not sure we want to add checks there. Maybe under CONFIG_DEBUG

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Eric Dumazet
On Fri, Mar 1, 2024 at 1:59 PM Alexander Lobakin wrote: > > From: Eric Dumazet > Date: Fri, 1 Mar 2024 09:03:55 +0100 > > > On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: > >> > >> On Thu, 29 Feb 2024 13:30:22 -0800 Kees Cook wrote: > > Re WARN_ONCE() in netdev_priv(): netdev_priv() is VER

[PATCH v5 0/4] arm64: qcom: add AIM300 AIoT board suppo

2024-03-01 Thread Tengfei Fan
Add AIM300 AIoT support along with usb, ufs, regulators, serial, PCIe, and PMIC functions. AIM300 Series is a highly optimized family of modules designed to support AIoT applications. It integrates QCS8550 SoC, UFS and PMIC chip etc. Here is a diagram of AIM300 AIoT Carrie Board and SoM +-

[PATCH v5 1/4] dt-bindings: arm: qcom: Document QCS8550 SoC and the AIM300 AIoT board

2024-03-01 Thread Tengfei Fan
Document QCS8550 SoC and the AIM300 AIoT board bindings. QCS8550 is derived from SM8550. The difference between SM8550 and QCS8550 is QCS8550 doesn't have modem RF system. QCS8550 is mainly used in IoT scenarios. AIM300 Series is a highly optimized family of modules designed to support AIoT applica

[PATCH v5 2/4] arm64: dts: qcom: qcs8550: introduce qcs8550 dtsi

2024-03-01 Thread Tengfei Fan
QCS8550 is derived from SM8550. The differnece between SM8550 and QCS8550 is QCS8550 doesn't have modem RF system. QCS8550 is mainly used in IoT scenarios. QCS8550 firmware has different memory map with SM8550 firmware. The memory map will be runtime added through bootloader. There are 3 types of r

[PATCH v5 3/4] arm64: dts: qcom: add base AIM300 dtsi

2024-03-01 Thread Tengfei Fan
AIM300 Series is a highly optimized family of modules designed to support AIoT applications. It integrates QCS8550 SoC, UFS and PMIC chip etc. Here is a diagram of AIM300 SoM: ++ |AIM300 SoM | |

[PATCH v5 4/4] arm64: dts: qcom: aim300: add AIM300 AIoT

2024-03-01 Thread Tengfei Fan
Add AIM300 AIoT Carrier board DTS support, including usb, UART, PCIe, I2C functions support. Here is a diagram of AIM300 AIoT Carrie Board and SoM +--+ | AIM300 AIOT Carrie Board | |

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Alexander Lobakin
From: Eric Dumazet Date: Fri, 1 Mar 2024 14:25:37 +0100 > On Fri, Mar 1, 2024 at 1:59 PM Alexander Lobakin > wrote: >> >> From: Eric Dumazet >> Date: Fri, 1 Mar 2024 09:03:55 +0100 >> >>> On Fri, Mar 1, 2024 at 7:59 AM Jakub Kicinski wrote: On Thu, 29 Feb 2024 13:30:22 -0800 Kees Coo

Re: [PATCH] sh: Fix build with CONFIG_UBSAN=y

2024-03-01 Thread John Paul Adrian Glaubitz
Hi Yujie, On Fri, 2024-03-01 at 05:46 +, Liu, Yujie wrote: > On Wed, 2024-02-14 at 13:52 +0100, John Paul Adrian Glaubitz wrote: > > Hi Kees, > > > > On Mon, 2024-02-12 at 19:45 +0100, John Paul Adrian Glaubitz wrote: > > > On Mon, 2024-02-12 at 10:26 -0800, Kees Cook wrote: > > > > > I just

Re: [PATCH] arm64: smp: smp_send_stop() and crash_smp_send_stop() should try non-NMI first

2024-03-01 Thread Mark Rutland
Hi Doug, On Tue, Feb 27, 2024 at 04:57:31PM -0800, Doug Anderson wrote: > On Mon, Jan 8, 2024 at 4:54 PM Doug Anderson wrote: > > On Thu, Dec 7, 2023 at 5:03 PM Douglas Anderson > > wrote: > > The sound of crickets is overwhelming. ;-) Does anyone have any > > comments here? Is this a terrible

Re: [PATCH v1 1/1] lib/string_helpers: Add flags param to string_get_size()

2024-03-01 Thread Andy Shevchenko
On Thu, Feb 29, 2024 at 04:54:30PM -0500, Kent Overstreet wrote: > On Thu, Feb 29, 2024 at 01:52:34PM -0800, Kees Cook wrote: > > On Thu, 29 Feb 2024 22:52:30 +0200, Andy Shevchenko wrote: > > > The new flags parameter allows controlling > > > - Whether or not the units suffix is separated by a sp

Re: [PATCH v2 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 01:09:27PM +0200, Andy Shevchenko wrote: > On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > > > Convert test_string.c to KUnit so it can be easily run with everything > > else. > > Have you run it? Yes: $ ./tools/testing/kunit/kunit.py run string [09:21:32] Starting

Re: [PATCH v2 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Andy Shevchenko
On Fri, Mar 01, 2024 at 09:25:07AM -0800, Kees Cook wrote: > On Fri, Mar 01, 2024 at 01:09:27PM +0200, Andy Shevchenko wrote: > > On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > > > > > Convert test_string.c to KUnit so it can be easily run with everything > > > else. > > > > Have you run it?

Re: [PATCH] netdev: Use flexible array for trailing private bytes

2024-03-01 Thread Jakub Kicinski
On Fri, 1 Mar 2024 15:30:03 +0100 Alexander Lobakin wrote: > I like the idea of declaring priv explicitly rather than doing size + > ptr magic. But maybe we could just add this flex array to struct > net_device and avoid introducing a new structure. 100% I should have linked to the thread that led

[PATCH][next] RDMA/uverbs: Avoid -Wflex-array-member-not-at-end warnings

2024-03-01 Thread Gustavo A. R. Silva
-Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally. There are currently a couple of objects (`alloc_head` and `bundle`) in `struct bundle_priv` that contain a couple of flexible structures: struct bundle_priv { /* Must be first */ st

[PATCH][next] net/smc: Avoid -Wflex-array-member-not-at-end warnings

2024-03-01 Thread Gustavo A. R. Silva
-Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally. There are currently a couple of objects in `struct smc_clc_msg_proposal_area` that contain a couple of flexible structures: struct smc_clc_msg_proposal_area { ... struct smc_clc_v2_

Re: [PATCH v1 1/8] kunit: Run tests when the kernel is fully setup

2024-03-01 Thread Mickaël Salaün
On Fri, Mar 01, 2024 at 03:14:49PM +0800, David Gow wrote: > On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > > > Run all the KUnit tests just before the first userspace code is > > launched. This makes it it possible to write new tests that check the > > kernel in its final state i.e., wi

Re: [PATCH v1 5/8] kunit: Handle test faults

2024-03-01 Thread Mickaël Salaün
On Thu, Feb 29, 2024 at 10:24:19AM -0800, Kees Cook wrote: > On Thu, Feb 29, 2024 at 06:04:06PM +0100, Mickaël Salaün wrote: > > Previously, when a kernel test thread crashed (e.g. NULL pointer > > dereference, general protection fault), the KUnit test hanged for 30 > > seconds and exited with a ti

Re: [PATCH v1 8/8] kunit: Add tests for faults

2024-03-01 Thread Mickaël Salaün
On Thu, Feb 29, 2024 at 10:28:18AM -0800, Kees Cook wrote: > On Thu, Feb 29, 2024 at 06:04:09PM +0100, Mickaël Salaün wrote: > > The first test checks NULL pointer dereference and make sure it would > > result as a failed test. > > > > The second and third tests check that read-only data is indeed

Re: [PATCH v1 0/8] Run KUnit tests late and handle faults

2024-03-01 Thread Mickaël Salaün
On Fri, Mar 01, 2024 at 03:15:08PM +0800, David Gow wrote: > On Fri, 1 Mar 2024 at 01:04, Mickaël Salaün wrote: > > > > Hi, > > > > Thanks very much. I think there's a lot going on in this series, and > it'd probably be easier to address if it were broken up a bit more. > > To take things one at

[PATCH v2 1/7] kunit: Handle thread creation error

2024-03-01 Thread Mickaël Salaün
Previously, if a thread creation failed (e.g. -ENOMEM), the function was called (kunit_catch_run_case or kunit_catch_run_case_cleanup) without marking the test as failed. Instead, fill try_result with the error code returned by kthread_run(), which will mark the test as failed and print "internal

[PATCH v2 2/7] kunit: Fix kthread reference

2024-03-01 Thread Mickaël Salaün
There is a race condition when a kthread finishes after the deadline and before the call to kthread_stop(), which may lead to use after free. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/202

[PATCH v2 3/7] kunit: Fix timeout message

2024-03-01 Thread Mickaël Salaün
The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240301194037.532117-4-...@digikod.net --- Changes since v

[PATCH v2 4/7] kunit: Handle test faults

2024-03-01 Thread Mickaël Salaün
Previously, when a kernel test thread crashed (e.g. NULL pointer dereference, general protection fault), the KUnit test hanged for 30 seconds and exited with a timeout error. Fix this issue by waiting on task_struct->vfork_done instead of the custom kunit_try_catch.try_completion, and track the ex

[PATCH v2 0/7] Handle faults in KUnit tests

2024-03-01 Thread Mickaël Salaün
Hi, This patch series teaches KUnit to handle kthread faults as errors, and it brings a few related fixes and improvements. I removed the previous patch that moved the KUnit test execution at the very end of kernel initialization. We'll address that with a separate series. A new test case check

[PATCH v2 5/7] kunit: Fix KUNIT_SUCCESS() calls in iov_iter tests

2024-03-01 Thread Mickaël Salaün
Fix KUNIT_SUCCESS() calls to pass a test argument. This is a no-op for now because this macro does nothing, but it will be required for the next commit. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kern

[PATCH v2 7/7] kunit: Add tests for fault

2024-03-01 Thread Mickaël Salaün
Add a test case to check NULL pointer dereference and make sure it would result as a failed test. The full kunit_fault test suite is marked as skipped when run on UML because it would result to a kernel panic. Tested with: ./tools/testing/kunit/kunit.py run --arch x86_64 kunit_fault ./tools/testi

[PATCH v2 6/7] kunit: Print last test location on fault

2024-03-01 Thread Mickaël Salaün
This helps identify the location of test faults. Cc: Brendan Higgins Cc: David Gow Cc: Rae Moar Cc: Shuah Khan Reviewed-by: Kees Cook Signed-off-by: Mickaël Salaün Link: https://lore.kernel.org/r/20240301194037.532117-7-...@digikod.net --- Changes since v1: * Added Kees's Reviewed-by. ---

[PATCH 0/3] spi: axi-spi-engine: small cleanups

2024-03-01 Thread David Lechner
struct_size() macro drivers/spi/spi-axi-spi-engine.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) --- base-commit: bf790d87088a04d5f3a4659e04ff2a5a16eca294 change-id: 20240301-mainline-axi-spi-engine-small-cleanups-cd08b51cb6d4 Best regards, -- David Lechner

[PATCH 1/3] spi: axi-spi-engine: remove p from struct spi_engine_message_state

2024-03-01 Thread David Lechner
The program pointer p in struct spi_engine_message_state in the AXI SPI Engine controller driver was assigned but never read so it can be removed. Signed-off-by: David Lechner --- drivers/spi/spi-axi-spi-engine.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/spi-axi-spi-engin

[PATCH 2/3] spi: axi-spi-engine: use __counted_by() attribute

2024-03-01 Thread David Lechner
This adds the __counted_by() attribute to the flex array at the end of struct spi_engine_program in the AXI SPI Engine controller driver. Suggested-by: Nuno Sá Signed-off-by: David Lechner --- drivers/spi/spi-axi-spi-engine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d

[PATCH 3/3] spi: axi-spi-engine: use struct_size() macro

2024-03-01 Thread David Lechner
This makes use of the struct_size() macro to calculate the size of the struct axi_spi_engine when allocating it. Suggested-by: Christophe JAILLET Signed-off-by: David Lechner --- drivers/spi/spi-axi-spi-engine.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/sp

[PATCH v3 0/2] string: Convert selftests to KUnit

2024-03-01 Thread Kees Cook
Hi, I realized the string selftests hadn't been converted to KUnit yet. Do that. -Kees v3: retain all text context in failure reporting v2: https://lore.kernel.org/lkml/20240301002416.it.092-k...@kernel.org/ v1: https://lore.kernel.org/lkml/20240229233432.work.675-k...@kernel.org/ Kees Cook

[PATCH v3 1/2] string: Convert selftest to KUnit

2024-03-01 Thread Kees Cook
Convert test_string.c to KUnit so it can be easily run with everything else. Additional text context is retained for failure reporting. For example, when forcing a bad match, we can see the loop counters reported for the memset() tests: [09:21:52] # test_memset64: ASSERTION FAILED at lib/stri

[PATCH v3 2/2] string: Convert helpers selftest to KUnit

2024-03-01 Thread Kees Cook
Convert test-string_helpers.c to KUnit so it can be easily run with everything else. Failure reporting doesn't need to be open-coded in most places, for example, forcing a failure in the expected output for upper/lower testing looks like this: [12:18:43] # test_upper_lower: EXPECTATION FAILED at

Re: [PATCH v2 2/2] string: Convert helpers selftest to KUnit

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 01:20:41PM +0200, Andy Shevchenko wrote: > On Fri, Mar 1, 2024 at 2:26 AM Kees Cook wrote: > > > > Convert test-string_helpers.c to KUnit so it can be easily run with > > everything else. > > ... > > > -#include > > #include > > +#include > > I know the order is brok

Re: [PATCH 2/3] spi: axi-spi-engine: use __counted_by() attribute

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 02:25:19PM -0600, David Lechner wrote: > This adds the __counted_by() attribute to the flex array at the end of > struct spi_engine_program in the AXI SPI Engine controller driver. > > Suggested-by: Nuno Sá > Signed-off-by: David Lechner > --- > drivers/spi/spi-axi-spi-e

Re: [PATCH 1/3] spi: axi-spi-engine: remove p from struct spi_engine_message_state

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 02:25:18PM -0600, David Lechner wrote: > The program pointer p in struct spi_engine_message_state in the AXI SPI > Engine controller driver was assigned but never read so it can be > removed. > > Signed-off-by: David Lechner Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH v1 8/8] kunit: Add tests for faults

2024-03-01 Thread kernel test robot
Hi Mickaël, kernel test robot noticed the following build warnings: [auto build test WARNING on d206a76d7d2726f3b096037f2079ce0bd3ba329b] url: https://github.com/intel-lab-lkp/linux/commits/Micka-l-Sala-n/kunit-Run-tests-when-the-kernel-is-fully-setup/20240301-011020 base

Re: [PATCH 3/3] spi: axi-spi-engine: use struct_size() macro

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 02:25:20PM -0600, David Lechner wrote: > This makes use of the struct_size() macro to calculate the size of the > struct axi_spi_engine when allocating it. > > Suggested-by: Christophe JAILLET > Signed-off-by: David Lechner Reviewed-by: Kees Cook -- Kees Cook

Re: [PATCH][next] net/smc: Avoid -Wflex-array-member-not-at-end warnings

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 12:40:57PM -0600, Gustavo A. R. Silva wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > There are currently a couple of objects in `struct smc_clc_msg_proposal_area` > that contain a couple of flexible structu

Re: [PATCH][next] RDMA/uverbs: Avoid -Wflex-array-member-not-at-end warnings

2024-03-01 Thread Kees Cook
On Fri, Mar 01, 2024 at 12:37:45PM -0600, Gustavo A. R. Silva wrote: > -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting > ready to enable it globally. > > There are currently a couple of objects (`alloc_head` and `bundle`) in > `struct bundle_priv` that contain a couple of fl