From: "D. Stussy" <spam@spam.org>
To: linux-kernel@vger.kernel.org
Subject: Suggestion: config: devtmpfs: Allow mount parameters to be set in kernel configuration
Date: Tue, 16 May 2017 17:54:39 -0700 [thread overview]
Message-ID: <ogi8b0$ma$1@snarked.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2477 bytes --]
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 <linux/sched.h>
#include <linux/slab.h>
#include <linux/kthread.h>
+#include <linux/kconfig.h>
#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)
[-- Attachment #2: SpamReport.text --]
[-- Type: text/plain, Size: 1720 bytes --]
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)
<dns:snarked.org?type=MX> [90 mx.fakemx.net., 20 mail.snarked.net., 10 mail.snarked.org., 80 tarbaby.junkemailfilter.com.]
next reply other threads:[~2017-05-29 22:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 0:54 D. Stussy [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-05-17 0:54 Suggestion: config: devtmpfs: Allow mount parameters to be set in kernel configuration D. Stussy
2017-05-30 0:08 D. Stussy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='ogi8b0$ma$1@snarked.org' \
--to=spam@spam.org \
--cc=linux-kernel@vger.kernel.org \
--cc=newsgroups+replies@kd6lvw.ampr.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.