Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.

2018-02-06 Thread John Nielsen
> On Feb 6, 2018, at 11:50 AM, Ian Lepore  wrote:
> 
> On Tue, 2018-02-06 at 11:33 -0700, John Nielsen wrote:
>> 
>> Apparently sending a NULL socket pointer to ifioctl hasn't worked
>> since this commit in 2011:
>> https://svnweb.freebsd.org/base?view=revision&revision=218757
>> 
>> So I'm going to add this patch to the port unconditionally once it
>> works.
>> 
>> Unfortunately, I can't compile the port with either my patch below or
>> your original replacement version of isboot_ifup(). :( Did you make
>> other changes? Here's the error I'm getting:
>> 
>> --- isboot.o ---
>> isboot.c:425:53: error: incomplete definition of type 'struct thread'
>> error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
>>   ~~^
>> /usr/src/sys/sys/systm.h:185:8: note: forward declaration of 'struct
>> thread'
>> struct thread;
>>^
>> 1 error generated.
>> 
> 
> Try adding #include  if it's not already in the list.  It
> may be that that file got included via pollution from some other header
> file in the past and maybe now that has changed.
> 
> If you're already including sys/proc.h then I'm clueless.

Thanks Ian, that appears to work.

Maurizio, can you apply the attached patch to a clean ports tree and see if 
isboot-kmod will build and function properly for you? This is all the changes 
from this thread and the previous one. If you let me know it works I'll get the 
port updated.

diff -uPr isboot-kmod.orig/Makefile isboot-kmod/Makefile
--- isboot-kmod.orig/Makefile   2018-01-11 07:18:01.0 -0700
+++ isboot-kmod/Makefile2018-02-06 14:56:23.654737000 -0700
@@ -2,7 +2,7 @@
 
 PORTNAME=  isboot-kmod
 PORTVERSION=   0.2.13
-PORTREVISION=  1
+PORTREVISION=  2
 CATEGORIES=net
 MASTER_SITES=  http://www.peach.ne.jp/archives/isboot/
 DISTNAME=  isboot-${PORTVERSION}
@@ -12,9 +12,7 @@
 
 LICENSE=   BSD2CLAUSE
 
-BROKEN_aarch64=fails to compile: 
/usr/src/sys/sys/bus.h:724:10: fatal error: 'device_if.h' file not found
 BROKEN_armv6=  fails to compile: implicit declaration of function 
'cp15_pmccntr_get' is invalid in C99
-BROKEN_armv7=  fails to compile: /usr/src/sys/sys/bus.h:724:10: fatal 
error: 'device_if.h' file not found
 BROKEN_powerpc64=  fails to compile: pcpu.h: size of array '__assert_0' is 
negative
 
 USES=  kmod uidfix
diff -uPr isboot-kmod.orig/files/patch-Makefile isboot-kmod/files/patch-Makefile
--- isboot-kmod.orig/files/patch-Makefile   1969-12-31 17:00:00.0 
-0700
+++ isboot-kmod/files/patch-Makefile2018-01-29 10:24:27.372206000 -0700
@@ -0,0 +1,10 @@
+--- Makefile.orig  2015-09-23 22:33:04.0 -0600
 Makefile   2018-01-29 10:20:10.453188000 -0700
+@@ -6,6 +6,7 @@
+ SRCS= isboot.c ibft.c iscsi.c
+ SRCS+=isboot.h ibft.h iscsi_compat.h
+ SRCS+=opt_cam.h
++SRCS+=device_if.h bus_if.h
+ #CFLAGS+= -DVIMAGE
+ #CFLAGS+= -DIBFT_VERBOSE
+ #CFLAGS+= -DDEBUG
diff -uPr isboot-kmod.orig/files/patch-isboot.c isboot-kmod/files/patch-isboot.c
--- isboot-kmod.orig/files/patch-isboot.c   2016-05-06 08:34:57.0 
-0600
+++ isboot-kmod/files/patch-isboot.c2018-02-06 14:24:47.447244000 -0700
@@ -1,6 +1,14 @@
 isboot.c.orig  2015-11-05 16:50:51 UTC
-+++ isboot.c
-@@ -347,9 +347,9 @@ isboot_set_v4gw(struct sockaddr_in *gate
+--- isboot.c.orig  2015-11-05 09:50:51.0 -0700
 isboot.c   2018-02-06 14:23:24.479249000 -0700
+@@ -38,6 +38,7 @@
+ #include 
+ #include 
+ #include 
++#include 
+ #include 
+ #include 
+ #include 
+@@ -347,9 +348,9 @@
netmask.sin_addr.s_addr = htonl(0);
  
/* delete gateway if exists */
@@ -12,7 +20,7 @@
if (error) {
if (error != ESRCH) {
printf("rtrequest RTM_DELETE error %d\n",
-@@ -359,9 +359,9 @@ isboot_set_v4gw(struct sockaddr_in *gate
+@@ -359,9 +360,9 @@
}
  
/* set new default gateway */
@@ -24,7 +32,7 @@
if (error) {
printf("rtrequest RTM_ADD error %d\n", error);
return (error);
-@@ -391,9 +391,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat
+@@ -391,9 +392,9 @@
memset(&netmask.sin6_addr, 0, 16);
  
/* delete gateway if exists */
@@ -36,7 +44,7 @@
if (error) {
if (error != ESRCH) {
printf("rtrequest RTM_DELETE error %d\n",
-@@ -403,9 +403,9 @@ isboot_set_v6gw(struct sockaddr_in6 *gat
+@@ -403,9 +404,9 @@
}
  
/* set new default gateway */
@@ -48,3 +56,42 @@
if (error) {
printf("rtrequest RTM_ADD error %d\n", error);
return (error);
+@@ -417,28 +418,36 @@
+ isboot_ifup(struct ifnet *ifp)
+ {
+   struct ifreq ifr;
++  struct socket *so;
+   struct thread *td;
+   int error;
+ 
+   memset(&ifr, 0, sizeof(ifr));
+   td = curthread;
+ 
++  error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
++  i

Panic on Boot - Current AMD64

2018-02-06 Thread Juan Ramón Molina Menor

I get panic on boot from current kernel.
Since last night - changes to vm system ?
World is Current as of this morning

FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r328948: Tue Feb  6 11:30:57 PST 2018
 root at pozo.com 
:/usr/src/sys/amd64/compile/pozo amd64

FreeBSD clang version 6.0.0 (branches/release_60 324090) (based on LLVM 6.0.0)
Table 'FACP' at 0xdfbc57e8
Table 'APIC' at 0xdfbc585c
Table 'ASF!' at 0xdfbc58e0
Table 'MCFG' at 0xdfbc5943
Table 'TCPA' at 0xdfbc597f
Table 'SLIC' at 0xdfbc59b1
Table 'HPET' at 0xdfbc5b27
ACPI: No SRAT table found
panic: UMA: Increase vm.boot_pages
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0x820bc820
vpanic() at vpanic+0x18d/frame 0x820bc880
panic() at panic+0x43/frame 0x820bc8e0
startup_alloc() at startup_alloc+0x19c/frame 0x820bc940
keg_alloc_slab() at keg_alloc_slab+0xef/frame 0x820bc9c0
keg_fetch_slab() at keg_fetch_slab+0x128/frame 0x820bca20
zone_fetch_slab() at zone_fetch_slab+0x69/frame 0x820bca50
zone_import() at zone_import+0x5a/frame 0x820bcaa0
zone_alloc_item() at zone_alloc_item+0x3b/frame 0x820bcae0
uma_startup() at uma_startup+0x3d3/frame 0x820bcbd0
vm_page_startup() at vm_page_startup+0x338/frame 0x820bcc20
vm_mem_init() at vm_mem_init+0x1d/frame 0x820bcc50
mi_startup() at mi_startup+0x118/frame 0x820bcc70
btext() at btext+0x2c
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at  kdb_enter+0x3b: movq$0,kdb_why
db> bt
Tracing pid 0 tid 0 td 0x80ff1240
kdb_enter() at kdb_enter+0x3b/frame 0x820bc820
vpanic() at vpanic+0x1aa/frame 0x820bc880
panic() at panic+0x43/frame 0x820bc8e0
startup_alloc() at startup_alloc+0x19c/frame 0x820bc940
keg_alloc_slab() at keg_alloc_slab+0xef/frame 0x820bc9c0
keg_fetch_slab() at keg_fetch_slab+0x128/frame 0x820bca20
zone_fetch_slab() at zone_fetch_slab+0x69/frame 0x820bca50
zone_import() at zone_import+0x5a/frame 0x820bcaa0
zone_alloc_item() at zone_alloc_item+0x3b/frame 0x820bcae0
uma_startup() at uma_startup+0x3d3/frame 0x820bcbd0
vm_page_startup() at vm_page_startup+0x338/frame 0x820bcc20
vm_mem_init() at vm_mem_init+0x1d/frame 0x820bcc50
mi_startup() at mi_startup+0x118/frame 0x820bcc70
btext() at btext+0x2c
db>



Same panic here with HEAD from this afternoon in a Lenovo ThinkPad S440 
with 4 GB.


Workaround: break into the loader prompt and:

set vm.boot_pages=120
boot

When booting kernel.old, vm.boot_pages is 64.

There is something wrong with r328916.

Hope it helps,
Juan


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Panic on Boot - Current AMD64

2018-02-06 Thread Manfred Antar
I get panic on boot from current kernel.
Since last night - changes to vm system ?
World is Current as of this morning

FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r328948: Tue Feb  6 11:30:57 PST 2018
r...@pozo.com:/usr/src/sys/amd64/compile/pozo amd64
FreeBSD clang version 6.0.0 (branches/release_60 324090) (based on LLVM 6.0.0)
Table 'FACP' at 0xdfbc57e8
Table 'APIC' at 0xdfbc585c
Table 'ASF!' at 0xdfbc58e0
Table 'MCFG' at 0xdfbc5943
Table 'TCPA' at 0xdfbc597f
Table 'SLIC' at 0xdfbc59b1
Table 'HPET' at 0xdfbc5b27
ACPI: No SRAT table found
panic: UMA: Increase vm.boot_pages
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0x820bc820
vpanic() at vpanic+0x18d/frame 0x820bc880
panic() at panic+0x43/frame 0x820bc8e0
startup_alloc() at startup_alloc+0x19c/frame 0x820bc940
keg_alloc_slab() at keg_alloc_slab+0xef/frame 0x820bc9c0
keg_fetch_slab() at keg_fetch_slab+0x128/frame 0x820bca20
zone_fetch_slab() at zone_fetch_slab+0x69/frame 0x820bca50
zone_import() at zone_import+0x5a/frame 0x820bcaa0
zone_alloc_item() at zone_alloc_item+0x3b/frame 0x820bcae0
uma_startup() at uma_startup+0x3d3/frame 0x820bcbd0
vm_page_startup() at vm_page_startup+0x338/frame 0x820bcc20
vm_mem_init() at vm_mem_init+0x1d/frame 0x820bcc50
mi_startup() at mi_startup+0x118/frame 0x820bcc70
btext() at btext+0x2c
KDB: enter: panic
[ thread pid 0 tid 0 ]
Stopped at  kdb_enter+0x3b: movq$0,kdb_why
db> bt
Tracing pid 0 tid 0 td 0x80ff1240
kdb_enter() at kdb_enter+0x3b/frame 0x820bc820
vpanic() at vpanic+0x1aa/frame 0x820bc880
panic() at panic+0x43/frame 0x820bc8e0
startup_alloc() at startup_alloc+0x19c/frame 0x820bc940
keg_alloc_slab() at keg_alloc_slab+0xef/frame 0x820bc9c0
keg_fetch_slab() at keg_fetch_slab+0x128/frame 0x820bca20
zone_fetch_slab() at zone_fetch_slab+0x69/frame 0x820bca50
zone_import() at zone_import+0x5a/frame 0x820bcaa0
zone_alloc_item() at zone_alloc_item+0x3b/frame 0x820bcae0
uma_startup() at uma_startup+0x3d3/frame 0x820bcbd0
vm_page_startup() at vm_page_startup+0x338/frame 0x820bcc20
vm_mem_init() at vm_mem_init+0x1d/frame 0x820bcc50
mi_startup() at mi_startup+0x118/frame 0x820bcc70
btext() at btext+0x2c
db> 

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.

2018-02-06 Thread Ian Lepore
On Tue, 2018-02-06 at 11:33 -0700, John Nielsen wrote:
> > 
> > On Feb 6, 2018, at 10:54 AM, John Nielsen 
> > wrote:
> > 
> > > 
> > > 
> > > On Feb 4, 2018, at 2:50 AM, Maurizio Vairani  > > com> wrote:
> > > 
> > > 2018-01-29 18:38 GMT+01:00 John Nielsen :
> > > [ resending from correct email address ]
> > > 
> > > > 
> > > > On Jan 29, 2018, at 6:05 AM, Maurizio Vairani  > > > il.com> wrote:
> > > > 
> > > > I am running
> > > > # uname
> > > > -a
> > > > 
> > > > FreeBSD  12.0-CURRENT FreeBSD 12.0-CURRENT #0 r328383: Thu Jan
> > > > 25 04:48:52
> > > > UTC 2018 r...@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd6
> > > > 4.amd64/sys/GENERIC
> > > > amd64
> > > > 
> > > > After compiling the kernel module as discussed in this thread :
> > > > https://lists.freebsd.org/pipermail/freebsd-current/2018-Januar
> > > > y/068272.html
> > > > 
> > > > I can boot FreeBSD via iSCSI using iPXE. But when the isboot,
> > > > the iSCSI
> > > > boot driver version 0.2.13, starts I receive a panic:
> > > > https://mega.nz/#!tkVwBBKA!PUj14-Za6KCNaoo9hxuXORRLQoWkb4LMvTdU
> > > > A1BorD4
> > > > 
> > > > Any idea?
> > > Bummer! 
> > > 
> > > Aoyama-san-
> > > 
> > > Are you still maintaining isboot? Can you help debug this issue
> > > on FreeBSD 12-CURRENT?
> > > 
> > > Once we get it working I will update the port with whatever is
> > > needed and send you the patches in case you'd like to cut a new
> > > release.
> > > 
> > > Thank you!
> > > 
> > > I have solved the issue changing the function isboot_ifup() in
> > > the source file isboot.c.
> > Here is a patch with some changes to minimize the diff. Except for
> > the printed error messages does that look functionally equivalent?
> > 
> > Now the question is why is this change needed and for what values
> > of __FreeBSD_version is it appropriate?
> Apparently sending a NULL socket pointer to ifioctl hasn't worked
> since this commit in 2011:
> https://svnweb.freebsd.org/base?view=revision&revision=218757
> 
> So I'm going to add this patch to the port unconditionally once it
> works.
> 
> Unfortunately, I can't compile the port with either my patch below or
> your original replacement version of isboot_ifup(). :( Did you make
> other changes? Here's the error I'm getting:
> 
> --- isboot.o ---
> isboot.c:425:53: error: incomplete definition of type 'struct thread'
> error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
>   ~~^
> /usr/src/sys/sys/systm.h:185:8: note: forward declaration of 'struct
> thread'
> struct thread;
>    ^
> 1 error generated.
> 

Try adding #include  if it's not already in the list.  It
may be that that file got included via pollution from some other header
file in the past and maybe now that has changed.

If you're already including sys/proc.h then I'm clueless.

-- Ian

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.

2018-02-06 Thread John Nielsen

> On Feb 6, 2018, at 10:54 AM, John Nielsen  wrote:
> 
>> 
>> On Feb 4, 2018, at 2:50 AM, Maurizio Vairani  wrote:
>> 
>> 2018-01-29 18:38 GMT+01:00 John Nielsen :
>> [ resending from correct email address ]
>> 
>>> On Jan 29, 2018, at 6:05 AM, Maurizio Vairani  
>>> wrote:
>>> 
>>> I am running
>>> # uname
>>> -a
>>> 
>>> FreeBSD  12.0-CURRENT FreeBSD 12.0-CURRENT #0 r328383: Thu Jan 25 04:48:52
>>> UTC 2018 
>>> r...@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
>>> amd64
>>> 
>>> After compiling the kernel module as discussed in this thread :
>>> https://lists.freebsd.org/pipermail/freebsd-current/2018-January/068272.html
>>> 
>>> I can boot FreeBSD via iSCSI using iPXE. But when the isboot, the iSCSI
>>> boot driver version 0.2.13, starts I receive a panic:
>>> https://mega.nz/#!tkVwBBKA!PUj14-Za6KCNaoo9hxuXORRLQoWkb4LMvTdUA1BorD4
>>> 
>>> Any idea?
>> 
>> Bummer! 
>> 
>> Aoyama-san-
>> 
>> Are you still maintaining isboot? Can you help debug this issue on FreeBSD 
>> 12-CURRENT?
>> 
>> Once we get it working I will update the port with whatever is needed and 
>> send you the patches in case you'd like to cut a new release.
>> 
>> Thank you!
>> 
>> I have solved the issue changing the function isboot_ifup() in the source 
>> file isboot.c.
> 
> Here is a patch with some changes to minimize the diff. Except for the 
> printed error messages does that look functionally equivalent?
> 
> Now the question is why is this change needed and for what values of 
> __FreeBSD_version is it appropriate?

Apparently sending a NULL socket pointer to ifioctl hasn't worked since this 
commit in 2011:
https://svnweb.freebsd.org/base?view=revision&revision=218757

So I'm going to add this patch to the port unconditionally once it works.

Unfortunately, I can't compile the port with either my patch below or your 
original replacement version of isboot_ifup(). :( Did you make other changes? 
Here's the error I'm getting:

--- isboot.o ---
isboot.c:425:53: error: incomplete definition of type 'struct thread'
error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
  ~~^
/usr/src/sys/sys/systm.h:185:8: note: forward declaration of 'struct thread'
struct thread;
   ^
1 error generated.


> # diff -u isboot.c.patched1 isboot.c
> --- isboot.c.patched1 2018-02-06 10:35:20.808692000 -0700
> +++ isboot.c  2018-02-06 10:50:05.347663000 -0700
> @@ -417,28 +417,36 @@
> isboot_ifup(struct ifnet *ifp)
> {
>   struct ifreq ifr;
> + struct socket *so;
>   struct thread *td;
>   int error;
> 
>   memset(&ifr, 0, sizeof(ifr));
>   td = curthread;
> 
> + error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
> + if (error) {
> + printf("%s: socreate, error=%d\n", __func__, error);
> + return (error);
> + }
> +
>   /* boot NIC */
>   strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
> 
>   /* set IFF_UP */
> - error = ifioctl(NULL, SIOCGIFFLAGS, (caddr_t)&ifr, td);
> + error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
>   if (error) {
>   printf("ifioctl SIOCGIFFLAGS\n");
>   return (error);
>   }
>   ifr.ifr_flags |= IFF_UP;
> - error = ifioctl(NULL, SIOCSIFFLAGS, (caddr_t)&ifr, td);
> + error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
>   if (error) {
>   printf("ifioctl SIOCSIFFLAGS\n");
>   return (error);
>   }
> 
> + soclose(so);
>   return (0);
> }
> 
> 
>> static int
>> isboot_ifup(struct ifnet *ifp)
>> {
>>struct socket *so;
>>struct ifreq ifr;
>>struct thread *td;
>>int error;
>> 
>>td = curthread;
>>error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
>>if (error) {
>>printf("%s: socreate, error=%d\n", __func__, error);
>>return (error);
>>}
>> 
>>/* boot NIC */
>>memset(&ifr, 0, sizeof(ifr));
>>strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
>> 
>>/* set IFF_UP */
>>error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
>>if (error) {
>>printf("%s: ifioctl SIOCGIFFLAGS, error=%d\n", __func__, error);
>>return (error);
>>}
>> 
>>ifr.ifr_flags |= IFF_UP;
>>error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
>>if (error) {
>>printf("%s, ifioctl SIOCSIFFLAGS, error=%d\n", __func__, error);
>>return (error);
>>}
>>soclose(so);
>>return (0);
>> }
>> 
>> I have added a socket in the ifioctl() call as in the 
>> /usr/src/sys/nfs/bootp_subr.c source.
>> Please let me know if you prefer a patch.
>> --
>> Regards,
>> Maurizio

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.

2018-02-06 Thread John Nielsen

> On Feb 4, 2018, at 2:50 AM, Maurizio Vairani  wrote:
> 
> 2018-01-29 18:38 GMT+01:00 John Nielsen :
> [ resending from correct email address ]
> 
>> On Jan 29, 2018, at 6:05 AM, Maurizio Vairani  wrote:
>> 
>> I am running
>> # uname
>> -a
>> 
>> FreeBSD  12.0-CURRENT FreeBSD 12.0-CURRENT #0 r328383: Thu Jan 25 04:48:52
>> UTC 2018 
>> r...@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
>> amd64
>> 
>> After compiling the kernel module as discussed in this thread :
>> https://lists.freebsd.org/pipermail/freebsd-current/2018-January/068272.html
>> 
>> I can boot FreeBSD via iSCSI using iPXE. But when the isboot, the iSCSI
>> boot driver version 0.2.13, starts I receive a panic:
>> https://mega.nz/#!tkVwBBKA!PUj14-Za6KCNaoo9hxuXORRLQoWkb4LMvTdUA1BorD4
>> 
>> Any idea?
> 
> Bummer! 
> 
> Aoyama-san-
> 
> Are you still maintaining isboot? Can you help debug this issue on FreeBSD 
> 12-CURRENT?
> 
> Once we get it working I will update the port with whatever is needed and 
> send you the patches in case you'd like to cut a new release.
> 
> Thank you!
> 
> I have solved the issue changing the function isboot_ifup() in the source 
> file isboot.c.

Here is a patch with some changes to minimize the diff. Except for the printed 
error messages does that look functionally equivalent?

Now the question is why is this change needed and for what values of 
__FreeBSD_version is it appropriate?

# diff -u isboot.c.patched1 isboot.c
--- isboot.c.patched1   2018-02-06 10:35:20.808692000 -0700
+++ isboot.c2018-02-06 10:50:05.347663000 -0700
@@ -417,28 +417,36 @@
 isboot_ifup(struct ifnet *ifp)
 {
struct ifreq ifr;
+   struct socket *so;
struct thread *td;
int error;
 
memset(&ifr, 0, sizeof(ifr));
td = curthread;
 
+   error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
+   if (error) {
+   printf("%s: socreate, error=%d\n", __func__, error);
+   return (error);
+   }
+
/* boot NIC */
strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
 
/* set IFF_UP */
-   error = ifioctl(NULL, SIOCGIFFLAGS, (caddr_t)&ifr, td);
+   error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
if (error) {
printf("ifioctl SIOCGIFFLAGS\n");
return (error);
}
ifr.ifr_flags |= IFF_UP;
-   error = ifioctl(NULL, SIOCSIFFLAGS, (caddr_t)&ifr, td);
+   error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
if (error) {
printf("ifioctl SIOCSIFFLAGS\n");
return (error);
}
 
+   soclose(so);
return (0);
 }


> static int
> isboot_ifup(struct ifnet *ifp)
> {
> struct socket *so;
> struct ifreq ifr;
> struct thread *td;
> int error;
> 
> td = curthread;
> error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
> if (error) {
> printf("%s: socreate, error=%d\n", __func__, error);
> return (error);
> }
> 
> /* boot NIC */
> memset(&ifr, 0, sizeof(ifr));
> strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
> 
> /* set IFF_UP */
> error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
> if (error) {
> printf("%s: ifioctl SIOCGIFFLAGS, error=%d\n", __func__, error);
> return (error);
> }
> 
> ifr.ifr_flags |= IFF_UP;
> error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
> if (error) {
> printf("%s, ifioctl SIOCSIFFLAGS, error=%d\n", __func__, error);
> return (error);
> }
> soclose(so);
> return (0);
> }
> 
> I have added a socket in the ifioctl() call as in the 
> /usr/src/sys/nfs/bootp_subr.c source.
> Please let me know if you prefer a patch.
> --
> Regards,
> Maurizio
> 

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Fatal trap 12 booting FreeBSD-CURRENT via isboot kernel module.

2018-02-06 Thread John Nielsen
> On Feb 4, 2018, at 2:50 AM, Maurizio Vairani  wrote:
> 
> 2018-01-29 18:38 GMT+01:00 John Nielsen :
> [ resending from correct email address ]
> 
>> On Jan 29, 2018, at 6:05 AM, Maurizio Vairani  wrote:
>> 
>> I am running
>> # uname
>> -a
>> 
>> FreeBSD  12.0-CURRENT FreeBSD 12.0-CURRENT #0 r328383: Thu Jan 25 04:48:52
>> UTC 2018 
>> r...@releng3.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC
>> amd64
>> 
>> After compiling the kernel module as discussed in this thread :
>> https://lists.freebsd.org/pipermail/freebsd-current/2018-January/068272.html
>> 
>> I can boot FreeBSD via iSCSI using iPXE. But when the isboot, the iSCSI
>> boot driver version 0.2.13, starts I receive a panic:
>> https://mega.nz/#!tkVwBBKA!PUj14-Za6KCNaoo9hxuXORRLQoWkb4LMvTdUA1BorD4
>> 
>> Any idea?
> 
> Bummer! 
> 
> Aoyama-san-
> 
> Are you still maintaining isboot? Can you help debug this issue on FreeBSD 
> 12-CURRENT?
> 
> Once we get it working I will update the port with whatever is needed and 
> send you the patches in case you'd like to cut a new release.
> 
> Thank you!
> 
> I have solved the issue changing the function isboot_ifup() in the source 
> file isboot.c.

Nice work, thank you! I'll put the below together with the necessary changes to 
iscsi.c and update the port. If you could re-install from the port at that 
point as a further test/sanity check that would be great.

> static int
> isboot_ifup(struct ifnet *ifp)
> {
> struct socket *so;
> struct ifreq ifr;
> struct thread *td;
> int error;
> 
> td = curthread;
> error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td);
> if (error) {
> printf("%s: socreate, error=%d\n", __func__, error);
> return (error);
> }
> 
> /* boot NIC */
> memset(&ifr, 0, sizeof(ifr));
> strlcpy(ifr.ifr_name, ifp->if_xname, sizeof(ifr.ifr_name));
> 
> /* set IFF_UP */
> error = ifioctl(so, SIOCGIFFLAGS, (caddr_t)&ifr, td);
> if (error) {
> printf("%s: ifioctl SIOCGIFFLAGS, error=%d\n", __func__, error);
> return (error);
> }
> 
> ifr.ifr_flags |= IFF_UP;
> error = ifioctl(so, SIOCSIFFLAGS, (caddr_t)&ifr, td);
> if (error) {
> printf("%s, ifioctl SIOCSIFFLAGS, error=%d\n", __func__, error);
> return (error);
> }
> soclose(so);
> return (0);
> }
> 
> I have added a socket in the ifioctl() call as in the 
> /usr/src/sys/nfs/bootp_subr.c source.
> Please let me know if you prefer a patch.
> --
> Regards,
> Maurizio

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"