All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] RTnet fixes - testers needed
@ 2017-12-06 17:37 Philippe Gerum
  2017-12-15 10:46 ` Leopold Palomo-Avellaneda
  0 siblings, 1 reply; 27+ messages in thread
From: Philippe Gerum @ 2017-12-06 17:37 UTC (permalink / raw)
  To: Xenomai


I pushed a pile of RTnet fixes in a WIP branch of the official repo
(wip/rtnet-fixes). Most of them address invalid direct references to
user memory from kernel space (instead of properly copying back and
forth via the copy_from/to_user interface), which are badly wrong at any
rate, even breaking the kernel on SMAP-enabled x86 platforms.

Most I/O calls were affected, ioctl, sendmsg and recvmsg. I'm still in
the early process of testing the changes gradually, which involves
running tests for all socket levels (RAW, DGRAM) and protocols (INET,
PACKET) enabled.

If you depend on RTnet and want to help with testing, you may want to
give this branch a try. Any help with reviewing the changes would be
beneficial to the project too.

Thanks,

-- 
Philippe.


^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [Xenomai] RTnet fixes - testers needed
@ 2017-12-16 23:01 Andreas Glatz
  2017-12-17 14:25 ` Philippe Gerum
  0 siblings, 1 reply; 27+ messages in thread
From: Andreas Glatz @ 2017-12-16 23:01 UTC (permalink / raw)
  To: xenomai

>
> I pushed a pile of RTnet fixes in a WIP branch of the official repo
> (wip/rtnet-fixes). Most of them address invalid direct references to
> user memory from kernel space (instead of properly copying back and
> forth via the copy_from/to_user interface), which are badly wrong at any
> rate, even breaking the kernel on SMAP-enabled x86 platforms.
>
> Most I/O calls were affected, ioctl, sendmsg and recvmsg. I'm still in
> the early process of testing the changes gradually, which involves
> running tests for all socket levels (RAW, DGRAM) and protocols (INET,
> PACKET) enabled.
>
> If you depend on RTnet and want to help with testing, you may want to
> give this branch a try. Any help with reviewing the changes would be
> beneficial to the project too.
>

I merged the most recent ipipe version for the 4.9.y kernel into
4.9.69 and patched it with xenomai 3 from the WIP branch (see snip1
below). The kernel boots on the Wandboard with an imx.6 quad. I then
can load the rtnet modules including the rt_fec.ko driver for the FEC
MAC on the imx.6 SoC (see snip2 below) and rtping works. I compiled
and started a udp server [1] that I know works on a similar setup with
the 4.1.y kernel. However, I still see a page domain fault (see snip3
below). That seems to happen somewhere early on in the rt_udp_bind()
function.... I'm currently compiling the 4.9 kernel with debug symbols
to see where it exactly happens. I'll continue looking into it
tomorrow...

A.





[1] http://www.binarytides.com/programming-udp-sockets-c-linux/

<snip1>
debian@arm:~$ cat /proc/version
Linux version 4.9.69-armv7-x6 (agl@TheMint) (gcc version 6.4.1
20171012 (Linaro GCC 6.4-2017.11) ) #5 SMP Sat Dec 16 20:05:17 GMT
2017
debian@arm:~$ cat /proc/xenomai/version
3.0.6
debian@arm:~$ cat /proc/rtnet/version
RTnet for Xenomai v3.0.6
RTcap:      yes
rtnetproxy: yes
bug checks: no
</snip1>

<snip2>
debian@arm:~$ lsmod
Module                  Size  Used by
rt_fec                 16499  1
rtpacket                9149  0
rtudp                  14691  2
rtipv4                 41477  1 rtudp
rt_loopback             1825  1
rtnet                  57796  5 rtipv4,rt_loopback,rtpacket,rt_fec,rtudp
...
</snip2>

