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: <20200709105906.GC11164@alley>
Date:   Thu, 9 Jul 2020 12:59:06 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        kernel test robot <rong.a.chen@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrea Parri <parri.andrea@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Paul McKenney <paulmck@...nel.org>, kexec@...ts.infradead.org,
        linux-kernel@...r.kernel.org, lkp@...ts.01.org
Subject: Re: [printk] 18a2dc6982: ltp.kmsg01.fail

On Thu 2020-07-09 12:20:35, John Ogness wrote:
> On 2020-07-09, Sergey Senozhatsky <sergey.senozhatsky@...il.com> wrote:
> > On (20/07/09 15:14), kernel test robot wrote:
> > [..]
> >
> > Took me a while to find the FAIL-ed test:
> >
> >> kmsg01.c:393: INFO: TEST: read returns EPIPE when messages get overwritten
> >> kmsg01.c:398: INFO: first seqno: 0
> >> kmsg01.c:411: INFO: first seqno now: 881
> >> kmsg01.c:425: FAIL: read returned: 77: SUCCESS (0)
> >
> > So this is seq number related
> > https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/logging/kmsg/kmsg01.c#L383
> 
> Excellent test.
> 
> Since the messages are above the expected average size, the dataring is
> wrapping before the descriptor ring. This means that the initial
> descriptors are still there, but their data is gone. Initially I would
> generate an EPIPE for this, but it was changed. Here is the thread [0]
> we had about this.

I see. IMHO, the following should do the job. The check is done only
when the above prb_read_valid() succeeded. Therefore the printk_record
has to include a valid value. And it must be the first valid record
when some messages were lost.

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 62fc1abd9c4d..5d4760b5c671 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -775,9 +775,9 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
 		logbuf_lock_irq();
 	}
 
-	if (user->seq < prb_first_seq(prb)) {
+	if (user->seq < r->info->seq) {
 		/* our last seen message is gone, return error and reset */
-		user->seq = prb_first_seq(prb);
+		user->seq = r->info->seq;
 		ret = -EPIPE;
 		logbuf_unlock_irq();
 		goto out;


Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