lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090204194203.a2c652d2.akpm@linux-foundation.org>
Date:	Wed, 4 Feb 2009 19:42:03 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Paul Turner <pjt@...gle.com>, linux-kernel@...r.kernel.org,
	adobriyan@...il.com, ebierderm@...ssion.com, stable@...nel.org,
	Al Viro <viro@...iv.linux.org.uk>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] Separate FMODE_PREAD/FMODE_PWRITE into separate flags

On Wed, 4 Feb 2009 19:36:15 -0800 Andrew Morton <akpm@...ux-foundation.org> wrote:

> >  /*
> >   * Don't update ctime and mtime.
> 
> Seems OK.
> 
> I augmented the changelog to
> 
>   Separate FMODE_PREAD and FMODE_PWRITE into separate flags to
>   reflect the reality that the read and write paths may have
>   independent restrictions.
> 
>   A git grep verifies that these flags are always cleared together so
>   this new behavior will only apply to interfaces that change to clear
>   flags individually.
> 
> + This is required for "seq_file: properly cope with pread", a
> + post-2.6.25 regression fix.
> 
> and added this comment:
> 
> --- a/include/linux/fs.h~vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags-fix
> +++ a/include/linux/fs.h
> @@ -54,6 +54,11 @@ struct inodes_stat_t {
>  #define MAY_ACCESS 16
>  #define MAY_OPEN 32
>  
> +/*
> + * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
> + * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
> + */
> +
>  /* file is open for reading */
>  #define FMODE_READ		((__force fmode_t)1)
>  /* file is open for writing */
> _
> 

And I updated seq_file-properly-cope-with-pread.patch thusly:

--- a/fs/seq_file.c~seq_file-properly-cope-with-pread-fix
+++ a/fs/seq_file.c
@@ -48,6 +48,16 @@ int seq_open(struct file *file, const st
 	 */
 	file->f_version = 0;
 
+	/*
+	 * seq_files support lseek() and pread().  They do not implement
+	 * write() at all, but we clear FMODE_PWRITE here for historical
+	 * reasons.
+	 *
+	 * If a client of seq_files a) implements file.write() and b) wishes to
+	 * support pwrite() then that client will need to implement its own
+	 * file.open() which calls seq_open() and then sets FMODE_WRITE.
+	 */
+	file->f_mode &= ~FMODE_PWRITE;
 	return 0;
 }
 EXPORT_SYMBOL(seq_open);
diff -puN include/linux/seq_file.h~seq_file-properly-cope-with-pread-fix include/linux/seq_file.h
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