<snip3>
root@arm:/home/debian# env LD_LIBRARY_PATH=/usr/xenomai/lib ./server
[ 3425.960029] Unhandled fault: page domain fault (0x01b) at 0xbef98c0a
[ 3425.966405] pgd = ebbbc000
[ 3425.969125] [bef98c0a] *pgd=8f8f1831
[ 3425.972739] Internal error: : 1b [#2] SMP ARM
[ 3425.977107] Modules linked in: rt_fec rtpacket rtudp rtipv4
rt_loopback rtnet caam_jr iptable_nat nf_conntrack_ipv4 ]
[ 3426.024101] CPU: 0 PID: 1822 Comm: server Tainted: G      D
4.9.69-armv7-x6 #5
[ 3426.032028] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[ 3426.038564] I-pipe domain: Linux
[ 3426.041803] task: ecf2e1c0 task.stack: eb330000
[ 3426.046366] PC is at rt_udp_bind+0x2c/0x38c [rtudp]
[ 3426.051268] LR is at rt_udp_ioctl+0xa4/0xb4 [rtudp]
[ 3426.056158] pc : [<bf4af3c0>]    lr : [<bf4afa24>]    psr: 200e0013
[ 3426.056158] sp : eb331e68  ip : bf4af3ac  fp : eb331ea4
[ 3426.067647] r10: bef98c08  r9 : ed4df824  r8 : 00000003
[ 3426.072882] r7 : 0000fef8  r6 : ed4df800  r5 : 40080022  r4 : c160418c
[ 3426.079419] r3 : eb331ea8  r2 : 00040945  r1 : bef98c08  r0 : ed4df824
[ 3426.085956] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[ 3426.093100] Control: 10c5387d  Table: 3bbbc04a  DAC: 00000051
[ 3426.098856] Process server (pid: 1822, stack limit = 0xeb330220)
[ 3426.104874] Stack: (0xeb331e68 to 0xeb332000)
[ 3426.109247] 1e60:                   00000000 00000051 ed4df800
c160418c 00000003 c160418c
[ 3426.117441] 1e80: 40080022 ed4df800 c160418c 00000003 40080022
c15159b4 eb331ecc eb331ea8
[ 3426.125632] 1ea0: bf4afa24 bf4af3a0 bef98c08 00040945 eb331fb0
ed4df800 c1517cf4 800e0013
[ 3426.133824] 1ec0: eb331f10 eb331ed0 c0299dd0 bf4af98c c027dedc
c01183a4 00000000 bef989c8
[ 3426.142015] 1ee0: eb331f18 00040945 eb331fb0 00000052 c160504c
f0936008 00000001 c029eb3c
[ 3426.150207] 1f00: c15159b4 eb331f2c eb331f20 c029eb54 c0299d2c
40080022 bef989c8 bef989c8
[ 3426.158398] 1f20: eb331f64 eb331f30 c02ac9a0 c029eb48 40080022
00000000 eb331fa4 eed959b4
[ 3426.166589] 1f40: 00000001 eed969b4 c160504c c1820600 c1820600
c15159b4 eb331fac eb331f68
[ 3426.174780] 1f60: c02236bc c02ac874 c15159b4 c1517cf4 c1820600
eb331fb0 c1820600 200e0013
[ 3426.182973] 1f80: b6f476e0 bef989c8 40080022 00000003 000f0042
c0109668 eb330000 00000002
[ 3426.191164] 1fa0: 00000000 eb331fb0 c01095b4 c02235b0 10000050
00000003 40080022 bef989c8
[ 3426.199355] 1fc0: bef989c8 40080022 00000003 000f0042 00000000
00000000 b6f70000 00000000
[ 3426.207545] 1fe0: b6f470dc bef989a8 00000000 b6f2ee72 000e0030
10000050 ffffffff ffffffff
[ 3426.215770] [<bf4af3c0>] (rt_udp_bind [rtudp]) from [<bf4afa24>]
(rt_udp_ioctl+0xa4/0xb4 [rtudp])
[ 3426.224681] [<bf4afa24>] (rt_udp_ioctl [rtudp]) from [<c0299dd0>]
(rtdm_fd_ioctl+0xb4/0x214)
[ 3426.233145] [<c0299dd0>] (rtdm_fd_ioctl) from [<c029eb54>]
(CoBaLt_ioctl+0x18/0x1c)
[ 3426.240823] [<c029eb54>] (CoBaLt_ioctl) from [<c02ac9a0>]
(ipipe_syscall_hook+0x138/0x370)
[ 3426.249109] [<c02ac9a0>] (ipipe_syscall_hook) from [<c02236bc>]
(__ipipe_notify_syscall+0x118/0x1dc)
[ 3426.258266] [<c02236bc>] (__ipipe_notify_syscall) from [<c01095b4>]
(pipeline_syscall+0x8/0x24)
[ 3426.266982] Code: e1a09000 e1a0a001 9a0000cc e30f7ef8 (e1d130b2)
[ 3426.273092] ---[ end trace 08b1f9b9e22886fc ]---
</snip3>


