Unable to compile proprietary kernel driver under ARM64 Ubuntu 14.04

Bug #1348442 reported by Chuck Tuffli
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Medium
Unassigned

Bug Description

Compiling a kernel driver with a proprietary license (i.e. MODULE_LICENSE("Proprietary")) for ARM64 under Ubuntu 14.04 results in the following link error:

# make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64 -C /home/ctuffli/dev/ubuntu-trusty/debian/build/build-generic/ M=`pwd` modules
make: Entering directory `/home/ctuffli/dev/ubuntu-trusty/debian/build/build-generic'
  CC [M] /home/ctuffli/dev/ocs/test/test.o
In file included from /home/ctuffli/dev/ubuntu-trusty/include/linux/printk.h:5:0,
                 from /home/ctuffli/dev/ubuntu-trusty/include/linux/kernel.h:13,
                 from /home/ctuffli/dev/ubuntu-trusty/include/linux/sched.h:15,
                 from /home/ctuffli/dev/ubuntu-trusty/arch/arm64/include/asm/compat.h:25,
                 from /home/ctuffli/dev/ubuntu-trusty/arch/arm64/include/asm/stat.h:23,
                 from /home/ctuffli/dev/ubuntu-trusty/include/linux/stat.h:5,
                 from /home/ctuffli/dev/ubuntu-trusty/include/linux/module.h:10,
                 from /home/ctuffli/dev/ocs/test/test.c:1:
/home/ctuffli/dev/ocs/test/test.c: In function ‘__inittest’:
/home/ctuffli/dev/ubuntu-trusty/include/linux/init.h:297:4: warning: return from incompatible pointer type [enabled by default]
  { return initfn; } \
    ^
/home/ctuffli/dev/ocs/test/test.c:34:1: note: in expansion of macro ‘module_init’
 module_init(test_init);
 ^
  Building modules, stage 2.
  MODPOST 1 modules
FATAL: modpost: GPL-incompatible module test.ko uses GPL-only symbol 'xen_dma_ops'
make[3]: *** [__modpost] Error 1
make[2]: *** [modules] Error 2
make[1]: *** [sub-make] Error 2
make: *** [all] Error 2
make: Leaving directory `/home/ctuffli/dev/ubuntu-trusty/debian/build/build-generic'

It appears that including <linux/dma-mapping.h> is enough to trigger this problem
# nm -gl test.o | grep xen_start_info
                 U xen_start_info /home/ctuffli/dev/ubuntu-trusty/arch/arm64/include/asm/dma-mapping.h:42

Test case attached
---
AlsaDevices: Error: command ['ls', '-l', '/dev/snd/'] failed with exit code 2: ls: cannot access /dev/snd/: No such file or directory
AplayDevices: Error: [Errno 2] No such file or directory
ApportVersion: 2.14.1-0ubuntu3.2
Architecture: arm64
ArecordDevices: Error: [Errno 2] No such file or directory
CRDA: Error: [Errno 2] No such file or directory
CurrentDmesg: [ 15.365073] xgene-enet 17020000.ethernet eth0: eth0: link up 1000 Mbps
DistroRelease: Ubuntu 14.04
HibernationDevice: RESUME=UUID=88388f89-d798-4675-9542-27cacae45a9d
IwConfig: Error: [Errno 2] No such file or directory
Lsusb: Error: command ['lsusb'] failed with exit code 1: unable to initialize libusb: -99
Package: linux (not installed)
PciMultimedia:

ProcEnviron:
 TERM=screen
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcFB:

ProcKernelCmdLine: console=ttyS0,115200n8 ro
ProcVersionSignature: Ubuntu 3.13.0-32.57-generic 3.13.11.4
RelatedPackageVersions:
 linux-restricted-modules-3.13.0-32-generic N/A
 linux-backports-modules-3.13.0-32-generic N/A
 linux-firmware 1.127.4
RfKill: Error: [Errno 2] No such file or directory
Tags: trusty
Uname: Linux 3.13.0-32-generic aarch64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups:

_MarkForUpload: True

Revision history for this message
Chuck Tuffli (ctuffli) wrote :
tags: added: apport-collected trusty
description: updated
Revision history for this message
Chuck Tuffli (ctuffli) wrote : AudioDevicesInUse.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : BootDmesg.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : Lspci.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : ProcModules.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : UdevDb.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : UdevLog.txt

apport information

Revision history for this message
Chuck Tuffli (ctuffli) wrote : WifiSyslog.txt

apport information

Revision history for this message
Brad Figg (brad-figg) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Changed in linux (Ubuntu):
importance: Undecided → Medium
tags: added: kernel-key
Revision history for this message
Andy Whitcroft (apw) wrote :

You are not permitted to link to GPL only symbols if your module is not GPL, the error there is telling you you are trying to do exactly that:

    FATAL: modpost: GPL-incompatible module test.ko uses GPL-only symbol 'xen_dma_ops'

Either one has to work with the upstream contributor to relax that symbol to EXPORT_SYMBOL, or you need to find an alternative.

If you do not expect your device to encounter systems running on XEN you could likely short circut this by defining xen_dma_ops as NULL. before you include that header:

    #define xen_dma_ops NULL

Though if you do that you should also check for xen_initial_domain() in your init (if you can call that) and abort if true.

That said, it seems rather unfortuanate that those ops being _GPL renders he whole DMA infratructure useless. It is worth approaching whoever committed that and asking for that symbol to be relaxed.

Revision history for this message
Andy Whitcroft (apw) wrote :

The dependencies on xen_dma_ops were introduced in the commit below:

  commit c7e9bc548325f19635e7ac7cd5f3ec587228952e
  Author: Stefano Stabellini <email address hidden>
  Date: Fri Oct 18 16:01:26 2013 +0000

    arm/xen: get_dma_ops: return xen_dma_ops if we are running as xen_initial_domain

and the ops themselves in:

  commit 83862ccfc0a03212fde43b4ac29c28381828768b
  Author: Stefano Stabellini <email address hidden>
  Date: Thu Oct 10 13:40:44 2013 +0000

    xen/arm,arm64: enable SWIOTLB_XEN

So at least it seems to be the same person here.

tags: removed: kernel-key
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.