Commit 5cf81d7b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hardening-v6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux

Pull hardening fixes from Kees Cook:

 - yama: document function parameter (Christian Göttsche)

 - mm/util: Swap kmemdup_array() arguments (Jean-Philippe Brucker)

 - kunit/overflow: Adjust for __counted_by with DEFINE_RAW_FLEX()

 - MAINTAINERS: Update entries for Kees Cook

* tag 'hardening-v6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
  MAINTAINERS: Update entries for Kees Cook
  kunit/overflow: Adjust for __counted_by with DEFINE_RAW_FLEX()
  yama: document function parameter
  mm/util: Swap kmemdup_array() arguments
parents 6226e749 1ab1a422
...@@ -5295,7 +5295,7 @@ F: drivers/infiniband/hw/usnic/ ...@@ -5295,7 +5295,7 @@ F: drivers/infiniband/hw/usnic/
CLANG CONTROL FLOW INTEGRITY SUPPORT CLANG CONTROL FLOW INTEGRITY SUPPORT
M: Sami Tolvanen <samitolvanen@google.com> M: Sami Tolvanen <samitolvanen@google.com>
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Nathan Chancellor <nathan@kernel.org> R: Nathan Chancellor <nathan@kernel.org>
L: llvm@lists.linux.dev L: llvm@lists.linux.dev
S: Supported S: Supported
...@@ -8211,7 +8211,7 @@ F: rust/kernel/net/phy.rs ...@@ -8211,7 +8211,7 @@ F: rust/kernel/net/phy.rs
EXEC & BINFMT API, ELF EXEC & BINFMT API, ELF
R: Eric Biederman <ebiederm@xmission.com> R: Eric Biederman <ebiederm@xmission.com>
R: Kees Cook <keescook@chromium.org> R: Kees Cook <kees@kernel.org>
L: linux-mm@kvack.org L: linux-mm@kvack.org
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/execve
...@@ -8612,7 +8612,7 @@ S: Maintained ...@@ -8612,7 +8612,7 @@ S: Maintained
F: drivers/net/ethernet/nvidia/* F: drivers/net/ethernet/nvidia/*
FORTIFY_SOURCE FORTIFY_SOURCE
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
...@@ -9102,7 +9102,7 @@ F: include/linux/mfd/gsc.h ...@@ -9102,7 +9102,7 @@ F: include/linux/mfd/gsc.h
F: include/linux/platform_data/gsc_hwmon.h F: include/linux/platform_data/gsc_hwmon.h
GCC PLUGINS GCC PLUGINS
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
...@@ -9236,7 +9236,7 @@ S: Maintained ...@@ -9236,7 +9236,7 @@ S: Maintained
F: drivers/input/touchscreen/resistive-adc-touch.c F: drivers/input/touchscreen/resistive-adc-touch.c
GENERIC STRING LIBRARY GENERIC STRING LIBRARY
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Andy Shevchenko <andy@kernel.org> R: Andy Shevchenko <andy@kernel.org>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
S: Supported S: Supported
...@@ -11950,7 +11950,7 @@ F: scripts/package/ ...@@ -11950,7 +11950,7 @@ F: scripts/package/
F: usr/ F: usr/
KERNEL HARDENING (not covered by other areas) KERNEL HARDENING (not covered by other areas)
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Gustavo A. R. Silva <gustavoars@kernel.org> R: Gustavo A. R. Silva <gustavoars@kernel.org>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
S: Supported S: Supported
...@@ -12478,7 +12478,7 @@ F: drivers/scsi/53c700* ...@@ -12478,7 +12478,7 @@ F: drivers/scsi/53c700*
LEAKING_ADDRESSES LEAKING_ADDRESSES
M: Tycho Andersen <tycho@tycho.pizza> M: Tycho Andersen <tycho@tycho.pizza>
R: Kees Cook <keescook@chromium.org> R: Kees Cook <kees@kernel.org>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
...@@ -12774,7 +12774,7 @@ F: arch/powerpc/platforms/8xx/ ...@@ -12774,7 +12774,7 @@ F: arch/powerpc/platforms/8xx/
F: arch/powerpc/platforms/83xx/ F: arch/powerpc/platforms/83xx/
LINUX KERNEL DUMP TEST MODULE (LKDTM) LINUX KERNEL DUMP TEST MODULE (LKDTM)
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
S: Maintained S: Maintained
F: drivers/misc/lkdtm/* F: drivers/misc/lkdtm/*
F: tools/testing/selftests/lkdtm/* F: tools/testing/selftests/lkdtm/*
...@@ -12904,7 +12904,7 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/ ...@@ -12904,7 +12904,7 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/
F: drivers/media/usb/dvb-usb-v2/lmedm04* F: drivers/media/usb/dvb-usb-v2/lmedm04*
LOADPIN SECURITY MODULE LOADPIN SECURITY MODULE
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
F: Documentation/admin-guide/LSM/LoadPin.rst F: Documentation/admin-guide/LSM/LoadPin.rst
...@@ -17996,7 +17996,7 @@ F: tools/testing/selftests/proc/ ...@@ -17996,7 +17996,7 @@ F: tools/testing/selftests/proc/
PROC SYSCTL PROC SYSCTL
M: Luis Chamberlain <mcgrof@kernel.org> M: Luis Chamberlain <mcgrof@kernel.org>
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
M: Joel Granados <j.granados@samsung.com> M: Joel Granados <j.granados@samsung.com>
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
L: linux-fsdevel@vger.kernel.org L: linux-fsdevel@vger.kernel.org
...@@ -18052,7 +18052,7 @@ F: Documentation/devicetree/bindings/net/pse-pd/ ...@@ -18052,7 +18052,7 @@ F: Documentation/devicetree/bindings/net/pse-pd/
F: drivers/net/pse-pd/ F: drivers/net/pse-pd/
PSTORE FILESYSTEM PSTORE FILESYSTEM
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Tony Luck <tony.luck@intel.com> R: Tony Luck <tony.luck@intel.com>
R: Guilherme G. Piccoli <gpiccoli@igalia.com> R: Guilherme G. Piccoli <gpiccoli@igalia.com>
L: linux-hardening@vger.kernel.org L: linux-hardening@vger.kernel.org
...@@ -20058,7 +20058,7 @@ F: drivers/media/cec/platform/seco/seco-cec.c ...@@ -20058,7 +20058,7 @@ F: drivers/media/cec/platform/seco/seco-cec.c
F: drivers/media/cec/platform/seco/seco-cec.h F: drivers/media/cec/platform/seco/seco-cec.h
SECURE COMPUTING SECURE COMPUTING
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Andy Lutomirski <luto@amacapital.net> R: Andy Lutomirski <luto@amacapital.net>
R: Will Drewry <wad@chromium.org> R: Will Drewry <wad@chromium.org>
S: Supported S: Supported
...@@ -22972,7 +22972,7 @@ F: drivers/block/ublk_drv.c ...@@ -22972,7 +22972,7 @@ F: drivers/block/ublk_drv.c
F: include/uapi/linux/ublk_cmd.h F: include/uapi/linux/ublk_cmd.h
UBSAN UBSAN
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
R: Marco Elver <elver@google.com> R: Marco Elver <elver@google.com>
R: Andrey Konovalov <andreyknvl@gmail.com> R: Andrey Konovalov <andreyknvl@gmail.com>
R: Andrey Ryabinin <ryabinin.a.a@gmail.com> R: Andrey Ryabinin <ryabinin.a.a@gmail.com>
...@@ -24810,7 +24810,7 @@ F: drivers/net/hamradio/yam* ...@@ -24810,7 +24810,7 @@ F: drivers/net/hamradio/yam*
F: include/linux/yam.h F: include/linux/yam.h
YAMA SECURITY MODULE YAMA SECURITY MODULE
M: Kees Cook <keescook@chromium.org> M: Kees Cook <kees@kernel.org>
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
F: Documentation/admin-guide/LSM/Yama.rst F: Documentation/admin-guide/LSM/Yama.rst
......
...@@ -127,8 +127,8 @@ static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info) ...@@ -127,8 +127,8 @@ static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info)
static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) static int tegra_fuse_add_lookups(struct tegra_fuse *fuse)
{ {
fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), fuse->lookups = kmemdup_array(fuse->soc->lookups, fuse->soc->num_lookups,
fuse->soc->num_lookups, GFP_KERNEL); sizeof(*fuse->lookups), GFP_KERNEL);
if (!fuse->lookups) if (!fuse->lookups)
return -ENOMEM; return -ENOMEM;
......
...@@ -289,7 +289,7 @@ extern void *kmemdup_noprof(const void *src, size_t len, gfp_t gfp) __realloc_si ...@@ -289,7 +289,7 @@ extern void *kmemdup_noprof(const void *src, size_t len, gfp_t gfp) __realloc_si
extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2);
extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp);
extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp) extern void *kmemdup_array(const void *src, size_t count, size_t element_size, gfp_t gfp)
__realloc_size(2, 3); __realloc_size(2, 3);
/* lib/argv_split.c */ /* lib/argv_split.c */
......
...@@ -374,7 +374,7 @@ static const char * const test_strs[] = { ...@@ -374,7 +374,7 @@ static const char * const test_strs[] = {
for (i = 0; i < ARRAY_SIZE(test_strs); i++) { \ for (i = 0; i < ARRAY_SIZE(test_strs); i++) { \
len = strlen(test_strs[i]); \ len = strlen(test_strs[i]); \
KUNIT_EXPECT_EQ(test, __builtin_constant_p(len), 0); \ KUNIT_EXPECT_EQ(test, __builtin_constant_p(len), 0); \
checker(len, kmemdup_array(test_strs[i], len, 1, gfp), \ checker(len, kmemdup_array(test_strs[i], 1, len, gfp), \
kfree(p)); \ kfree(p)); \
checker(len, kmemdup(test_strs[i], len, gfp), \ checker(len, kmemdup(test_strs[i], len, gfp), \
kfree(p)); \ kfree(p)); \
......
...@@ -1178,14 +1178,28 @@ struct foo { ...@@ -1178,14 +1178,28 @@ struct foo {
s16 array[] __counted_by(counter); s16 array[] __counted_by(counter);
}; };
struct bar {
int a;
u32 counter;
s16 array[];
};
static void DEFINE_FLEX_test(struct kunit *test) static void DEFINE_FLEX_test(struct kunit *test)
{ {
DEFINE_RAW_FLEX(struct foo, two, array, 2); /* Using _RAW_ on a __counted_by struct will initialize "counter" to zero */
DEFINE_RAW_FLEX(struct foo, two_but_zero, array, 2);
#if __has_attribute(__counted_by__)
int expected_raw_size = sizeof(struct foo);
#else
int expected_raw_size = sizeof(struct foo) + 2 * sizeof(s16);
#endif
/* Without annotation, it will always be on-stack size. */
DEFINE_RAW_FLEX(struct bar, two, array, 2);
DEFINE_FLEX(struct foo, eight, array, counter, 8); DEFINE_FLEX(struct foo, eight, array, counter, 8);
DEFINE_FLEX(struct foo, empty, array, counter, 0); DEFINE_FLEX(struct foo, empty, array, counter, 0);
KUNIT_EXPECT_EQ(test, __struct_size(two), KUNIT_EXPECT_EQ(test, __struct_size(two_but_zero), expected_raw_size);
sizeof(struct foo) + sizeof(s16) + sizeof(s16)); KUNIT_EXPECT_EQ(test, __struct_size(two), sizeof(struct bar) + 2 * sizeof(s16));
KUNIT_EXPECT_EQ(test, __struct_size(eight), 24); KUNIT_EXPECT_EQ(test, __struct_size(eight), 24);
KUNIT_EXPECT_EQ(test, __struct_size(empty), sizeof(struct foo)); KUNIT_EXPECT_EQ(test, __struct_size(empty), sizeof(struct foo));
} }
......
...@@ -139,14 +139,14 @@ EXPORT_SYMBOL(kmemdup_noprof); ...@@ -139,14 +139,14 @@ EXPORT_SYMBOL(kmemdup_noprof);
* kmemdup_array - duplicate a given array. * kmemdup_array - duplicate a given array.
* *
* @src: array to duplicate. * @src: array to duplicate.
* @element_size: size of each element of array.
* @count: number of elements to duplicate from array. * @count: number of elements to duplicate from array.
* @element_size: size of each element of array.
* @gfp: GFP mask to use. * @gfp: GFP mask to use.
* *
* Return: duplicated array of @src or %NULL in case of error, * Return: duplicated array of @src or %NULL in case of error,
* result is physically contiguous. Use kfree() to free. * result is physically contiguous. Use kfree() to free.
*/ */
void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp) void *kmemdup_array(const void *src, size_t count, size_t element_size, gfp_t gfp)
{ {
return kmemdup(src, size_mul(element_size, count), gfp); return kmemdup(src, size_mul(element_size, count), gfp);
} }
......
...@@ -111,6 +111,7 @@ static void report_access(const char *access, struct task_struct *target, ...@@ -111,6 +111,7 @@ static void report_access(const char *access, struct task_struct *target,
/** /**
* yama_relation_cleanup - remove invalid entries from the relation list * yama_relation_cleanup - remove invalid entries from the relation list
* @work: unused
* *
*/ */
static void yama_relation_cleanup(struct work_struct *work) static void yama_relation_cleanup(struct work_struct *work)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment