Subject: + vsprintf-bug-on-%n.patch added to -mm tree To: keescook@xxxxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Mon, 27 Jan 2014 15:10:45 -0800 The patch titled Subject: vsprintf: BUG on %n has been added to the -mm tree. Its filename is vsprintf-bug-on-%n.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/vsprintf-bug-on-%n.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/vsprintf-bug-on-%n.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Kees Cook <keescook@xxxxxxxxxxxx> Subject: vsprintf: BUG on %n Now that there has been a full release of the kernel, and all users of %n have been dropped, switch to %n use triggering a BUG. Ignoring arguments could be used to assist in information leaks if an arbitrary format string was under the control of an attacker. Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/vsprintf.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff -puN lib/vsprintf.c~vsprintf-bug-on-%n lib/vsprintf.c --- a/lib/vsprintf.c~vsprintf-bug-on-%n +++ a/lib/vsprintf.c @@ -1735,15 +1735,12 @@ int vsnprintf(char *buf, size_t size, co case FORMAT_TYPE_NRCHARS: { /* * Since %n poses a greater security risk than - * utility, ignore %n and skip its argument. + * utility, it should not be implemented. Instead, + * BUG when encountering %n, since there are no + * legitimate users and skipping arguments could + * assist information leak attacks. */ - void *skip_arg; - - WARN_ONCE(1, "Please remove ignored %%n in '%s'\n", - old_fmt); - - skip_arg = va_arg(args, void *); - break; + BUG(); } default: _ Patches currently in -mm which might be from keescook@xxxxxxxxxxxx are origin.patch vsprintf-bug-on-%n.patch lib-vsprintf-add-%pt-format-specifier.patch binfmt_elfc-use-get_random_int-to-fix-entropy-depleting.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html