kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] FORTIFY_SOURCE: detect intra-object overflow in string functions
@ 2020-01-20  4:54 Daniel Axtens
  2020-01-20  4:54 ` [PATCH v2 1/2] string.h: detect intra-object overflow in fortified " Daniel Axtens
  2020-01-20  4:54 ` [PATCH v2 2/2] lkdtm: tests for FORTIFY_SOURCE Daniel Axtens
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Axtens @ 2020-01-20  4:54 UTC (permalink / raw)
  To: kernel-hardening, akpm, keescook; +Cc: linux-kernel, Daniel Axtens

When the fortify feature was first introduced in commit 6974f0c4555e
("include/linux/string.h: add the option of fortified string.h functions"),
Daniel Micay observed:

  * It should be possible to optionally use __builtin_object_size(x, 1) for
    some functions (C strings) to detect intra-object overflows (like
    glibc's _FORTIFY_SOURCE=2), but for now this takes the conservative
    approach to avoid likely compatibility issues.

This patch set:

 - converts a number of string functions to use __builtin_object_size(x, 1)

 - adds LKDTM tests for both types of fortified function.

This change passes an allyesconfig on powerpc and x86, and an x86 kernel
built with it survives running with syz-stress from syzkaller, so it seems
safe so far.

Daniel Axtens (2):
  string.h: detect intra-object overflow in fortified string functions
  lkdtm: tests for FORTIFY_SOURCE

 drivers/misc/lkdtm/bugs.c  | 51 ++++++++++++++++++++++++++++++++++++++
 drivers/misc/lkdtm/core.c  |  2 ++
 drivers/misc/lkdtm/lkdtm.h |  2 ++
 include/linux/string.h     | 27 ++++++++++++--------
 4 files changed, 71 insertions(+), 11 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-20  4:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20  4:54 [PATCH v2 0/2] FORTIFY_SOURCE: detect intra-object overflow in string functions Daniel Axtens
2020-01-20  4:54 ` [PATCH v2 1/2] string.h: detect intra-object overflow in fortified " Daniel Axtens
2020-01-20  4:54 ` [PATCH v2 2/2] lkdtm: tests for FORTIFY_SOURCE Daniel Axtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).