Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Feb 2014 21:32:16 GMT
From:      Michael Pounov <misho@elwix.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/187074: Crash cross compilation for MIPS
Message-ID:  <201402252132.s1PLWGJv047866@cgiserv.freebsd.org>
Resent-Message-ID: <201402252140.s1PLe0lk017539@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         187074
>Category:       kern
>Synopsis:       Crash cross compilation for MIPS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 25 21:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Michael Pounov
>Release:        FreeBSD 11 current
>Organization:
ELWIX
>Environment:
FreeBSD elwix.aitnet.org 11.0-CURRENT FreeBSD 11.0-CURRENT #4: Tue Feb 25 21:16:09 EET 2014     root@elwix.aitnet.org:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Cross compilation of kernel for MIPS architecture failed with this lines::

/home/fbsd_work.src/src/sys/netpfil/pf/pf_ioctl.c: In function 'pfioctl':
/home/fbsd_work.src/src/sys/netpfil/pf/pf_ioctl.c:1357: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/fbsd_work.src/src/sys/netpfil/pf/pf_ioctl.c:1359: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/home/fbsd_work.src/src/sys/netpfil/pf/pf_ioctl.c:1361: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

>How-To-Repeat:
Try to cross compilation of kernel for MIPS
>Fix:
Index: sys/netpfil/pf/pf_ioctl.c
===================================================================
--- sys/netpfil/pf/pf_ioctl.c	(revision 262482)
+++ sys/netpfil/pf/pf_ioctl.c	(working copy)
@@ -1353,12 +1353,12 @@
 		 * XXXGL: this is what happens when internal kernel
 		 * structures are used as ioctl API structures.
 		 */
-		pr->rule.states_cur =
-		    (counter_u64_t )counter_u64_fetch(rule->states_cur);
-		pr->rule.states_tot =
-		    (counter_u64_t )counter_u64_fetch(rule->states_tot);
-		pr->rule.src_nodes =
-		    (counter_u64_t )counter_u64_fetch(rule->src_nodes);
+		pr->rule.states_cur = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->states_cur);
+		pr->rule.states_tot = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->states_tot);
+		pr->rule.src_nodes = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->src_nodes);
 		if (pf_anchor_copyout(ruleset, rule, pr)) {
 			PF_RULES_WUNLOCK();
 			error = EBUSY;


Patch attached with submission follows:

Index: sys/netpfil/pf/pf_ioctl.c
===================================================================
--- sys/netpfil/pf/pf_ioctl.c	(revision 262482)
+++ sys/netpfil/pf/pf_ioctl.c	(working copy)
@@ -1353,12 +1353,12 @@
 		 * XXXGL: this is what happens when internal kernel
 		 * structures are used as ioctl API structures.
 		 */
-		pr->rule.states_cur =
-		    (counter_u64_t )counter_u64_fetch(rule->states_cur);
-		pr->rule.states_tot =
-		    (counter_u64_t )counter_u64_fetch(rule->states_tot);
-		pr->rule.src_nodes =
-		    (counter_u64_t )counter_u64_fetch(rule->src_nodes);
+		pr->rule.states_cur = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->states_cur);
+		pr->rule.states_tot = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->states_tot);
+		pr->rule.src_nodes = (counter_u64_t) (uintptr_t) 
+			counter_u64_fetch(rule->src_nodes);
 		if (pf_anchor_copyout(ruleset, rule, pr)) {
 			PF_RULES_WUNLOCK();
 			error = EBUSY;


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402252132.s1PLWGJv047866>