Skip to contentSkip to conversation

x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree

DISCUSSION Dave Jones 4 participants 5 messages Sep 4, 2005 – Sep 5, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Dave Jones

author
#1 lore raw
Quoted 3 lines · Andrew Morton

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.

Review

Quoted 4 lines
(quoted diff) +4 -0
+unsigned long
+__copy_from_user_ll_nocache(void *to, const void __user *from, unsigned long n)
+{
+	BUG_ON((long)n < 0);

Ditto.

Dave

#2 lore raw
Quoted 7 lines · Dave Jones
Quoted 3 lines · Andrew Morton

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?

#3 lore raw

From: Andrew Morton <[email protected]>

Quoted 7 lines
Quoted 6 lines · Dave Jones
Quoted 3 lines · Andrew Morton

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

Quoted 5 lines
Quoted 1 line

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

#5 lore raw
In reply to Dave Jones

From: Dave Jones <[email protected]>
Subject: Re: x86-cache-pollution-aware-__copy_from_user_ll.patch added to -mm tree
Date: Sun, 4 Sep 2005 16:23:33 -0400

Quoted 6 lines · Andrew Morton
Quoted 3 lines

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.