public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] m68k: fix find_next bitops
       [not found] <1301050810-11329-1-git-send-email-akinobu.mita@gmail.com>
@ 2011-03-30 18:02 ` Geert Uytterhoeven
  2011-03-30 20:09   ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2011-03-30 18:02 UTC (permalink / raw)
  To: Akinobu Mita, Andreas Schwab
  Cc: linux-kernel, akpm, Roman Zippel, linux-m68k, Michael Schmitz

On Fri, Mar 25, 2011 at 12:00, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> find_next bitops on m68k (find_next_zero_bit, find_next_bit, and
> find_next_bit_le) may cause out of bounds memory access
> when the bitmap size in bits % 32 != 0 and offset (the bitnumber
> to start searching at) is very close to the bitmap size.
>
> For example,
>
>       unsigned long bitmap[2] = { 0, 0 };
>       find_next_bit(bitmap, 63, 62);
>
> 1. find_next_bit() tries to find any set bits in bitmap[1],
>   but no bits set.
>
> 2. Then find_first_bit(bimap + 2, -1)
>
> 3. Unfortunately find_fist_bit() takes unsigned int as the size argument.
>
> 4. find_first_bit will access bitmap[2~] until it find any set bits.
>
> This switches find_next bitops to use generic implementation of
> find bitops to fix the problem.

Andreas, do you think it's worth keeping (and fixing) the m68k "optimized"
versions?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] m68k: fix find_next bitops
  2011-03-30 18:02 ` [PATCH] m68k: fix find_next bitops Geert Uytterhoeven
@ 2011-03-30 20:09   ` Andreas Schwab
  2011-03-31  6:02     ` Akinobu Mita
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2011-03-30 20:09 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Akinobu Mita, linux-kernel, akpm, Roman Zippel, linux-m68k,
	Michael Schmitz

Geert Uytterhoeven <geert@linux-m68k.org> writes:

> Andreas, do you think it's worth keeping (and fixing) the m68k "optimized"
> versions?

Should be easy to add the required offset >= size checks.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] m68k: fix find_next bitops
  2011-03-30 20:09   ` Andreas Schwab
@ 2011-03-31  6:02     ` Akinobu Mita
  2011-03-31  6:16       ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Akinobu Mita @ 2011-03-31  6:02 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Geert Uytterhoeven, linux-kernel, akpm, Roman Zippel, linux-m68k,
	Michael Schmitz

2011/3/31 Andreas Schwab <schwab@linux-m68k.org>:
> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>
>> Andreas, do you think it's worth keeping (and fixing) the m68k "optimized"
>> versions?
>
> Should be easy to add the required offset >= size checks.

OK, I'll try to fix the optimized version.
Or, could someone who can test on the real hardware fix this problem?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] m68k: fix find_next bitops
  2011-03-31  6:02     ` Akinobu Mita
@ 2011-03-31  6:16       ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2011-03-31  6:16 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: Andreas Schwab, linux-kernel, akpm, Roman Zippel, linux-m68k,
	Michael Schmitz

On Thu, Mar 31, 2011 at 08:02, Akinobu Mita <akinobu.mita@gmail.com> wrote:
> 2011/3/31 Andreas Schwab <schwab@linux-m68k.org>:
>> Geert Uytterhoeven <geert@linux-m68k.org> writes:
>>
>>> Andreas, do you think it's worth keeping (and fixing) the m68k "optimized"
>>> versions?
>>
>> Should be easy to add the required offset >= size checks.
>
> OK, I'll try to fix the optimized version.
> Or, could someone who can test on the real hardware fix this problem?

I'll have a look...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-31  6:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1301050810-11329-1-git-send-email-akinobu.mita@gmail.com>
2011-03-30 18:02 ` [PATCH] m68k: fix find_next bitops Geert Uytterhoeven
2011-03-30 20:09   ` Andreas Schwab
2011-03-31  6:02     ` Akinobu Mita
2011-03-31  6:16       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox