All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Bruno Meneguele <bmeneg@redhat.com>
Cc: linux-kernel@vger.kernel.org, pmladek@suse.com,
	sergey.senozhatsky@gmail.com, rostedt@goodmis.org,
	David.Laight@ACULAB.COM
Subject: Re: [PATCH v2] kernel/printk: add kmsg SEEK_CUR handling
Date: Fri, 20 Mar 2020 11:45:08 +0900	[thread overview]
Message-ID: <20200320024508.GB104374@google.com> (raw)
In-Reply-To: <20200317103344.574277-1-bmeneg@redhat.com>

On (20/03/17 07:33), Bruno Meneguele wrote:
> Userspace libraries, e.g. glibc's dprintf(), perform a SEEK_CUR operation
> over any file descriptor requested to make sure the current position isn't
> pointing to junk due to previous manipulation of that same fd. And whenever
> that fd doesn't have support for such operation, the userspace code expects
> -ESPIPE to be returned.
> 
> However, when the fd in question references the /dev/kmsg interface, the
> current kernel code state returns -EINVAL instead, causing an unexpected
> behavior in userspace: in the case of glibc, when -ESPIPE is returned it
> gets ignored and the call completes successfully, while returning -EINVAL
> forces dprintf to fail without performing any action over that fd:
> 
>   if (_IO_SEEKOFF (fp, (off64_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT) ==
>   _IO_pos_BAD && errno != ESPIPE)
>     return NULL;
> 
> With this patch we make sure to return the correct value when SEEK_CUR is
> requested over kmsg and also add some kernel doc information to formalize
> this behavior.
> 
> Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>

Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

      reply	other threads:[~2020-03-20  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 10:33 [PATCH v2] kernel/printk: add kmsg SEEK_CUR handling Bruno Meneguele
2020-03-20  2:45 ` Sergey Senozhatsky [this message]

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=20200320024508.GB104374@google.com \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=bmeneg@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    /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.