tracing: disable seeking for trace_pipe_raw
PATCH 1/4 tracing: disable seeking for trace_pipe_raw
Impact: disable pread()
We set tracing_buffers_fops.llseek to no_llseek, but we can still perform pread() to read this file. That is not expected.
This fix uses nonseekable_open() to disable it.
tracing_buffers_fops.llseek is still set to no_llseek, it mark this file is a "non-seekable device" and is used by sys_splice(). See also do_splice() or manual of splice(2):
ERRORS
EINVAL Target file system doesn't support splicing;
neither of the descriptors refers to a pipe;
or offset given for non-seekable device.---
kernel/trace/trace.c +1 -1
@@ -3265,7 +3265,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) filp->private_data = info; -return 0 ; +return nonseekable_open (inode, filp); out:kfree (info);
Commit-ID: d1e7e02f30be672c6f6ee40908be83877a0d49d1 Gitweb: http://git.kernel.org/tip/d1e7e02f30be672c6f6ee40908be83877a0d49d1 Author: Lai Jiangshan <[email protected]> AuthorDate: Thu, 2 Apr 2009 15:16:56 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 10 Apr 2009 12:44:42 +0200
tracing: disable seeking for trace_pipe_raw
Impact: disable pread()
We set tracing_buffers_fops.llseek to no_llseek, but we can still perform pread() to read this file.
That is not expected.
This fix uses nonseekable_open() to disable it.
tracing_buffers_fops.llseek is still set to no_llseek, it mark this file is a "non-seekable device" and is used by sys_splice(). See also do_splice() or manual of splice(2):
ERRORS
EINVAL Target file system doesn't support splicing;
neither of the descriptors refers to a pipe;
or offset given for non-seekable device.LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace.c +1 -1
@@ -3285,7 +3285,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) filp->private_data = info; -return 0 ; +return nonseekable_open (inode, filp); out:kfree (info);