From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751388AbcLDKxv (ORCPT ); Sun, 4 Dec 2016 05:53:51 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:35668 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750804AbcLDKxt (ORCPT ); Sun, 4 Dec 2016 05:53:49 -0500 Date: Sun, 4 Dec 2016 19:52:08 +0900 From: Sergey Senozhatsky To: Greg KH Cc: Sergey Senozhatsky , Andrew Morton , Minchan Kim , Steven Allen , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] zram: restrict add/remove attributes to root only Message-ID: <20161204105208.GA592@tigerII.localdomain> References: <20161204023515.7740-1-sergey.senozhatsky@gmail.com> <20161204102807.GB15437@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161204102807.GB15437@kroah.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (12/04/16 11:28), Greg KH wrote: > On Sun, Dec 04, 2016 at 11:35:15AM +0900, Sergey Senozhatsky wrote: [..] > Why can't a normal user read the attribute? Does a read actually modify > something? yes, it does. reading from a hot_add file creates a new zram device and returns a new device's device_id. not initialized device (so it does not eat the memory for handle table, etc.), but with its own set of sysfs attrs, etc. which consumes memory after all. so a 'normal' user, doing a simple read from a hot_add file in a loop just for fun, can create a lot of devices and, quite likely, cause some troubles (as reported by Steven Allen). -ss