From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199610180734.CAA09133@atheist.tamu.edu> Date: Fri, 18 Oct 1996 02:34:29 -0500 (CDT) From: Richard Henderson Subject: Re: Linux-2.1.4 In-Reply-To: > In fact, you do NOT want to zero-terminate the string, and in fact you may > not even want to return an error for this case. Your approach is the logical > one, especially when you look at "get_name()", but there are some other uses > for this function that make another return value a better choice. Agreed. This is changed in the bits I'll be sending you momentarily. > NOTE! I'm not sure that this is necessarily the right approach. For various > reasons it may be that for execve() we'd be better off with a > "strlen_from_user()" + "memcpy_from_user()", because we have to know the > length anyway before we know where to copy the string. I have no strong > opinion one way or the other on this, I just know that we definitely do not > want to do it one byte at a time. Especially not on an alpha. The real pain in the ass here is that the current code starts putting bits at the top of the page and works down. It is much more natural to start at the bottom of the page and work up. At first blush it seems like the thing to do is to copy the strings beginning from the beginning rather than the end and afterward either use memmove to shift the whole lot en masse to the top of the page (or allocate a temporary extra page and use memcpy). In this way we only have to examine the characters once in strncpy_from_user, though we still need to touch memory twice. Unfortunately, it seems as if the alternative to touching memory twice is wasting the balance of a page for every process. Given that most programs have a relatively small argv+envp, this is not happy making. r~ -- To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null