From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752913AbbI1UM1 (ORCPT ); Mon, 28 Sep 2015 16:12:27 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:34894 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751289AbbI1UM0 (ORCPT ); Mon, 28 Sep 2015 16:12:26 -0400 From: Rasmus Villemoes To: Andy Shevchenko Cc: Andrew Morton , Tejun Heo , linux-kernel@vger.kernel.org, Kees Cook Subject: Re: [PATCH 1/4] lib/vsprintf.c: handle invalid format specifiers more robustly Organization: D03 References: <1443202865-25533-1-git-send-email-linux@rasmusvillemoes.dk> <1443202865-25533-2-git-send-email-linux@rasmusvillemoes.dk> <1443427691.8361.226.camel@linux.intel.com> X-Hashcash: 1:20:150928:linux-kernel@vger.kernel.org::FYhd8WGcRRRn/F1X:0000000000000000000000000000000000LtY X-Hashcash: 1:20:150928:akpm@linux-foundation.org::T0PdN3U/VVel4h1/:0000000000000000000000000000000000000soF X-Hashcash: 1:20:150928:tj@kernel.org::KChEfr/CWa0W2c7T:00001dZH X-Hashcash: 1:20:150928:keescook@chromium.org::/VSv/vivLuzX3GxY:00000000000000000000000000000000000000001o3M X-Hashcash: 1:20:150928:andriy.shevchenko@linux.intel.com::U9y7NnBrN6oolhmK:000000000000000000000000000036gZ Date: Mon, 28 Sep 2015 22:12:23 +0200 In-Reply-To: <1443427691.8361.226.camel@linux.intel.com> (Andy Shevchenko's message of "Mon, 28 Sep 2015 11:08:11 +0300") Message-ID: <87bncmfgm0.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28 2015, Andy Shevchenko wrote: >> /* >> - * Since %n poses a greater security risk than >> utility, treat >> - * it as an invalid format specifier. Warn about its >> use so >> - * that new instances don't get added. >> + * Since %n poses a greater security risk than > > Any reason to wrap first string? I just hit M-q in emacs and let that take care of somewhat sane wrapping. I don't play diff golf. >> + /* >> + * Presumably the arguments passed gcc's >> type >> + * checking, but there is no safe or sane >> way >> + * for us to continue parsing the format and >> + * fetching from the va_list; the remaining >> + * specifiers and arguments would be out of >> + * sync. > > Could we use wider strings in the commentary here? Ditto. Rasmus