Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753615Ab2FFEAv (ORCPT ); Wed, 6 Jun 2012 00:00:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36569 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150Ab2FFEAs (ORCPT ); Wed, 6 Jun 2012 00:00:48 -0400 Date: Tue, 5 Jun 2012 21:01:18 -0700 From: Andrew Morton To: Wanpeng Li Cc: Fengguang Wu , Rob Landley , Alexander Viro , "Eric W. Biederman" , Lucas De Marchi , "David S. Miller" , Jan Kara , Mel Gorman , Minchan Kim , David Howells , James Morris , Ingo Molnar , Michel Lespinasse , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gavin Shan Subject: Re: [PATCH v2] remove no longer use of pdflush interface Message-Id: <20120605210118.aa161171.akpm@linux-foundation.org> In-Reply-To: <20120606032127.GA11121@kernel> References: <1338888372-3555-1-git-send-email-liwp.linux@gmail.com> <20120605152845.8b633881.akpm@linux-foundation.org> <20120606032127.GA11121@kernel> X-Mailer: Sylpheed 2.7.1 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1652 Lines: 32 On Wed, 6 Jun 2012 11:21:27 +0800 Wanpeng Li wrote: > >Secondly, this code will permit unprivileged users to flood the logs, > >by repeatedly reading /proc/sys/vm/nr_pdflush_threads. We try to avoid > >this, as it is a form of denial-of-service attack. > > > >This is a bit hard to fix. The typical way of addressing this is to > >use printk_once(), so the message only appears once per boot. But that > >doesn't work for a generic function - we'd need to add one bit of state > >to the ctl_table to do this. We can of course do that, but it's not > >obvious that it's _worth_ doing that just for handling obsolete > >entries. > > > >So perhaps the solution is to give up on the generic proc_obsolete() > >idea, and just add a handler specifically for nr_pdflush_threads, whcih > >uses printk_once(). > > What about modify the generic proc_obsolete just to put the warning message into > the buffer, then transfer to userspace, in order to users can see this warning.Do > you think this is a better idea? err, no. That's deliberately corrupting the output of an existing interface. In response to this change userspace might crash, hand over root privileges or tune to a porn channel. Instead we should yield a well-formed response such as "0" (or maybe non-zero, if a zero response might be unexpected) and inform the system operator via conventional means. ie: syslog. -- 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/