Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for kernel 4.13 #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

genodeftest
Copy link

@genodeftest genodeftest commented Oct 2, 2017

Thanks to CONFIG_FORTIFY_SOURCE, the compiler refused to compile this buggy code.
See https://outflux.net/blog/archives/2017/09/05/security-things-in-linux-v4-13/
for details why this issue hasn't been noticed before kernel 4.13.

Fixes #81.

Note that #82 still should be fixed before running this driver on kernel 4.13.

Edit:
If you want to run this module on kernel 4.13, please check out my port-to-4.13 branch instead, which also includes fixes for kernel 4.12.

Thanks to CONFIG_FORTIFY_SOURCE, the compiler refused to compile this buggy code.
See https://outflux.net/blog/archives/2017/09/05/security-things-in-linux-v4-13/
for details why this issue hasn't been noticed before kernel 4.13.

Fixes jurobystricky#81.
@ageaenes
Copy link

ageaenes commented Oct 15, 2017

this does not work for me, i get further in the build progress but it halts here:

CC [M] /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.o /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.c:2385:25: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .change_virtual_intf = CFG80211_OpsVirtualInfChg, ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.c:2385:25: note: (near initialization for 'CFG80211_Ops.change_virtual_intf') /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.c:2386:22: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .add_virtual_intf = CFG80211_OpsVirtualInfAdd, ^~~~~~~~~~~~~~~~~~~~~~~~~ /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.c:2386:22: note: (near initialization for 'CFG80211_Ops.add_virtual_intf') cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:303: /home/henz/Projects/Netgear-A6210/os/linux/../../os/linux/cfg80211/cfg80211.o] Error 1 make[1]: *** [Makefile:1512: _module_/home/henz/Projects/Netgear-A6210/os/linux] Error 2 make[1]: Leaving directory '/usr/lib/modules/4.13.5-1-ARCH/build'

Edit: saw that you mentioned that you need fix #77 as well. Please referece this in your pull request.

@dsime42
Copy link

dsime42 commented Oct 30, 2017

Using I cloned it and applied #77 (I think)
Found the "&" in sta_ioctl.c and deleted itct 29 12:59:43 flamebai avahi-daemon[956]: Joining mDNS
Ignored the WARNING caused by CONFIG_FORTIFY_SOURCE
and installed it in FC26 (4.12.14-300.fc26.x86_64)
when FC26 updated to 4.13.5-200.fc26.x86_64 I had to remake/depmod but it worked there too.

I just updated to 4.13.9-200.fc26.x86_64 and while, after remake/depmod/reboot, the wlan0 appears but, it is never able to connect to my router (WNDR4000).

I booted to 4.13.5 and it is working again.

Cursory look at the log tells me nothing

@genodeftest
Copy link
Author

@dsime42

Found the "&" in sta_ioctl.c and deleted it

What do you mean? I don't understand. Can you please give me a line number?

Ignored the WARNING caused by CONFIG_FORTIFY_SOURCE

Same here, which warning do you mean? Can you please use the code blocks around logging output?

Your driver does not work in 4.13.9, but it works fine in 4.13.5? Are there any warnings during compilation (except the one about __builtin_memmove() called with a null argument from Netgear-A6210/os/linux/../../common/cmm_wpa.c:29:? Please run make clean before compiling again to make sure everything gets recompiled.

Cursory look at the log tells me nothing

Have you tried looking at dmesg output?

@dsime42
Copy link

dsime42 commented Nov 1, 2017

First, I was mistaken about wlan0 being available on 13.9.
It isn't there.
I must have been looking at vnet0 and seeing what I wanted to see.
:-(
Onward
Here is dmesg from a 13.9 boot. It looks as if wlan0 is not even attempted.

[ 11.583595] f71882fg f71882fg.1280: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info(). [ 13.144851] ip6_tables: (C) 2000-2006 Netfilter Core Team [ 13.248091] Ebtables v2.0 registered [ 13.307358] nf_conntrack version 0.5.0 (65536 buckets, 262144 max) [ 13.379130] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready [ 13.438462] r8169 0000:02:00.0 enp2s0: link down [ 13.438485] r8169 0000:02:00.0 enp2s0: link down [ 13.438613] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready [ 13.456627] tun: Universal TUN/TAP device driver, 1.6 [ 13.475904] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 13.475976] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 13.476785] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 13.499855] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. [ 13.536363] Netfilter messages via NETLINK v0.30. [ 13.543281] ip_set: protocol 6 [ 16.091651] r8169 0000:02:00.0 enp2s0: link up [ 16.091673] IPv6: ADDRCONF(NETDEV_CHANGE): enp2s0: link becomes ready [ 16.338999] NFSD: starting 90-second grace period (net ffffffff96fde380) [ 17.376717] virbr1: port 1(virbr1-nic) entered blocking state [ 17.376719] virbr1: port 1(virbr1-nic) entered disabled state [ 17.380276] device virbr1-nic entered promiscuous mode [ 17.467130] virbr1: port 1(virbr1-nic) entered blocking state [ 17.467133] virbr1: port 1(virbr1-nic) entered listening state [ 17.560758] virbr1: port 1(virbr1-nic) entered disabled state [ 17.607318] Loading iSCSI transport class v2.0-870. [ 33.388248] fuse init (API version 7.26) [ 39.090728] cdrom: sr0: mrw address space DMA selected [ 44.563130] logitech-hidpp-device 0003:046D:4051.0006: HID++ 4.5 device connected.