^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: [Xenomai] RTnet fixes - testers needed
@ 2017-12-19 10:17 Andreas Glatz
  2017-12-19 10:38 ` Philippe Gerum
                   ` (2 more replies)
  0 siblings, 3 replies; 27+ messages in thread
From: Andreas Glatz @ 2017-12-19 10:17 UTC (permalink / raw)
  To: xenomai, leo

>
> I have pulled wip/rtnet-fixes branch with the last commit of Philippe from Sun
> Dec 17 15:27:04 2017 +0100: net/udp: ioctl: fix temp arg buffer type
>
> I have created the packages and new kernel with the same configuration that I had.
>
> I run my application, that it's a POSIX application Wrapped and I still have the
> same error when I activate SMAP:

I see that the page fault occurs in rt_packet_ioctl()... by the looks
of this bug it might be similar to the one I found in udp.c (see my
post from Sunday)... basically the ioctl still tries to access user
memory, which causes that stack trace. I'm currently a bit busy - I
hope I can continue debugging this by the end of this week. In the
meantime could you recompile your kernel with debug info which should
improve the kernel bug output?

Cheers,

A.

>
> #######################################################3
>
> Dec 18 14:58:13 bmm3 kernel: [  118.545908] [Xenomai] switching slaveinfo_rt to
> secondary mode after exception #14 in kernel-space at 0xffffffffc0743981 (pid 1742)
> Dec 18 14:58:13 bmm3 kernel: [  118.545924] BUG: unable to handle kernel paging
> request at 00007ffcc7389470
> Dec 18 14:58:13 bmm3 kernel: [  118.546586] IP: [<ffffffffc0743981>]
> rt_packet_ioctl+0x1a1/0x380 [rtpacket]
> Dec 18 14:58:13 bmm3 kernel: [  118.547264] PGD 458a90067
> Dec 18 14:58:13 bmm3 kernel: [  118.547273] PUD 45a127067
> Dec 18 14:58:13 bmm3 kernel: [  118.547941] PMD 4584fe067
> Dec 18 14:58:13 bmm3 kernel: [  118.547946] PTE 8000000452fcb067
> Dec 18 14:58:13 bmm3 kernel: [  118.548626]
> Dec 18 14:58:13 bmm3 kernel: [  118.549302] Oops: 0001 [#1] SMP
> Dec 18 14:58:13 bmm3 kernel: [  118.549979] Modules linked in: rt_e1000e
> rt_loopback rtcfg rtudp rtipv4 rtmac rtpacket cdc_acm snd_hda_codec_hdmi
> snd_hda_codec_realtek snd_hda_codec_generic binfmt_misc intel_rapl
> x86_pkg_temp_thermal intel_powerclamp nls_ascii coretemp nls_cp437
> crct10dif_pclmul crc32_pclmul vfat ghash_clmulni_intel arc4 fat ppdev
> aesni_intel ath9k i915 aes_x86_64 ath9k_common lrw ath9k_hw gf128mul glue_helper
> pcan(O) ablk_helper ath cryptd mac80211 pcmcia pcmcia_core intel_cstate
> drm_kms_helper efi_pstore intel_uncore drm rtnet cfg80211 i2c_algo_bit
> fb_sys_fops intel_rapl_perf snd_hda_intel xeno_can_peak_pci syscopyarea
> sysfillrect iTCO_wdt xeno_can_sja1000 snd_hda_codec sysimgblt xeno_can
> iTCO_vendor_support sg snd_hda_core snd_hwdep mei_me snd_pcm snd_timer mei
> shpchp snd soundcore evdev pcspkr serio_raw efivars
> Dec 18 14:58:13 bmm3 kernel: [  118.554017]  battery hci_uart btbcm parport_pc
> btqca parport btintel bluetooth wmi video rfkill intel_lpss_acpi intel_lpss
> tpm_crb acpi_als kfifo_buf button industrialio sunrpc efivarfs ip_tables
> x_tables autofs4 ext4 crc16 jbd2 fscrypto mbcache sd_mod crc32c_intel i2c_i801
> i2c_smbus ahci libahci xhci_pci libata xhci_hcd scsi_mod usbcore fan i2c_hid hid
> fjes [last unloaded: rt_e1000e]
> Dec 18 14:58:13 bmm3 kernel: [  118.556765] CPU: 5 PID: 1742 Comm: slaveinfo_rt
> Tainted: G           O    4.9.51-xenomai-3.0.6-ipipe #1
> Dec 18 14:58:13 bmm3 kernel: [  118.557688] Hardware name: Gigabyte Technology
> Co., Ltd. To be filled by O.E.M./Q170M-D3H, BIOS F2 01/11/2016
> Dec 18 14:58:13 bmm3 kernel: [  118.558628] I-pipe domain: Linux
> Dec 18 14:58:13 bmm3 kernel: [  118.559567] task: ffff8d711868b140 task.stack:
> ffffa6a8409d4000
> Dec 18 14:58:13 bmm3 kernel: [  118.560518] RIP: 0010:[<ffffffffc0743981>]
> [<ffffffffc0743981>] rt_packet_ioctl+0x1a1/0x380 [rtpacket]
> Dec 18 14:58:13 bmm3 kernel: [  118.561505] RSP: 0018:ffffa6a8409d7df8  EFLAGS:
> 00010202
> Dec 18 14:58:13 bmm3 kernel: [  118.562483] RAX: ffffa6a8409d7df8 RBX:
> ffff8d7118f10800 RCX: 0000000000000000
> Dec 18 14:58:13 bmm3 kernel: [  118.563471] RDX: 0000000000000000 RSI:
> 00007ffcc7389410 RDI: ffffa6a8409d7e08
> Dec 18 14:58:13 bmm3 kernel: [  118.564472] RBP: ffffa6a8409d7ec0 R08:
> 26009bc300000014 R09: 000000000000005d
> Dec 18 14:58:13 bmm3 kernel: [  118.565473] R10: 00000000000000e4 R11:
> 00000000ffff4ebc R12: 0000000000000003
> Dec 18 14:58:13 bmm3 kernel: [  118.566477] R13: ffff8d7118f10940 R14:
> ffffa6a8402de040 R15: 00007ffcc7389470
> Dec 18 14:58:13 bmm3 kernel: [  118.567485] FS:  00007f4db6a00b80(0000)
> GS:ffff8d7120300000(0000) knlGS:0000000000000000
> Dec 18 14:58:13 bmm3 kernel: [  118.568516] CS:  0010 DS: 0000 ES: 0000 CR0:
> 000000008005003b
> Dec 18 14:58:13 bmm3 kernel: [  118.569560] CR2: 00007ffcc7389470 CR3:
> 000000045c362000 CR4: 00000000003406e0
> Dec 18 14:58:13 bmm3 kernel: [  118.570617] DR0: 0000000000000000 DR1:
> 0000000000000000 DR2: 0000000000000000
> Dec 18 14:58:13 bmm3 kernel: [  118.571671] DR3: 0000000000000000 DR6:
> 00000000fffe0ff0 DR7: 0000000000000400
> Dec 18 14:58:13 bmm3 kernel: [  118.572733] Stack:
> Dec 18 14:58:13 bmm3 kernel: [  118.573799]  00007ffcc7389470 26009bc300000014
> ffff8d7118f10800 ffffa6a8409d7ec0
> Dec 18 14:58:13 bmm3 kernel: [  118.574892]  0000000000000003 ffff8d711868b140
> ffffa6a8402de040 0000000000011ba0
> Dec 18 14:58:13 bmm3 kernel: [  118.575987]  ffffffff9476b9a8 00007ffcc7389400
> 401000221868b738 0000000000000010
> Dec 18 14:58:13 bmm3 kernel: [  118.577088] Call Trace:
> Dec 18 14:58:13 bmm3 kernel: [  118.578180]  [<ffffffff9476b9a8>] ?
> rtdm_fd_ioctl+0xa8/0x1e0
> Dec 18 14:58:13 bmm3 kernel: [  118.579278]  [<ffffffff94770b20>] ?
> CoBaLt_fcntl+0x10/0x10
> Dec 18 14:58:13 bmm3 kernel: [  118.580377]  [<ffffffff9468298d>] ?
> __ipipe_migrate_head+0x4d/0xb0
> Dec 18 14:58:13 bmm3 kernel: [  118.581452]  [<ffffffff94770b20>] ?
> CoBaLt_fcntl+0x10/0x10
> Dec 18 14:58:13 bmm3 kernel: [  118.582541]  [<ffffffff94770b2a>] ?
> CoBaLt_ioctl+0xa/0x10
> Dec 18 14:58:13 bmm3 kernel: [  118.583625]  [<ffffffff947807ac>] ?
> ipipe_syscall_hook+0xfc/0x2b0
> Dec 18 14:58:13 bmm3 kernel: [  118.584698]  [<ffffffff946fad9a>] ?
> __ipipe_notify_syscall+0xba/0x170
> Dec 18 14:58:13 bmm3 kernel: [  118.585774]  [<ffffffff94b868af>] ?
> pipeline_syscall+0x8/0x1b
> Dec 18 14:58:13 bmm3 kernel: [  118.586836] Code: 5f c3 b9 10 00 00 00 48 89 e6
> e8 7b 36 14 00 48 3d 00 f0 ff ff 77 d8 83 78 08 13 4c 8b 38 4c 8d ab 40 01 00 00
> 0f 86 73 01 00 00 <66> 41 83 3f 11 0f 85 68 01 00 00 41 0f b7 6f 02 66 85 ed 0f 84
> Dec 18 14:58:13 bmm3 kernel: [  118.589196] RIP  [<ffffffffc0743981>]
> rt_packet_ioctl+0x1a1/0x380 [rtpacket]
> Dec 18 14:58:13 bmm3 kernel: [  118.590308]  RSP <ffffa6a8409d7df8>
> Dec 18 14:58:13 bmm3 kernel: [  118.591414] CR2: 00007ffcc7389470
> Dec 18 14:58:13 bmm3 kernel: [  118.592528] ---[ end trace 7e353ae197f2ee95 ]---
>
> #######################################################3
>
> So, I'm sorry, but it still fails.
>
> And about the addr2line for this case, some help for dummies will be helpful.
>
> Leopold
>


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2017-12-22 16:25 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 17:37 [Xenomai] RTnet fixes - testers needed Philippe Gerum
2017-12-15 10:46 ` Leopold Palomo-Avellaneda
2017-12-15 11:04   ` Philippe Gerum
2017-12-15 12:25     ` Leopold Palomo-Avellaneda
2017-12-15 13:20       ` Jan Kiszka
2017-12-15 13:29         ` Philippe Gerum
2017-12-15 13:40           ` Jan Kiszka
2017-12-15 13:42             ` Leopold Palomo-Avellaneda
2017-12-15 13:48             ` Philippe Gerum
2017-12-15 20:42               ` Philippe Gerum
2017-12-18  6:33                 ` Jan Kiszka
2017-12-18 15:19                   ` Leopold Palomo-Avellaneda
2017-12-15 20:47       ` Philippe Gerum
2017-12-15 21:42         ` Leopold Palomo-Avellaneda
2017-12-16 23:01 Andreas Glatz
2017-12-17 14:25 ` Philippe Gerum
2017-12-18  0:22   ` Andreas Glatz
2017-12-19 10:17 Andreas Glatz
2017-12-19 10:38 ` Philippe Gerum
2017-12-19 10:46   ` Andreas Glatz
2017-12-19 11:01     ` Philippe Gerum
2017-12-20  9:00 ` Leopold Palomo-Avellaneda
2017-12-20  9:19   ` Andreas Glatz
2017-12-20 10:17 ` Philippe Gerum
2017-12-20 10:19   ` Philippe Gerum
2017-12-20 10:47     ` Philippe Gerum
2017-12-22 16:25       ` Leopold Palomo-Avellaneda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.