This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH] - Fix wrong check in aux_syscalls.stp:_struct_sockaddr_u_impl (related to PR16718)
- From: David Smith <dsmith at redhat dot com>
- To: Robin Hack <rhack at redhat dot com>, systemtap at sourceware dot org
- Date: Tue, 18 Mar 2014 09:59:21 -0500
- Subject: Re: [PATCH] - Fix wrong check in aux_syscalls.stp:_struct_sockaddr_u_impl (related to PR16718)
- Authentication-results: sourceware.org; auth=none
- References: <20140318121516 dot GA5628 at bigoook dot brq dot redhat dot com>
On 03/18/2014 07:15 AM, Robin Hack wrote:
> Hi.
>
> This small patch according to PR16718 fixes wrong check of STAP_ARG_len argument.
I had thought of doing something like this, but figured the new
_stp_copy_from_user() check would work here. I didn't see any harm in
your patch though, so I checked it in.
I then thought about it some more. Your patch did this:
- size_t len = STAP_ARG_len < 128 ? STAP_ARG_len: 128;
+ size_t len = max(128, STAP_ARG_len);
Depending on when the conversion from signed to unsigned happens, -1 is
still less than 128. So, in commit 0a01aa9 I tightened that up to:
size_t len = clamp((size_t)STAP_ARG_len, (size_t)0, (size_t)128);
This way we're sure that the value is between 0 and 128. I also went
through the rest of the calls to _stp_copy_from_user(), making sure the
input length was reasonable.
Thanks for the patch.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)