* [PATCH] proc: Report file name on detected read_proc overflow
@ 2010-04-01 13:09 Jan Kiszka
2010-04-01 14:41 ` Frans Pop
2010-04-02 6:28 ` [PATCH] " Alexey Dobriyan
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2010-04-01 13:09 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Andrew Morton, Alexey Dobriyan, Helight.Xu, Al Viro
This can help identifying the buggy read_proc handler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
fs/proc/generic.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 08f4d71..cc7e671 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -132,7 +132,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
if (start == NULL) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer "
+ "overflow reading \"%s\"!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
n -= *ppos;
@@ -144,7 +146,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
} else if (start < page) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer "
+ "overflow reading \"%s\"!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
if (n > count) {
@@ -159,7 +163,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
unsigned long startoff = (unsigned long)(start - page);
if (n > (PAGE_SIZE - startoff)) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer "
+ "overflow reading \"%s\"!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE - startoff;
}
if (n > count)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] proc: Report file name on detected read_proc overflow
2010-04-01 13:09 [PATCH] proc: Report file name on detected read_proc overflow Jan Kiszka
@ 2010-04-01 14:41 ` Frans Pop
2010-04-01 16:16 ` [PATCH v2] " Jan Kiszka
2010-04-02 6:28 ` [PATCH] " Alexey Dobriyan
1 sibling, 1 reply; 5+ messages in thread
From: Frans Pop @ 2010-04-01 14:41 UTC (permalink / raw)
To: Jan Kiszka; +Cc: linux-kernel, akpm, adobriyan, helight.xu, viro
Jan Kiszka wrote:
> - "proc_file_read: Apparent buffer overflow!\n");
> + "proc_file_read: Apparent buffer "
> + "overflow reading \"%s\"!\n",
> + file->f_path.dentry->d_name.name);
I think it would be good to keep "overflow" on the first line as that
may be what people will grep the source for. And maybe use single quotes
around the file name. So:
+ "proc_file_read: Apparent buffer overflow "
+ "reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
Cheers,
FJP
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] proc: Report file name on detected read_proc overflow
2010-04-01 14:41 ` Frans Pop
@ 2010-04-01 16:16 ` Jan Kiszka
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2010-04-01 16:16 UTC (permalink / raw)
To: linux-kernel@vger.kernel.org
Cc: Frans Pop, akpm@linux-foundation.org, adobriyan@gmail.com,
helight.xu@gmail.com, viro@zeniv.linux.org.uk
This can help identifying the buggy read_proc handler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
fs/proc/generic.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
changes in v2:
- keep "Apparent buffer overflow" in the same source code line
- quote the file name with ''
(Thanks, Frans!)
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 08f4d71..ce14eca 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -132,7 +132,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
if (start == NULL) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
n -= *ppos;
@@ -144,7 +146,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
} else if (start < page) {
if (n > PAGE_SIZE) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE;
}
if (n > count) {
@@ -159,7 +163,9 @@ __proc_file_read(struct file *file, char __user *buf, size_t nbytes,
unsigned long startoff = (unsigned long)(start - page);
if (n > (PAGE_SIZE - startoff)) {
printk(KERN_ERR
- "proc_file_read: Apparent buffer overflow!\n");
+ "proc_file_read: Apparent buffer overflow"
+ " reading '%s'!\n",
+ file->f_path.dentry->d_name.name);
n = PAGE_SIZE - startoff;
}
if (n > count)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] proc: Report file name on detected read_proc overflow
2010-04-01 13:09 [PATCH] proc: Report file name on detected read_proc overflow Jan Kiszka
2010-04-01 14:41 ` Frans Pop
@ 2010-04-02 6:28 ` Alexey Dobriyan
2010-04-06 16:48 ` Jan Kiszka
1 sibling, 1 reply; 5+ messages in thread
From: Alexey Dobriyan @ 2010-04-02 6:28 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Linux Kernel Mailing List, Andrew Morton, Helight.Xu, Al Viro
On Thu, Apr 1, 2010 at 4:09 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> This can help identifying the buggy read_proc handler.
->read_proc is going to be removed, so there is no point.
> - "proc_file_read: Apparent buffer overflow!\n");
> + "proc_file_read: Apparent buffer "
> + "overflow reading \"%s\"!\n",
> + file->f_path.dentry->d_name.name);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] proc: Report file name on detected read_proc overflow
2010-04-02 6:28 ` [PATCH] " Alexey Dobriyan
@ 2010-04-06 16:48 ` Jan Kiszka
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2010-04-06 16:48 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: Linux Kernel Mailing List, Andrew Morton, Helight.Xu, Al Viro
Alexey Dobriyan wrote:
> On Thu, Apr 1, 2010 at 4:09 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> This can help identifying the buggy read_proc handler.
>
> ->read_proc is going to be removed, so there is no point.
OK. What is the planned kernel release or date?
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-04-06 16:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-01 13:09 [PATCH] proc: Report file name on detected read_proc overflow Jan Kiszka
2010-04-01 14:41 ` Frans Pop
2010-04-01 16:16 ` [PATCH v2] " Jan Kiszka
2010-04-02 6:28 ` [PATCH] " Alexey Dobriyan
2010-04-06 16:48 ` Jan Kiszka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox