bcmwl 6.30.223.271+bdcom build fails with kernel 5.8.0-34/36 Ubuntu 20.04.1 LTS

Bug #1910618 reported by Paul Wilson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bcmwl (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Ubuntu 20.04.1 LTS
bcmwl-kernel-source_6.30.223.271

I believe the important part of the /var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/make.log is below.

/var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/src/wl/sys/wl_linux.c: In function ‘wl_reg_proc_entry’:
/var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/src/wl/sys/wl_linux.c:3376:58: error: passing argument 4 of ‘proc_create_data’ from incompatible pointe
r type [-Werror=incompatible-pointer-types]
 3376 | if ((wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_fops, wl)) == NULL) {
      | ^~~~~~~~
      | |
      | const struct file_operations *
In file included from /var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/src/wl/sys/wl_linux.c:38:
./include/linux/proc_fs.h:102:31: note: expected ‘const struct proc_ops *’ but argument is of type ‘const struct file_operations *’
  102 | extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
      | ^~~~~~~~~~~~~~~~

It looks like /var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/src/wl/sys/wl_linux.c uses the file_operations structure.

lines 3359-3381 from wl_linux.c

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
static const struct file_operations wl_fops = {
 .owner = THIS_MODULE,
 .read = wl_proc_read,
 .write = wl_proc_write,
};
#endif

static int
wl_reg_proc_entry(wl_info_t *wl)
{
 char tmp[32];
 sprintf(tmp, "%s%d", HYBRID_PROC, wl->pub->unit);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0)
 if ((wl->proc_entry = create_proc_entry(tmp, 0644, NULL)) == NULL) {
  WL_ERROR(("%s: create_proc_entry %s failed\n", __FUNCTION__, tmp));
#else
 if ((wl->proc_entry = proc_create_data(tmp, 0644, NULL, &wl_fops, wl)) == NULL) {
  WL_ERROR(("%s: proc_create_data %s failed\n", __FUNCTION__, tmp));
#endif
  ASSERT(0);
  return -1;
 }

However, it looks like proc_fs.h uses a different structure (proc_ops).

/usr/src/linux-headers-5.8.0-34-generic/include/linux/proc_fs.h
/usr/src/linux-hwe-5.8-headers-5.8.0-34/include/linux/proc_fs.h

kernel 5.8.0-34
proc_fs.h
lines 29-43

struct proc_ops {
 unsigned int proc_flags;
 int (*proc_open)(struct inode *, struct file *);
 ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *);
 ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *);
 loff_t (*proc_lseek)(struct file *, loff_t, int);
 int (*proc_release)(struct inode *, struct file *);
 __poll_t (*proc_poll)(struct file *, struct poll_table_struct *);
 long (*proc_ioctl)(struct file *, unsigned int, unsigned long);
#ifdef CONFIG_COMPAT
 long (*proc_compat_ioctl)(struct file *, unsigned int, unsigned long);
#endif
 int (*proc_mmap)(struct file *, struct vm_area_struct *);
 unsigned long (*proc_get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
} __randomize_layout;

and lines 102-107

extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
            struct proc_dir_entry *,
            const struct proc_ops *,
            void *);

struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);

Looking back at the linux 5.4.0-59 headers, proc_fs.h appears to use the file_operations structure.

/usr/src/linux-headers-5.4.0-59-generic/include/linux/proc_fs.h
/usr/src/linux-headers-5.4.0-59/include/linux/proc_fs.h

kernel 5.4.0-59
proc_fs.h
lines 44-49

extern struct proc_dir_entry *proc_create_data(const char *, umode_t,
            struct proc_dir_entry *,
            const struct file_operations *,
            void *);

struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct file_operations *proc_fops);

If this is where the problem lies, I am guessing it is better to try to fix the Broadcom package/ wl_linux.c than the Linux 5.8.0-34 headers?

The information above, was prompted by:

sudo apt-get install --reinstall bcmwl-kernel-source
...
Building initial module for 5.8.0-34-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/bcmwl-kernel-source.0.crash'
Error! Bad return status for module build on kernel: 5.8.0-34-generic (x86_64)
Consult /var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/make.log for more information.
dpkg: error processing package bcmwl-kernel-source (--configure):
 installed bcmwl-kernel-source package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 bcmwl-kernel-source
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Paul Wilson (paulwil) wrote :

From what I have been reading, it sounds like linux is converting to proc_ops.

From this, I am guessing lines 3360-3364 in wl_linux.c will need to changed from using the file_operations structure to the proc_ops structure.

I do realize this is easier said than done.

Paul Wilson (paulwil)
affects: broadcom-sta (Ubuntu) → bcmwl (Ubuntu)
Revision history for this message
Paul Wilson (paulwil) wrote :

Looking at the source code for the broadcom-sta package, which is working, I am wondering if

lines 3359-3381 from wl_linux.c in the bcmwl package

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
static const struct file_operations wl_fops = {
 .owner = THIS_MODULE,
 .read = wl_proc_read,
 .write = wl_proc_write,
};
#endif

should be updated to something similar to what is in the broadcom-sta package in order to convert to using proc_ops that is found in the new 5.8.0-34/36 headers.

lines 3359-3381 from wl_linux.c in the broadcom-sta package

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0)
static const struct proc_ops wl_fops = {
 .proc_read = wl_proc_read,
 .proc_write = wl_proc_write,
};
#else
static const struct file_operations wl_fops = {
 .owner = THIS_MODULE,
 .read = wl_proc_read,
 .write = wl_proc_write,
};
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) */
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */

Paul Wilson (paulwil)
summary: - bcmwl 6.30.223.271+bdcom build fails with kernel 5.8.0-34
+ bcmwl 6.30.223.271+bdcom build fails with kernel 5.8.0-34/36 Ubuntu
+ 20.04 LTS
Paul Wilson (paulwil)
summary: bcmwl 6.30.223.271+bdcom build fails with kernel 5.8.0-34/36 Ubuntu
- 20.04 LTS
+ 20.04.1 LTS
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bcmwl (Ubuntu):
status: New → Confirmed
Revision history for this message
ZdravkoG (zdravko-g) wrote :

Hi @paulwil,
Your bug seems duplicate of Bug #1910555. Take a look there for workaround till Canonical fix gets released. 😉 Just a obsolete function ioremap_nocache (and one more thing) together with delayed new release of bcmwl-kernel-source (who knows why), where new patch has added, dealing with the changes.
Hope this helps.

Revision history for this message
Paul Wilson (paulwil) wrote :

Hi @zdravko-g

Thank you for the update. I have temporarily removed bcmwl-kernel-source and have installed broadcom-sta until the new release comes out. WiFi is currently running.

It will be interesting to how the file_operations to proc_ops conversion is dealt with in the new release (wl_linux.c) or if I am chasing the wrong rabbit.

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.