Skip to content

Commit 8fc3b8f

Browse files
committed
Merge tag 'hardening-v6.5-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: - Check for NULL bdev in LoadPin (Matthias Kaehlcke) - Revert unwanted KUnit FORTIFY build default - Fix 1-element array causing boot warnings with xhci-hub * tag 'hardening-v6.5-rc1-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: usb: ch9: Replace bmSublinkSpeedAttr 1-element array with flexible array Revert "fortify: Allow KUnit test to build without FORTIFY" dm: verity-loadpin: Add NULL pointer check for 'bdev' parameter
2 parents c206353 + 01f23c5 commit 8fc3b8f

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

drivers/md/dm-verity-loadpin.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ bool dm_verity_loadpin_is_bdev_trusted(struct block_device *bdev)
5858
int srcu_idx;
5959
bool trusted = false;
6060

61+
if (bdev == NULL)
62+
return false;
63+
6164
if (list_empty(&dm_verity_loadpin_trusted_root_digests))
6265
return false;
6366

include/uapi/linux/usb/ch9.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,11 @@ struct usb_ssp_cap_descriptor {
984984
#define USB_SSP_MIN_RX_LANE_COUNT (0xf << 8)
985985
#define USB_SSP_MIN_TX_LANE_COUNT (0xf << 12)
986986
__le16 wReserved;
987-
__le32 bmSublinkSpeedAttr[1]; /* list of sublink speed attrib entries */
987+
union {
988+
__le32 legacy_padding;
989+
/* list of sublink speed attrib entries */
990+
__DECLARE_FLEX_ARRAY(__le32, bmSublinkSpeedAttr);
991+
};
988992
#define USB_SSP_SUBLINK_SPEED_SSID (0xf) /* sublink speed ID */
989993
#define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) /* Lanespeed exponent */
990994
#define USB_SSP_SUBLINK_SPEED_LSE_BPS 0

lib/Kconfig.debug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2739,7 +2739,7 @@ config STACKINIT_KUNIT_TEST
27392739

27402740
config FORTIFY_KUNIT_TEST
27412741
tristate "Test fortified str*() and mem*() function internals at runtime" if !KUNIT_ALL_TESTS
2742-
depends on KUNIT
2742+
depends on KUNIT && FORTIFY_SOURCE
27432743
default KUNIT_ALL_TESTS
27442744
help
27452745
Builds unit tests for checking internals of FORTIFY_SOURCE as used

lib/fortify_kunit.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ static const char array_of_10[] = "this is 10";
2525
static const char *ptr_of_11 = "this is 11!";
2626
static char array_unknown[] = "compiler thinks I might change";
2727

28-
/* Handle being built without CONFIG_FORTIFY_SOURCE */
29-
#ifndef __compiletime_strlen
30-
# define __compiletime_strlen __builtin_strlen
31-
#endif
32-
3328
static void known_sizes_test(struct kunit *test)
3429
{
3530
KUNIT_EXPECT_EQ(test, __compiletime_strlen("88888888"), 8);
@@ -312,14 +307,6 @@ DEFINE_ALLOC_SIZE_TEST_PAIR(kvmalloc)
312307
} while (0)
313308
DEFINE_ALLOC_SIZE_TEST_PAIR(devm_kmalloc)
314309

315-
static int fortify_test_init(struct kunit *test)
316-
{
317-
if (!IS_ENABLED(CONFIG_FORTIFY_SOURCE))
318-
kunit_skip(test, "Not built with CONFIG_FORTIFY_SOURCE=y");
319-
320-
return 0;
321-
}
322-
323310
static struct kunit_case fortify_test_cases[] = {
324311
KUNIT_CASE(known_sizes_test),
325312
KUNIT_CASE(control_flow_split_test),
@@ -336,7 +323,6 @@ static struct kunit_case fortify_test_cases[] = {
336323

337324
static struct kunit_suite fortify_test_suite = {
338325
.name = "fortify",
339-
.init = fortify_test_init,
340326
.test_cases = fortify_test_cases,
341327
};
342328

0 commit comments

Comments
 (0)