From: Alexey Dobriyan <adobriyan@gmail.com>
To: Joel Savitz <jsavitz@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Fabrizio D'Angelo <Fabrizio_Dangelo@student.uml.edu>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-fsdevel@vger.kernel.org, fedora-rpi@googlegroups.com
Subject: Re: [PATCH] fs: proc: Clarify warnings for invalid proc dir names
Date: Mon, 21 Oct 2019 20:29:23 +0300 [thread overview]
Message-ID: <20191021172923.GA5355@avx2> (raw)
In-Reply-To: <20191020221742.5728-1-jsavitz@redhat.com>
On Sun, Oct 20, 2019 at 06:17:42PM -0400, Joel Savitz wrote:
> When one attempts to create a directory in /proc with an invalid name,
> such as one in a subdirectory that doesn't exist, one with a name beyond
> 256 characters, or a reserved name such as '.' or '..', the kernel
> throws a warning message that looks like this:
>
> [ 7913.252558] name 'invalid_name'
Yes, the important part is filename:line which uniquely identifies
the issue.
> This warning message is nearly the same for all invalid cases, including
> the removal of a nonexistent directory. This patch clarifies the warning
> message and differentiates the invalid creation/removal cases so as to
> allow the user to more quickly understand their mistake.
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -173,7 +173,7 @@ static int __xlate_proc_name(const char *name, struct proc_dir_entry **ret,
> len = next - cp;
> de = pde_subdir_find(de, cp, len);
> if (!de) {
> - WARN(1, "name '%s'\n", name);
> + WARN(1, "invalid proc dir name '%s'\n", name);
Wrong string anyway, this is nonexistent name, directory or not.
> - WARN(1, "name len %u\n", qstr.len);
> + WARN(1, "invalid proc dir name len %u\n", qstr.len);
> return NULL;
> }
> if (qstr.len == 1 && fn[0] == '.') {
> - WARN(1, "name '.'\n");
> + WARN(1, "invalid proc dir name '.'\n");
> return NULL;
> }
> if (qstr.len == 2 && fn[0] == '.' && fn[1] == '.') {
> - WARN(1, "name '..'\n");
> + WARN(1, "invalid proc dir name '..'\n");
> return NULL;
> }
> if (*parent == &proc_root && name_to_int(&qstr) != ~0U) {
> @@ -402,7 +402,7 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
> return NULL;
> }
> if (is_empty_pde(*parent)) {
> - WARN(1, "attempt to add to permanently empty directory");
> + WARN(1, "attempt to add to permanently empty directory in proc");
"proc" will be spilled over all backtrace.
> @@ -670,7 +670,7 @@ void remove_proc_entry(const char *name, struct proc_dir_entry *parent)
> rb_erase(&de->subdir_node, &parent->subdir);
> write_unlock(&proc_subdir_lock);
> if (!de) {
> - WARN(1, "name '%s'\n", name);
> + WARN(1, "unable to remove nonexistent proc dir '%s'\n", name);
I'm not sure if such chatty strings are necessary.
prev parent reply other threads:[~2019-10-21 17:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-20 22:17 [PATCH] fs: proc: Clarify warnings for invalid proc dir names Joel Savitz
2019-10-21 17:29 ` Alexey Dobriyan [this message]
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=20191021172923.GA5355@avx2 \
--to=adobriyan@gmail.com \
--cc=Fabrizio_Dangelo@student.uml.edu \
--cc=akpm@linux-foundation.org \
--cc=fedora-rpi@googlegroups.com \
--cc=gregkh@linuxfoundation.org \
--cc=jsavitz@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).