From: Saji K. V. <saj...@wi...> - 2002-10-15 12:05:49
|
Hi Paul, I tested the bahaviour with Dynix/Ptx, found that it does not reset the hostname to NULL, it returns -1 as return value & 0 as errno rgds, Saji -----Original Message----- From: ltp...@li... [mailto:ltp...@li...]On Behalf Of Paul Larson Sent: Tuesday, October 15, 2002 9:11 AM To: Saji Kumar VR Cc: Paul Larson; sur...@wi...; ltp...@li... Subject: Re: [LTP] Problem with sethostname() ? Saji Kumar VR wrote: >Here, U can see that the "to" argument is zeroed if the "from" argument is >invalid, which is >the reason why hostname is set to NULL in our case. If U remove the memset, >it works fine. > Yes, but I really don't think going around modifying the behaviour of copy_from_user is the thing to do here. If you look at it, it's very intentional and the zeroing is done one way or another. >But I really don't know why do we need to have this memset at this place. >have any idea?? > I'm not up on my copy_*_user history, maybe someone else here can say for certain. I suspect it's for security reasons though. Memory passed to it for the "to" buffer is not known to be cleared already. So if we don't clear it, and don't overwrite all of it (or any of it), then there's a potential that it may contain previous data, maybe even data that could now be access by a process that shouldn't have been allowed to see it. In this case, we're probably fairly safe but I can think of many where we wouldn't be. >anyway I didn't try Ur patch, I will try it & get back to U. > That's ok, I tested it and it works for me, but I have a much simpler one at the office. There are a few things I want to check about it. I'll try to remember to send it to you tomorrow. I don't suppose maybe you've tested these system calls on other operating systems to see if they behave the same way as Linux or not? I'd be interested in knowing that. Thanks, Paul Larson ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Ltp-list mailing list Ltp...@li... https://lists.sourceforge.net/lists/listinfo/ltp-list |