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>] [day] [month] [year] [list]
Message-ID: <2375c9f90702091756l4cddfc63r68b5a318457f13d8@mail.gmail.com>
Date:	Sat, 10 Feb 2007 09:56:24 +0800
From:	"Cong WANG" <xiyou.wangcong@...il.com>
To:	"Andrew Morton" <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kfifo: overflow of unsigned integer

2007/2/9, Andrew Morton <akpm@...ux-foundation.org>:
> On Thu, 8 Feb 2007 20:16:55 +0800 "Cong WANG" <xiyou.wangcong@...il.com> wrote:
>
> > 2007/2/8, Andrew Morton <akpm@...ux-foundation.org>:
> > > On Thu, 8 Feb 2007 17:07:28 +0800 "Cong WANG" <xiyou.wangcong@...il.com> wrote:
> > >
> > > > Kfifo is a ring-buffer in kernel which can be used as a lock-free way
> > > > for concurrent read/write when there are only one producer and one
> > > > consumer. Details of its design can be found in kernel/kfifo.c and
> > > > include/linux/kfifo.h.
> > > >
> > > > You will find that the 'in' and 'out' fields of 'struct kfifo' are
> > > > both represented as 'unsigned int' and in most cases 'in' is larger
> > > > than 'out' and their difference will NOT be  over 'size'.
> > > >
> > > > Now the problem is that 'in' will be *smaller* than 'out' when 'in'
> > > > overflows and 'out' doesn't (Yes, this may occur quietly.). This is
> > > > NOT what we expect, though it may not cause any serious problems if we
> > > > carefully use kfifo*() functions. And this is really a bug.
> > >
> > > You seem to be saying that it's not a bug, but it's a bug.
> > >
> > > Exactly what goes wrong?
> >
> > I wrote a module on my machine to test this bug. And when the overflow
> > occurs, I cann't put any data into the fifo even though it is not
> > full.
>
> Why did you remove the mailing list?  Please don't do that.

Sorry. I used the poor 'reply'.

>
> I can't find any bug.
>
> I converted the code so that it'll run in userspace:
>
> http://userweb.kernel.org/~akpm/kfifo.c
> http://userweb.kernel.org/~akpm/kfifo.h
>
> Please see if you can reproduce the problem with that setup and then let's
> see if we can understand what's going on, and fix it.
>
>

Thanks for your work. And you are right.

I think the OLD /proc API which I used in my module confused my eyes.
I got completely lost by that. OLD /proc API is very bad, isn't it?

BTW, can you tell me which way do you use to exchange information
between user-space and kernel-space when debugging the kernel?

Thanks again! And have a nice day!
-
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