All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@virtuozzo.com>
To: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>
Subject: [PATCH 1/1] proc_keys_next should increase position index
Date: Fri, 24 Jan 2020 06:25:16 +0000	[thread overview]
Message-ID: <af9dcaa7-6e4f-281a-2bae-fb605cc55d2d@virtuozzo.com> (raw)

if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id 6283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 security/keys/proc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/keys/proc.c b/security/keys/proc.c
index 415f3f1..d0cde66 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -139,6 +139,8 @@ static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos)
 	n = key_serial_next(p, v);
 	if (n)
 		*_pos = key_node_serial(n);
+	else
+		(*_pos)++;
 	return n;
 }
 
-- 
1.8.3.1

WARNING: multiple messages have this Message-ID (diff)
From: Vasily Averin <vvs@virtuozzo.com>
To: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org
Cc: David Howells <dhowells@redhat.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>
Subject: [PATCH 1/1] proc_keys_next should increase position index
Date: Fri, 24 Jan 2020 09:25:16 +0300	[thread overview]
Message-ID: <af9dcaa7-6e4f-281a-2bae-fb605cc55d2d@virtuozzo.com> (raw)

if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 security/keys/proc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/keys/proc.c b/security/keys/proc.c
index 415f3f1..d0cde66 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -139,6 +139,8 @@ static void *proc_keys_next(struct seq_file *p, void *v, loff_t *_pos)
 	n = key_serial_next(p, v);
 	if (n)
 		*_pos = key_node_serial(n);
+	else
+		(*_pos)++;
 	return n;
 }
 
-- 
1.8.3.1


             reply	other threads:[~2020-01-24  6:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24  6:25 Vasily Averin [this message]
2020-01-24  6:25 ` [PATCH 1/1] proc_keys_next should increase position index Vasily Averin
2020-01-27 11:39 ` David Howells
2020-01-27 11:39   ` David Howells
2020-01-27 19:27   ` Vasily Averin
2020-01-27 19:27     ` Vasily Averin
2020-01-30 10:16     ` [PATCH v2] keys: " Vasily Averin
2020-01-30 10:16       ` Vasily Averin
2020-01-31 17:19     ` David Howells
2020-01-31 17:19       ` David Howells
2020-02-01  7:54       ` Vasily Averin
2020-02-01  7:54         ` Vasily Averin
2020-01-30  8:42   ` [PATCH 1/1] " Jarkko Sakkinen
2020-01-30  8:42     ` Jarkko Sakkinen
2020-01-30  8:38 ` Jarkko Sakkinen
2020-01-30  8:38   ` Jarkko Sakkinen

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=af9dcaa7-6e4f-281a-2bae-fb605cc55d2d@virtuozzo.com \
    --to=vvs@virtuozzo.com \
    --cc=dhowells@redhat.com \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.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.