Kernel panic during Decklink installation CentOS 7.3.1611

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

altug.simsek

  • Posts: 3
  • Joined: Wed Jan 04, 2017 12:18 pm

Kernel panic during Decklink installation CentOS 7.3.1611

PostWed Jan 04, 2017 12:29 pm

20170104_144120.jpg
Kernel panic screenshot
20170104_144120.jpg (336.44 KiB) Viewed 558 times
Kernel 4.9.0
Declink Linux Driver 10.8.4

Off-the-shelf RPM does not get installed.
Complains about get_user_pages() kernel function param change.

Therefore, modified get_user_pages() function according to 4.9.0.
get_user_pages( ... , write , 0 , .... )
becomes
get_user_pages( ... , write ? FOLL_WRITE : 0 , ... )
in files blackmagic_lib.c + bm_mm.c

Added the line
%undefine _missing_build_ids_terminate_build
to the SPEC file.

Built RPMs according to ReadMe.txt
During installation, kernel panic!

dkms status gives "installed" status for both blackmagic & blackmagic-io

Kernel panic screen image attached.
Any suggestions?

Altug
Offline

altug.simsek

  • Posts: 3
  • Joined: Wed Jan 04, 2017 12:18 pm

Re: Kernel panic during Decklink installation CentOS 7.3.161

PostWed Jan 11, 2017 10:52 am

Tried with kernel 4.8.13, failure again.

Configuration of

kernel-lt-4.4.39-1.el7.elrepo.x86_64
blackmagic driver 10.8.4
blackmagic sdk 10.8.3

seems to work.
Offline

max_verem

  • Posts: 8
  • Joined: Tue Nov 05, 2013 3:10 pm

Re: Kernel panic during Decklink installation CentOS 7.3.161

PostThu Jan 19, 2017 1:06 pm

