All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
       [not found] <200509042017.j84KHekQ032373@shell0.pdx.osdl.net>
@ 2005-09-04 20:23 ` Dave Jones
  2005-09-04 21:42   ` Andrew Morton
  2005-09-05  4:08   ` David S. Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Dave Jones @ 2005-09-04 20:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: hyoshiok, mm-commits

On Sun, Sep 04, 2005 at 01:16:00PM -0700, Andrew Morton wrote:
 >  unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n)
 >  {
 >  	BUG_ON((long) n < 0);

Ehh? It's unsigned. This will never be true.

 > +unsigned long
 > +__copy_from_user_ll_nocache(void *to, const void __user *from, unsigned long n)
 > +{
 > +	BUG_ON((long)n < 0);

Ditto.

		Dave


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

* Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
  2005-09-04 20:23 ` x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree Dave Jones
@ 2005-09-04 21:42   ` Andrew Morton
  2005-09-05  3:19     ` Hiro Yoshioka
  2005-09-05  4:15     ` David S. Miller
  2005-09-05  4:08   ` David S. Miller
  1 sibling, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2005-09-04 21:42 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel, hyoshiok, mm-commits

Dave Jones <davej@redhat.com> wrote:
>
> On Sun, Sep 04, 2005 at 01:16:00PM -0700, Andrew Morton wrote:
>   >  unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n)
>   >  {
>   >  	BUG_ON((long) n < 0);
> 
>  Ehh? It's unsigned. This will never be true.

It's cast to long, so it'll trap if we try to copy >=2G.

It seems a strange thing to check though.   Do we really need it?

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

* Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
  2005-09-04 21:42   ` Andrew Morton
@ 2005-09-05  3:19     ` Hiro Yoshioka
  2005-09-05  4:15     ` David S. Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Hiro Yoshioka @ 2005-09-05  3:19 UTC (permalink / raw)
  To: akpm; +Cc: davej, linux-kernel, mm-commits, hyoshiok

From: Andrew Morton <akpm@osdl.org>

> Dave Jones <davej@redhat.com> wrote:
> >
> > On Sun, Sep 04, 2005 at 01:16:00PM -0700, Andrew Morton wrote:
> >   >  unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n)
> >   >  {
> >   >  	BUG_ON((long) n < 0);
> > 
> >  Ehh? It's unsigned. This will never be true.
> 
> It's cast to long, so it'll trap if we try to copy >=2G.
> 
> It seems a strange thing to check though.   Do we really need it?

I don't know. I've just cut&paste the original __copy_from_user_ll()

Regards,
  Hiro

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

* Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
  2005-09-04 20:23 ` x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree Dave Jones
  2005-09-04 21:42   ` Andrew Morton
@ 2005-09-05  4:08   ` David S. Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-09-05  4:08 UTC (permalink / raw)
  To: davej; +Cc: linux-kernel, hyoshiok, mm-commits

From: Dave Jones <davej@redhat.com>
Subject: Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
Date: Sun, 4 Sep 2005 16:23:33 -0400

> On Sun, Sep 04, 2005 at 01:16:00PM -0700, Andrew Morton wrote:
>  >  unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n)
>  >  {
>  >  	BUG_ON((long) n < 0);
> 
> Ehh? It's unsigned. This will never be true.

It's to catch the user slipping in enormous lengths to
the user copy routines.

Sparc64 makes this check as well.  From U3memcpy.S:

	srlx		%o2, 31, %g2
	cmp		%g2, 0
	tne		%xcc, 5

%o2 is the length, we make sure the upper 33-bits are clear.

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

* Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
  2005-09-04 21:42   ` Andrew Morton
  2005-09-05  3:19     ` Hiro Yoshioka
@ 2005-09-05  4:15     ` David S. Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-09-05  4:15 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: davej, hyoshiok, mm-commits

From: Andrew Morton <akpm@osdl.org>
Date: Sun, 4 Sep 2005 14:42:18 -0700

> It seems a strange thing to check though.   Do we really need it?

Other platforms already do, it's a very good sanity check.

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

end of thread, other threads:[~2005-09-05  4:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200509042017.j84KHekQ032373@shell0.pdx.osdl.net>
2005-09-04 20:23 ` x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree Dave Jones
2005-09-04 21:42   ` Andrew Morton
2005-09-05  3:19     ` Hiro Yoshioka
2005-09-05  4:15     ` David S. Miller
2005-09-05  4:08   ` David S. Miller

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.