Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2992633AbbHHTbF (ORCPT ); Sat, 8 Aug 2015 15:31:05 -0400 Received: from mail-io0-f176.google.com ([209.85.223.176]:36161 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2992586AbbHHTbB (ORCPT ); Sat, 8 Aug 2015 15:31:01 -0400 MIME-Version: 1.0 In-Reply-To: <8996.1439052115@jrobl> References: <20150807234150.GA11735@www.outflux.net> <8996.1439052115@jrobl> Date: Sat, 8 Aug 2015 12:31:00 -0700 X-Google-Sender-Auth: lc1ETbtXwcAYrZ4RAqVgfuNMRwg Message-ID: Subject: Re: [PATCH] fs: create and use seq_show_option for escaping From: Kees Cook To: "J. R. Okajima" Cc: Andrew Morton , "Yan, Zheng" , Sage Weil , Ilya Dryomov , Steve French , Jan Kara , Andreas Dilger , "Theodore Ts'o" , Steven Whitehouse , Bob Peterson , Jeff Dike , Richard Weinberger , Mark Fasheh , Joel Becker , Miklos Szeredi , Dave Chinner , xfs@oss.sgi.com, Tejun Heo , Li Zefan , Johannes Weiner , "David S. Miller" , Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E. Hallyn" , Jens Axboe , Fabian Frederick , Christoph Hellwig , Firo Yang , David Howells , Jiri Slaby , Al Viro , Joe Perches , Steven Rostedt , "linux-fsdevel@vger.kernel.org" , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1527 Lines: 38 On Sat, Aug 8, 2015 at 9:41 AM, J. R. Okajima wrote: > > Kees Cook: >> This fixes the problem by adding new seq_show_option and seq_show_option_n >> helpers, and updating the vulnerable show_option handlers to use them as >> needed. Some, like SELinux, need to be open coded due to unusual existing >> escape mechanisms. > > How about other ctrl chars such as CR or FF? > I am using the similar function for many years, and it might be more > generic because it supports all cntrl chars other than "\t\n\\" (see > below). > > Many of other ctrl chars may not be necessary. But some people uses > non-ASCII chars for their pathnames which may contain ESC or other > chars. Any crazy chars can corrupt the output of /proc/mount and > others. So it might be better to consider all ctrl chars. While that's generally true, it's the consumers of mounts and mountinfo that we need to worry about, and for those, it's only the delimiters that we need to be concerned about (space, tab, newline, and escapes). However, since these consumers are expecting to deal with escapes, we could, at any time, add new classes of characters to be escaped. For this change, though, I wanted to keep it minimal for easiest backporting. -Kees -- Kees Cook Chrome OS Security -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/