Skip to contentSkip to conversation

remove LSM file_llseek hook

PATCH In review Christoph Hellwig 2 participants 2 messages Oct 17, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove LSM file_llseek hook

In the initial discussion LSM folks agreed on this, the rationale is that lsseek itself makes no sense to project as mmap() and pread/pwrite() allow access to any area of the file anyway.

fs/read_write.c +0 -10
@@ -121,12 +121,6 @@
 	if (!file)
 		goto bad;
 
-	retval = security_ops->file_llseek(file);
-	if (retval) {
-		fput(file);
-		goto bad;
-	}
-
 	retval = -EINVAL;
 	if (origin <= 2) {
 		loff_t res = llseek(file, offset, origin);
@@ -152,10 +146,6 @@
 	file = fget(fd);
 	if (!file)
 		goto bad;
-
-	retval = security_ops->file_llseek(file);
-	if (retval)
-		goto out_putf;
 
 	retval = -EINVAL;
 	if (origin > 2)
include/linux/security.h +0 -5
@@ -376,10 +376,6 @@
  * @file_free_security:
  *	Deallocate and free any security structures stored in file->f_security.
  *	@file contains the file structure being modified.
- * @file_llseek:
- *	Check permission before re-positioning the file offset in @file.
- *	@file contains the file structure being modified.
- *	Return 0 if permission is granted.
  * @file_ioctl:
  *	@file contains the file structure.
  *	@cmd contains the operation to perform.
@@ -790,7 +786,6 @@
 	int (*file_permission) (struct file * file, int mask);
 	int (*file_alloc_security) (struct file * file);
 	void (*file_free_security) (struct file * file);
-	int (*file_llseek) (struct file * file);
 	int (*file_ioctl) (struct file * file, unsigned int cmd,
 			   unsigned long arg);
 	int (*file_mmap) (struct file * file,
security/capability.c +0 -6
@@ -442,11 +442,6 @@
 	return;
 }
 
-static int cap_file_llseek (struct file *file)
-{
-	return 0;
-}
-
 static int cap_file_ioctl (struct file *file, unsigned int command,
 			   unsigned long arg)
 {
@@ -787,7 +782,6 @@
 	.file_permission =		cap_file_permission,
 	.file_alloc_security =		cap_file_alloc_security,
 	.file_free_security =		cap_file_free_security,
-	.file_llseek =			cap_file_llseek,
 	.file_ioctl =			cap_file_ioctl,
 	.file_mmap =			cap_file_mmap,
 	.file_mprotect =		cap_file_mprotect,
security/dummy.c +0 -6
@@ -344,11 +344,6 @@
 	return;
 }
 
-static int dummy_file_llseek (struct file *file)
-{
-	return 0;
-}
-
 static int dummy_file_ioctl (struct file *file, unsigned int command,
 			     unsigned long arg)
 {
@@ -602,7 +597,6 @@
 	.file_permission =		dummy_file_permission,
 	.file_alloc_security =		dummy_file_alloc_security,
 	.file_free_security =		dummy_file_free_security,
-	.file_llseek =			dummy_file_llseek,
 	.file_ioctl =			dummy_file_ioctl,
 	.file_mmap =			dummy_file_mmap,
 	.file_mprotect =		dummy_file_mprotect,
#1 lore raw
Quoted 4 lines · Christoph Hellwig

In the initial discussion LSM folks agreed on this, the rationale is that lsseek itself makes no sense to project as mmap() and pread/pwrite() allow access to any area of the file anyway.

Thanks for the patch. As I'm changing all the hooks right now, I'll add this to my patches that I'm going to send to Linus later today.

thanks,

greg k-h