All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Tejun Heo <tj@kernel.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
	Kay Sievers <kay@vrfy.org>,
	linux-next@vger.kernel.org
Subject: Re: [BUG -next] sysfs change breaks userspace
Date: Fri, 1 Nov 2013 08:04:48 -0700	[thread overview]
Message-ID: <20131101150448.GB18600@kroah.com> (raw)
In-Reply-To: <20131101143542.GC20005@htj.dyndns.org>

On Fri, Nov 01, 2013 at 10:35:42AM -0400, Tejun Heo wrote:
> Hello, Heiko.
> 
> On Fri, Nov 01, 2013 at 03:13:48PM +0100, Heiko Carstens wrote:
> > before your patch it was like this:
> > 
> > [pid  2888] open("/sys/class/net/eth0/broadcast", O_RDONLY) = 5
> > [pid  2888] lseek(5, 0, SEEK_END)       = 4096
> > [pid  2888] lseek(5, 0, SEEK_SET)       = 0
> > [pid  2888] read(5, "ff:ff:ff:ff:ff:ff\n", 4096) = 18
> > [pid  2888] close(5)                    = 0
> > 
> > With your patch applied I get this:
> > 
> > [pid  2450] open("/sys/class/net/eth0/broadcast", O_RDONLY) = 5
> > [pid  2450] lseek(5, 0, SEEK_END)       = -1 EINVAL (Invalid argument)
> > [pid  2450] lseek(5, 0, SEEK_SET)       = 0
> > [pid  2450] read(5, 0x557421e8, 4294967295) = -1 EINVAL (Invalid argument)
> > [pid  2450] close(5)                    = 0
> > 
> > So the problem is that lseek with SEEK_END doesn't work.
> > Afterwards the process tried to use the return value of lseek as number of
> > bytes to be read, which doesn't work ;)
> > 
> > This is a Fedora 17 like system on s390. It's a bit special since the kernel
> > is 64 bit and whole user space is 32 bit.
> 
> LOL, that's creative.  I guess we'll have to give up using
> seq_lseek().  Can you please test the following?
> 
> Thanks.
> 
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 382db3c..79b5da2 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -800,7 +800,7 @@ EXPORT_SYMBOL_GPL(sysfs_notify);
>  const struct file_operations sysfs_file_operations = {
>  	.read		= seq_read,
>  	.write		= sysfs_write_file,
> -	.llseek		= seq_lseek,
> +	.llseek		= generic_file_llseek,

Does that mean that seq_lseek can't handle SEEK_END?  Shouldn't we fix
that instead?

thanks,

greg k-h

  reply	other threads:[~2013-11-01 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 11:43 [BUG -next] sysfs change breaks userspace Heiko Carstens
2013-10-31 17:25 ` Tejun Heo
2013-11-01 14:13   ` Heiko Carstens
2013-11-01 14:35     ` Tejun Heo
2013-11-01 15:04       ` Greg Kroah-Hartman [this message]
2013-11-01 15:08         ` Tejun Heo
2013-11-01 16:14           ` Greg Kroah-Hartman
2013-11-01 17:16             ` [PATCH driver-core-next] sysfs: use generic_file_llseek() for sysfs_file_operations Tejun Heo
2013-11-01 17:19               ` Greg Kroah-Hartman
2013-11-01 18:40                 ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131101150448.GB18600@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kay@vrfy.org \
    --cc=linux-next@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.