I also have such problem on other platform:
Code: Select all
[root@dev-5 blackmagic-10.8.4a4]# uname -a
Linux dev-5 4.9.3-200.fc25.x86_64 #1 SMP Fri Jan 13 01:01:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Here is a kernel dump:
Code: Select all
[  957.489661] blackmagic: Loading driver (version: 10.8.4a4)
[  957.599902] blackmagic: Successfully loaded device "blackmagic!dv0" [pci@0000:02:00.0]
[  958.494178] usercopy: kernel memory overwrite attempt detected to ffffab7cc0d4bd38 (<process stack>) (16 bytes)
[  958.494508] ------------[ cut here ]------------
[  958.494682] kernel BUG at mm/usercopy.c:75!
[  958.494855] invalid opcode: 0000 [#2] SMP
[  958.495027] Modules linked in: blackmagic(POE) nf_conntrack_ipv4 nf_defrag_ipv4 binfmt_misc xt_conntrack nf_conntrack snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd soundcore coretemp iTCO_wdt iTCO_vendor_support gpio_ich kvm e1000e mei_wdt hp_wmi ppdev sparse_keymap rfkill irqbypass ptp fjes lpc_ich parport_pc shpchp pps_core mei_me acpi_cpufreq parport mei tpm_tis tpm_tis_core tpm xfs libcrc32c uas serio_raw usb_storage wmi ata_generic pata_acpi [last unloaded: blackmagic]
[  958.495039] CPU: 3 PID: 3741 Comm: BlackmagicPrefe Tainted: P      D   IOE   4.9.3-200.fc25.x86_64 #1
[  958.495039] Hardware name: Hewlett-Packard HP Compaq dc7900 Convertible Minitower/3032h, BIOS 786G1 v01.16 03/05/2009
[  958.495039] task: ffff98df8e79d880 task.stack: ffffab7cc0d48000
[  958.495039] RIP: 0010:[<ffffffffa6254c27>]  [<ffffffffa6254c27>] __check_object_size+0x77/0x1d6
[  958.495039] RSP: 0018:ffffab7cc0d4bca0  EFLAGS: 00010286
[  958.495039] RAX: 0000000000000063 RBX: ffffab7cc0d4bd38 RCX: 0000000000000000
[  958.495039] RDX: 0000000000000000 RSI: ffff98df97d8e0a8 RDI: ffff98df97d8e0a8
[  958.495039] RBP: ffffab7cc0d4bcc0 R08: 0000000000000000 R09: 0000000000000000
[  958.495039] R10: 0000000000000543 R11: 000000000000036c R12: 0000000000000010
[  958.495039] R13: 0000000000000000 R14: ffffab7cc0d4bd48 R15: 00007ffedb8fb450
[  958.495039] FS:  00007f4ebb0be740(0000) GS:ffff98df97d80000(0000) knlGS:0000000000000000
[  958.495039] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  958.495039] CR2: 00007f4eb9c03a50 CR3: 00000001fd449000 CR4: 00000000000406e0
[  958.495039] Stack:
[  958.495039]  ffffab7cc0d4bd38 0000000000000010 00007ffedb8fb450 ffff98df8521f700
[  958.495039]  ffffab7cc0d4bce8 ffffffffc051f19b ffffab7cc0d4bd38 0000000000010000
[  958.495039]  0000000000000000 00007ffedb8fb450 ffffffffc050179a ffffab7cc0d4bd18
[  958.495039] Call Trace:
[  958.495039]  [<ffffffffc051f19b>] __dl_copy_from_user+0x1b/0x40 [blackmagic]
[  958.495039]  [<ffffffffc050179a>] _ZN18IoctlMessageKernel6unpackEv+0x4a/0x160 [blackmagic]
[  958.495039]  [<ffffffffc04cc62b>] ? blackmagic_ioctl_private+0x35db/0x4080 [blackmagic]
[  958.495039]  [<ffffffffa6269cb1>] ? filename_lookup+0xf1/0x180
[  958.495039]  [<ffffffffa61c0dbc>] ? unlock_page+0x4c/0x60
[  958.495039]  [<ffffffffa61fd839>] ? handle_mm_fault+0xe49/0x1610
[  958.495039]  [<ffffffffc051e019>] ? blackmagic_ioctl+0x49/0x60 [blackmagic]
[  958.495039]  [<ffffffffa626db43>] ? do_vfs_ioctl+0xa3/0x5f0
[  958.495039]  [<ffffffffa6062836>] ? __do_page_fault+0x266/0x4e0
[  958.495039]  [<ffffffffa626e109>] ? SyS_ioctl+0x79/0x90
[  958.495039]  [<ffffffffa681bbf7>] ? entry_SYSCALL_64_fastpath+0x1a/0xa9
[  958.495039] Code: 48 0f 44 d1 48 c7 c6 16 9f c5 a6 48 c7 c1 83 df c4 a6 48 0f 44 f1 4d 89 e1 49 89 c0 48 89 d9 48 c7 c7 90 63 c5 a6 e8 b8 b1 f6 ff <0f> 0b e8 c2 a0 fb ff 85 c0 75 72 48 89 df e8 06 3c e1 ff 84 c0
[  958.495039] RIP  [<ffffffffa6254c27>] __check_object_size+0x77/0x1d6
[  958.495039]  RSP <ffffab7cc0d4bca0>
[  958.508452] ---[ end trace f68728a0d3053b55 ]---
compiling under 4.9 kernel version require one more changes:
Code: Select all
--- blackmagic_lib.c.origin     2016-11-16 06:16:31.000000000 +0200
+++ blackmagic_lib.c    2017-01-19 14:54:20.627187893 +0200
@@ -662,7 +662,12 @@
                write = 0;

        down_read(&current_task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+               if (current_task == current)
+                       ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+               else
+                       ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
                if (current_task == current)
                        ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
                else


when could we expect 10.8.5 version that fixing that problem?
Offline

max_verem

  • Posts: 8
  • Joined: Tue Nov 05, 2013 3:10 pm

Re: Kernel panic during Decklink installation CentOS 7.3.161

PostThu Mar 02, 2017 9:31 am

updated driver (10.8.5) fix Kernel panic, but still requires two patches to build under 4.9.12-200.fc25.x86_64

Code: Select all
--- blackmagic-io-10.8.5a4/bm_mm.c.origin       2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-io-10.8.5a4/bm_mm.c      2017-03-02 11:16:22.922824197 +0200
@@ -103,7 +103,12 @@
                return false;

        down_read(&task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+               if (current_task == current)
+                       ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+               else
+                       ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
                if (task == current)
                        ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write, 0, umem->pages, NULL);
                else


Code: Select all
--- blackmagic-10.8.5a4/blackmagic_lib.c.origin 2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-10.8.5a4/blackmagic_lib.c        2017-03-02 11:11:32.982009963 +0200
@@ -662,7 +662,12 @@
                write = 0;

        down_read(&current_task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+               if (current_task == current)
+                       ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+               else
+                       ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
                if (current_task == current)
                        ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
                else
Offline

altug.simsek

  • Posts: 3
  • Joined: Wed Jan 04, 2017 12:18 pm

Re: Kernel panic during Decklink installation CentOS 7.3.161

PostThu Mar 23, 2017 9:43 am

CentOS 7.3
Kernel 4.9.12
Blackmagic Driver 10.8.5
plus 2 modifications for get_user_pages()

Does this configuration work corrently?
Offline

max_verem

  • Posts: 8
  • Joined: Tue Nov 05, 2013 3:10 pm

Re: Kernel panic during Decklink installation CentOS 7.3.161

PostTue Mar 28, 2017 8:01 am

latest kernel version 4.10.5-200.fc25.x86_64 requires more (another) changes:

Code: Select all
--- blackmagic-10.8.5a4/blackmagic_lib.c.origin   2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-10.8.5a4/blackmagic_lib.c   2017-03-28 10:54:51.205782144 +0300
@@ -662,7 +662,16 @@
       write = 0;
    
    down_read(&current_task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+      if (current_task == current)
+         ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+      else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
+         ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL, NULL);
+#else
+         ret = get_user_pages_remote(current_task, current_task->mm, (unsigned long)ptr & PAGE_MASK, *nr_pages, write ? FOLL_WRITE : 0, pages, NULL);
+#endif
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
       if (current_task == current)
          ret = get_user_pages((unsigned long)ptr & PAGE_MASK, *nr_pages, write, 0, pages, NULL);
       else


Code: Select all
--- blackmagic-io-10.8.5a4/bm_mm.c.origin   2017-02-21 01:42:18.000000000 +0200
+++ blackmagic-io-10.8.5a4/bm_mm.c   2017-03-28 10:56:10.775912864 +0300
@@ -103,7 +103,16 @@
       return false;
 
    down_read(&task->mm->mmap_sem);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+      if (current_task == current)
+         ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+      else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)
+         ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL, NULL);
+#else
+         ret = get_user_pages_remote(task, task->mm, (unsigned long)address & PAGE_MASK, umem->length, write ? FOLL_WRITE : 0, umem->pages, NULL);
+#endif
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
       if (task == current)
          ret = get_user_pages((unsigned long)address & PAGE_MASK, umem->length, write, 0, umem->pages, NULL);
       else


see https://gist.github.com/max-verem/2421a ... 7b92033cc8

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 4 guests