From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933626AbaDBX54 (ORCPT ); Wed, 2 Apr 2014 19:57:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:52906 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933423AbaDBX5z (ORCPT ); Wed, 2 Apr 2014 19:57:55 -0400 Date: Thu, 3 Apr 2014 01:57:52 +0200 (CEST) From: Jiri Kosina To: Linus Torvalds cc: Andrew Morton , Mateusz Guzik , Greg Kroah-Hartman , Steven Rostedt , LKML , Thomas Gleixner , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Mel Gorman , Kay Sievers Subject: Re: [RFC PATCH] cmdline: Hide "debug" from /proc/cmdline In-Reply-To: Message-ID: References: <20140402144219.4cafbe37@gandalf.local.home> <20140402221212.GD16570@mguzik.redhat.com> <20140402162839.d3c00e9845e89d0f092c2ce3@linux-foundation.org> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Apr 2014, Linus Torvalds wrote: > > Which doesn't really protect you from tasks that do open()/write()/close() > > cycle for /dev/kmsg write every 2ms though. > > I don't think we should try to protect against wilful bad behavior > unless that is shown to be necessary. Yeah, if it turns out that > systemd really does that just to mess with us, we'd need to extend it, > but in the absence of proof to the contrary, maybe this simple > attached patch works? > > TOTALLY UNTESTED. But it really isn't complex. [ ... snip ... [ @@ -483,6 +484,8 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, if (!user) return -EBADF; + if (!___ratelimit(&user->rs, current->comm)) + return 0; I am admittedly rather new to this 'abuse the hell out of kernel ringbuffer' thing, but shouldn't we better be limiting the devkmsg_writev()? -- Jiri Kosina SUSE Labs