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]
Date:	Thu, 29 Jan 2009 17:26:52 -0800 (PST)
From:	Paul Turner <pjt@...gle.com>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
cc:	Alexey Dobriyan <adobriyan@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Turner <pjt@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: Migration of kernel interfaces to seq_files breaks pread()
 consumers

On Tue, 27 Jan 2009, Eric W. Biederman wrote:

> Alexey Dobriyan <adobriyan@...il.com> writes:
> 
> > On Sat, Jan 24, 2009 at 06:19:24PM -0800, Andrew Morton wrote:
> >> On Fri, 16 Jan 2009 23:51:35 -0800 (PST) Paul Turner <pjt@...gle.com> wrote:
> >> 
> >> > 
> >> > (Specifically) Several interfaces under /proc have been migrated to use 
> >> > seq_files.  This was previously observed to be a problem with VMware's 
> >> > reading of /proc/uptime.  We're now running into the same problem on  
> >> > /proc/<pid>/stat; we have many consumers performing preads on this 
> >> > interface which break under new kernels.
> >> > 
> >> > Reverting these migrations presents other problems and doesn't scale with 
> >> > everyones' pet dependencies over an abi that's been
> >> > broken :(
> >> 
> >> We changed userspace-visible behaviour and broke real applications. 
> >> This is a serious matter.  So serious in fact that your report has
> >> languished without reply for a week.
> >> 
> >> Reverting those changes until we have a suitable reimplementation which
> >> doesn't bust userspace is 100% justifiable.
> >> 
> >> In which kernel versions is this regression present?
> >> 
> >> What would a revert look like?  Big and ugly or small and simple?  Do
> >> the original commits (which were they?) still revert OK?
> >
> > This is bug http://bugzilla.kernel.org/show_bug.cgi?id=11856
> > Some of us think what to do here.
> >
> > Original patch not revertable as is.
> 
> Interesting.  This seems like a bug in seq_file plain and simple.
> Userspace appears to be acting very reasonable in this case.
> 
> Why is there a notion that we have to differentiate between read
> and pread in seq_file to fix this.  That doesn't make much sense.
> 
> Anyway here is an untested but logically correct patch which should fix
> this issue, without nasty special casing of pread.
> 
> Eric
> 

Thanks Eric,

Moving the position into the seq_file structure is much cleaner.  Basic 
tests seem to work ok.

Few comments:
- seq_open needs its fmode opened up to take advantage of this [patch 
below]
- There's still the inherent problem of reads peturbing other reads (both 
read and pread).  Our applications should be ok with this, however it does 
deviate from the supposedly thread-safe pread semantics.

- Paul

---
 fs/seq_file.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index cd63d69..aa3621f 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -48,8 +48,6 @@ int seq_open(struct file *file, const struct seq_operations *op)
 	 */
 	file->f_version = 0;
 
-	/* SEQ files support lseek, but not pread/pwrite */
-	file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
 	return 0;
 }
 EXPORT_SYMBOL(seq_open);
-- 
1.5.4.5

--
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