From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbdE2W4i (ORCPT ); Mon, 29 May 2017 18:56:38 -0400 Received: from mail.snarked.org ([67.43.172.250]:28856 "EHLO mail.snarked.org" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751201AbdE2W4h (ORCPT ); Mon, 29 May 2017 18:56:37 -0400 X-Envelope-From: (localhost) Authentication-Results: localhost; Spam=pass smtp.mailfrom= (Score=3.243) To: linux-kernel@vger.kernel.org From: "D. Stussy" Newsgroups: linux.kernel Subject: Suggestion: config: devtmpfs: Allow mount parameters to be set in kernel configuration Followup-To: linux.kernel Date: Tue, 16 May 2017 17:54:39 -0700 Message-ID: Reply-To: "D. Stussy" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1496097958-721-0" X-Priority: 3 X-No-Archive: Yes X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 X-MSMail-Priority: Normal Importance: Normal Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format... ------------=_1496097958-721-0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit config: devtmpfs: Allow mount parameters to be set in kernel configuration Why? To limit the size of the file system to prevent runaway dynamic device creation. Even a "udev" rescue kernel takes a small size (e.g. slackware 14.2 uses 52kB and 2,666 inodes). Setting reasonable size limits (e.g. 64k and 3,072 inodes) will accommodate most setups. Although a remount during an initialization script can also solve this problem, why not do it correctly the first time? Patch against kernel versions 4.10.*: diff -bur drivers/base/Kconfig drivers/base/Kconfig --- drivers/base/Kconfig 2017-02-26 10:09:33.000000000 +0000 +++ drivers/base/Kconfig 2017-03-04 02:48:20.299991304 +0000 @@ -59,6 +59,22 @@ rescue mode with init=/bin/sh, even when the /dev directory on the rootfs is completely empty. +config DEVTMPFS_OPTIONS + string "Automounted devtmpfs mount options" + default "mode=0755" + depends on DEVTMPFS_MOUNT + help + The devtmpfs file system mounted at /dev will be mounted with the + specified mount options. "Mode", "size" (or "nr_blocks"), "nr_inodes", + "uid" and "gid" make sense here. Options "huge" or "mpol" may be + available but are dependent on other kernel configuration choices. + See the manual page for the mount command for details. + + Warning: Unrecognized options may cause the kernel not to boot. + Note: Options "mode", "uid", and "gid" are ignored on remounts. + + If uncertain, leave the default setting at "mode=0755". + config STANDALONE bool "Select only drivers that don't need compile-time external firmware" default y diff -bur drivers/base/devtmpfs.c drivers/base/devtmpfs.c --- drivers/base/devtmpfs.c 2017-02-26 10:09:33.000000000 +0000 +++ drivers/base/devtmpfs.c 2017-03-03 20:53:45.879928595 +0000 @@ -24,6 +24,7 @@ #include #include #include +#include #include "base.h" static struct task_struct *thread; @@ -358,7 +359,7 @@ if (err) printk(KERN_INFO "devtmpfs: error mounting %i\n", err); else - printk(KERN_INFO "devtmpfs: mounted\n"); + printk(KERN_INFO "devtmpfs: mounted (%s)\n", CONFIG_DEVTMPFS_OPTIONS); return err; } @@ -375,7 +376,7 @@ static int devtmpfsd(void *p) { - char options[] = "mode=0755"; + char options[] = CONFIG_DEVTMPFS_OPTIONS; int *err = p; *err = sys_unshare(CLONE_NEWNS); if (*err) ------------=_1496097958-721-0 Content-Type: text/plain; name="SpamReport.text" Content-Disposition: attachment; filename="SpamReport.text" Content-Transfer-Encoding: 7bit Spam detection software, running on the system "snarked.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see http://www.snarked.org/spam for details. Content preview: config: devtmpfs: Allow mount parameters to be set in kernel configuration Why? To limit the size of the file system to prevent runaway dynamic device creation. Even a "udev" rescue kernel takes a small size (e.g. slackware 14.2 uses 52kB and 2,666 inodes). Setting reasonable size limits (e.g. 64k and 3,072 inodes) will accommodate most setups. Although a remount during an initialization script can also solve this problem, why not do it correctly the first time? [...] Content analysis details: (3.2 points, 7.5 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.2 STOX_REPLY_TYPE No description available. 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 2.1 DATE_IN_PAST_96_XX Date: is 96 hours or more before Received: date 0.1 RCVD_IN_DNSWL_NO Sender *not* listed at http://www.dnswl.org/ 1.9 STOX_REPLY_TYPE_WITHOUT_QUOTES No description available. SAV: 3.4.1-snarked_ec212 (2015-04-28) ASN: () _RELAYCOUNTRY_ CIP: DCC: snarked.org 104; Body=2 Fuz1=2 Fuz2=2 (x.dcc-servers) PYZ: BAY: 0.5 (no autolearn_force=no) [90 mx.fakemx.net., 20 mail.snarked.net., 10 mail.snarked.org., 80 tarbaby.junkemailfilter.com.] ------------=_1496097958-721-0--