Skip to content

Commit c42d9ee

Browse files
committed
Merge tag 'hardening-v6.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull hardening fixes from Kees Cook: - stackleak: add declarations for global functions (Arnd Bergmann) - gcc-plugins: randstruct: Only warn about true flexible arrays (Kees Cook) - gcc-plugins: latent_entropy: Fix description typo (Konstantin Runov) * tag 'hardening-v6.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: gcc-plugins: latent_entropy: Fix typo (args -> argc) in plugin description gcc-plugins: randstruct: Only warn about true flexible arrays stackleak: add declarations for global functions
2 parents 86d11b0 + 782ce43 commit c42d9ee

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

include/linux/stackleak.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
1616
#include <asm/stacktrace.h>
17+
#include <linux/linkage.h>
1718

1819
/*
1920
* The lowest address on tsk's stack which we can plausibly erase.
@@ -76,6 +77,11 @@ static inline void stackleak_task_init(struct task_struct *t)
7677
# endif
7778
}
7879

80+
asmlinkage void noinstr stackleak_erase(void);
81+
asmlinkage void noinstr stackleak_erase_on_task_stack(void);
82+
asmlinkage void noinstr stackleak_erase_off_task_stack(void);
83+
void __no_caller_saved_registers noinstr stackleak_track_stack(void);
84+
7985
#else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
8086
static inline void stackleak_task_init(struct task_struct *t) { }
8187
#endif

scripts/gcc-plugins/latent_entropy_plugin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* if (argc <= 1)
1818
* printf("%s: no command arguments :(\n", *argv);
1919
* else
20-
* printf("%s: %d command arguments!\n", *argv, args - 1);
20+
* printf("%s: %d command arguments!\n", *argv, argc - 1);
2121
* }
2222
*
2323
* after:
@@ -47,7 +47,7 @@
4747
* // perturb_local_entropy()
4848
* } else {
4949
* local_entropy ^= 3896280633962944730;
50-
* printf("%s: %d command arguments!\n", *argv, args - 1);
50+
* printf("%s: %d command arguments!\n", *argv, argc - 1);
5151
* }
5252
*
5353
* // latent_entropy_execute() 4.

scripts/gcc-plugins/randomize_layout_plugin.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,29 +278,19 @@ static bool is_flexible_array(const_tree field)
278278
{
279279
const_tree fieldtype;
280280
const_tree typesize;
281-
const_tree elemtype;
282-
const_tree elemsize;
283281

284282
fieldtype = TREE_TYPE(field);
285283
typesize = TYPE_SIZE(fieldtype);
286284

287285
if (TREE_CODE(fieldtype) != ARRAY_TYPE)
288286
return false;
289287

290-
elemtype = TREE_TYPE(fieldtype);
291-
elemsize = TYPE_SIZE(elemtype);
292-
293288
/* size of type is represented in bits */
294289

295290
if (typesize == NULL_TREE && TYPE_DOMAIN(fieldtype) != NULL_TREE &&
296291
TYPE_MAX_VALUE(TYPE_DOMAIN(fieldtype)) == NULL_TREE)
297292
return true;
298293

299-
if (typesize != NULL_TREE &&
300-
(TREE_CONSTANT(typesize) && (!tree_to_uhwi(typesize) ||
301-
tree_to_uhwi(typesize) == tree_to_uhwi(elemsize))))
302-
return true;
303-
304294
return false;
305295
}
306296

0 commit comments

Comments
 (0)