@dsime42
Copy link

dsime42 commented Nov 1, 2017

Here is a dmesg, scrap, from a working boot 13.5
Way too big for a code block

dmesg_work_5.txt

@dsime42
Copy link

dsime42 commented Nov 1, 2017

Oddly enough,
Last night the adapter stopped working on 13.5
I booted and rebuilt and re-depmoded. Nothing.
Then I removed the adapter and reinserted it
It migrated from Bus 002 Device 005 to Bus 002 Device 006
and was automatically reinitialized.
Seems like a reboot would have done this but I guess it needed a power-on reset of the adapter.

Here is a dmesg, scrap, from a failed boot 13.5
It fails at loading the patch
fail_5.txt [ 11.931905] f71882fg f71882fg.1280: hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info(). [ 13.454284] ip6_tables: (C) 2000-2006 Netfilter Core Team [ 13.553260] Ebtables v2.0 registered [ 13.616846] nf_conntrack version 0.5.0 (65536 buckets, 262144 max) [ 13.684780] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready [ 13.745452] r8169 0000:02:00.0 enp2s0: link down [ 13.745646] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready [ 13.754470] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready [ 13.755230] -->RTUSBVendorReset [ 13.775352] <--RTUSBVendorReset [ 15.843481] andes_usb_load_rom_patch: upload fw timeout [ 15.843488] ERROR mt766u_sta: [ 15.843492] load patch failed, Status[=0x00000001] [ 15.847863] receive cmd msg fail(-2) [ 15.847904] tx_kickout_fail_count = 0 [ 15.847906] tx_timeout_fail_count = 0 [ 15.847908] rx_receive_fail_count = 0 [ 15.847909] alloc_cmd_msg = 1 [ 15.847910] free_cmd_msg = 1 [ 15.847912] !!! rt28xx init fail !!! [ 15.865194] tun: Universal TUN/TAP device driver, 1.6 [ 15.910463] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this. [ 15.919605] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 15.919709] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 15.921530] IPv6: ADDRCONF(NETDEV_UP): vnet0: link is not ready [ 15.930059] -->RTUSBVendorReset [ 15.935891] Netfilter messages via NETLINK v0.30. [ 15.941861] ip_set: protocol 6 [ 15.950189] <--RTUSBVendorReset [ 17.955564] andes_usb_load_rom_patch: upload fw timeout [ 17.955570] ERROR mt766u_sta: [ 17.955570] ERROR mt766u_sta: [ 17.955574] load patch failed, Status[=0x00000001] [ 17.959958] receive cmd msg fail(-2) [ 17.959999] tx_kickout_fail_count = 0 [ 17.960001] tx_timeout_fail_count = 0 [ 17.960002] rx_receive_fail_count = 0 [ 17.960004] alloc_cmd_msg = 1 [ 17.960005] free_cmd_msg = 1 [ 17.960008] !!! rt28xx init fail !!! [ 17.961923] -->RTUSBVendorReset [ 17.982062] <--RTUSBVendorReset [ 20.003673] andes_usb_load_rom_patch: upload fw timeout [ 20.003678] ERROR mt766u_sta: [ 20.003682] load patch failed, Status[=0x00000001] [ 20.008059] receive cmd msg fail(-2) [ 20.008103] tx_kickout_fail_count = 0 [ 20.008105] tx_timeout_fail_count = 0 [ 20.008106] rx_receive_fail_count = 0 [ 20.008108] alloc_cmd_msg = 1 [ 20.008109] free_cmd_msg = 1 [ 20.008111] !!! rt28xx init fail !!!

@dsime42
Copy link

dsime42 commented Nov 1, 2017

Sorry about the code segments
All of the EOLs disappear
I seem to be missing a step in the posting process.

@genodeftest
Copy link
Author

@dsime42 : Can you please open a separate bug report? Thanks!

Btw: EOLs don't disappear if you are using the triple ```.

And it would be easier to read if you didn't abbreviate 4.13.9 to 13.9 etc.

@dsime42
Copy link

dsime42 commented Nov 2, 2017 via email

@dsime42
Copy link

dsime42 commented Nov 2, 2017

@genodeftest
I will pull a new up-to-date copy and see if the problem persist

@mattgodbolt
Copy link

I'm building OK on 4.13.0 with the memcpy fix, plus a fix to the signature of add and change flags. Happy to share my patch and/or submit a fresh PR if anyone has any problems building still.

@genodeftest
Copy link
Author

@mattgodbolt : I'm interested in your patch, preferably onto my port-to-4.13 branch.

