Re: svn commit: r306186 - head/sys/kern

2016-11-21 Thread Adrian Chadd
Hi,

For reference - this breaks sooptcopyin() on MIPS32 BE. Undoing this
commit fixes things. :)

(it breaks ipfw. )



-adrian


On 22 September 2016 at 05:41, Ruslan Bukin  wrote:
> Author: br
> Date: Thu Sep 22 12:41:53 2016
> New Revision: 306186
> URL: https://svnweb.freebsd.org/changeset/base/306186
>
> Log:
>   Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
>
>   sooptcopyin() checks if size of data provided by user is <= than we can
>   accept, else it strips down the size. On bigendian platforms we have to
>   move pointer as well so we copy the actual data.
>
>   Reviewed by:  gnn
>   Sponsored by: DARPA, AFRL
>   Sponsored by: HEIF5
>   Differential Revision:https://reviews.freebsd.org/D7980
>
> Modified:
>   head/sys/kern/uipc_socket.c
>
> Modified: head/sys/kern/uipc_socket.c
> ==
> --- head/sys/kern/uipc_socket.c Thu Sep 22 12:08:26 2016(r306185)
> +++ head/sys/kern/uipc_socket.c Thu Sep 22 12:41:53 2016(r306186)
> @@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void *
>  */
> if ((valsize = sopt->sopt_valsize) < minlen)
> return EINVAL;
> -   if (valsize > len)
> +   if (valsize > len) {
> +#if _BYTE_ORDER == _BIG_ENDIAN
> +   sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + 
> (valsize - len));
> +#endif
> sopt->sopt_valsize = valsize = len;
> +   }
>
> if (sopt->sopt_td != NULL)
> return (copyin(sopt->sopt_val, buf, valsize));
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r306186 - head/sys/kern

2016-09-22 Thread Ruslan Bukin
Author: br
Date: Thu Sep 22 12:41:53 2016
New Revision: 306186
URL: https://svnweb.freebsd.org/changeset/base/306186

Log:
  Adjust the sopt_val pointer on bigendian systems (e.g. MIPS64EB).
  
  sooptcopyin() checks if size of data provided by user is <= than we can
  accept, else it strips down the size. On bigendian platforms we have to
  move pointer as well so we copy the actual data.
  
  Reviewed by:  gnn
  Sponsored by: DARPA, AFRL
  Sponsored by: HEIF5
  Differential Revision:https://reviews.freebsd.org/D7980

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==
--- head/sys/kern/uipc_socket.c Thu Sep 22 12:08:26 2016(r306185)
+++ head/sys/kern/uipc_socket.c Thu Sep 22 12:41:53 2016(r306186)
@@ -2455,8 +2455,12 @@ sooptcopyin(struct sockopt *sopt, void *
 */
if ((valsize = sopt->sopt_valsize) < minlen)
return EINVAL;
-   if (valsize > len)
+   if (valsize > len) {
+#if _BYTE_ORDER == _BIG_ENDIAN
+   sopt->sopt_val = (void *)((uintptr_t)sopt->sopt_val + (valsize 
- len));
+#endif
sopt->sopt_valsize = valsize = len;
+   }
 
if (sopt->sopt_td != NULL)
return (copyin(sopt->sopt_val, buf, valsize));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"