Btw: Are you interested in creating a GitHub "organisation" for this driver and managing future development?

@abdujaparov
Copy link

Hi,
after ubuntu kernel update to 4.13.0-38-generic I am not able to use the adapter. I executed make clean and after that I tried to install again driver with make and make install.
During make I found only this warning:

/home/angelo/Scaricati/net/port4.13_new/Netgear-A6210-port-to-4.13/os/linux/../../common/cmm_wpa.c: In function ‘ConstructEapolMsg.constprop’:
./include/linux/string.h:324:9: warning: argument 2 null where non-null expected [-Wnonnull]
  return __builtin_memmove(p, q, size);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I found an issue opened in this project but I do not understand how to solve.
After the installation I restarted network service but no network adapter is started.
In /var/log/syslog I found:

Apr 11 00:20:50 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398850.7114] manager: startup complete
Apr 11 00:20:50 angelo-to-ubuntu systemd[1]: Started Network Manager Wait Online.
Apr 11 00:20:55 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398855.7117] manager: rfkill: WiFi hardware radio set enabled
Apr 11 00:20:55 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398855.7118] manager: rfkill: WWAN hardware radio set enabled

and no other information
dmesg shows:

Apr 11 00:20:50 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398850.7114] manager: startup complete
Apr 11 00:20:50 angelo-to-ubuntu systemd[1]: Started Network Manager Wait Online.
Apr 11 00:20:55 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398855.7117] manager: rfkill: WiFi hardware radio set enabled
Apr 11 00:20:55 angelo-to-ubuntu NetworkManager[3753]: <info>  [1523398855.7118] manager: rfkill: 
```WWAN hardware radio set enabled
No other information are provided.
After unplug and plug again the adapted dmesg shows:

[ 527.228301] usb 4-5: new SuperSpeed USB device number 6 using xhci_hcd
[ 527.249121] usb 4-5: New USB device found, idVendor=0846, idProduct=9053
[ 527.249124] usb 4-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 527.249125] usb 4-5: Product: A6210
[ 527.249127] usb 4-5: Manufacturer: NETGEAR
[ 527.249128] usb 4-5: SerialNumber: 100
[ 527.319072] rtusb init rt2870 --->
[ 527.319198]
=== pAd = ffffb11148b94000, size = 1251480 ===

[ 527.319199] driver version: 3.0.0.1 (Apr 11 2018 00:19:48) .
[ 527.320057] ==>rlt_wlan_chip_onoff(): OnOff:1, Reset= 1, pAd->WlanFunCtrl:0x0, Reg-WlanFunCtrl=0x20a
[ 527.327013] RtmpChipOpsEepromHook::e2p_type=0, inf_Type=2
[ 527.327014] RtmpEepromGetDefault::e2p_dafault=1
[ 527.327182] NVM is EFUSE mode
[ 527.327182] Endpoint(8) is for In-band Command
[ 527.327183] Endpoint(4) is for WMM0 AC0
[ 527.327183] Endpoint(5) is for WMM0 AC1
[ 527.327184] Endpoint(6) is for WMM0 AC2
[ 527.327184] Endpoint(7) is for WMM0 AC3
[ 527.327184] Endpoint(9) is for WMM1 AC0
[ 527.327185] Endpoint(84) is for Data-In
[ 527.327185] Endpoint(85) is for Command Rsp
[ 527.327287] 80211> CurTxPower = 20 dBm
[ 527.327288] ====> Radar Channel 52
[ 527.327288] ====> Radar Channel 54
[ 527.327289] ====> Radar Channel 56
[ 527.327289] ====> Radar Channel 60
[ 527.327289] ====> Radar Channel 62
[ 527.327290] ====> Radar Channel 64
[ 527.327290] ====> Radar Channel 100
[ 527.327290] ====> Radar Channel 104
[ 527.327291] 80211> TxStream = 0
[ 527.330318] usbcore: registered new interface driver rt2870
[ 527.339898] show_signal_msg: 9 callbacks suppressed
[ 527.339900] ModemManager[720]: segfault at 0 ip 000055fc00bb5c37 sp 00007ffc735bc160 error 4 in ModemManager[55fc00b7e000+121000]


what must I do?

Thanks.

@dsime42
Copy link

dsime42 commented Apr 12, 2018

@abdujaparov
Sorry no help here. That warning you see about the null argument doesn't seem to bother my machine. It comes up every time I recompile.
One problem I did encounter was shooting myself in the foot, by tring to compile the driver for my new kernel while booted under the old one. Just a brain-* I wanted to have a working driver while I recompiled, to check for any errors on the net, but
I needed to be in the directory and booted under the OS I was building for or,
the Makefile wouldn't operate properly. Duh, I felt very foolish.

It is interesting that it was your modem manager that segfaulted. Did you look for that error on the net?
I am currently using
https://github.com/kaduke/Netgear-A6210/tree/port-to-4.15
and while it seems to forget it has a connection sometimes and it even failed to initalize without replugging the USB once, ... ... it seems to be working well enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

problem with 4.13 linux
6 participants