AdguardTeam / AdguardTeam/AdguardForWindows

SockFilter causes adb.exe to crash with "failed to read from fdevent interrupt fd"

Đang mở
#6,171 1 bình luận 0 reaction 1 người được giao Được @AlexandrPkhm nhận Xem trên GitHub
Bug Priority: P4
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
887
Fork
84
Merge trung bình
27 phút
Pull request đã merge (30 ngày)
2

Mô tả

### Please answer the following questions for yourself before submitting an issue

- [x] Filters were updated before reproducing an issue
- [x] I checked the [knowledge base](https://adguard.com/kb/) and found no answer
- [x] I checked to make sure that this issue has not already been filed

### AdGuard version

8.0.5560.0

### Browser version

N/A (not browser-related)

### OS version

Windows 11 25H2, OS Build 26200.9278

### Traffic filtering

- [x] yes, I do

### Ad Blocking

AdGuard Base filter, AdGuard Mobile Ads filter

### Privacy

AdGuard Tracking Protection filter, AdGuard URL Tracking filter

### Social

AdGuard Social Media filter

### Annoyances

AdGuard Cookie Notices filter, AdGuard Popups filter, AdGuard Mobile App Banners filter, AdGuard Other Annoyances filter, AdGuard Widgets filter, Adblock Warning Removal List

### Security

_No response_

### Other

Filter unblocking search ads and self-promotion

### Language-specific

AdGuard Chinese filter

### Which DNS server do you use?

Google DNS

### DNS protocol

DNS-over-HTTPS

### Custom DNS

_No response_

### What Stealth Mode options do you have enabled?

_No response_

### Support ticket ID

_No response_

### Issue Details

Steps to reproduce:

1. Configure AdGuard for Windows to use the SockFilter network driver.
2. Start Android Debug Bridge (ADB), for example:
`adb devices`
or
`adb nodaemon server`
3. ADB fails to start its server and terminates with:
`failed to read from fdevent interrupt fd: Resource temporarily unavailable`
4. Switch AdGuard's network driver from SockFilter to WFP.
5. Start ADB again.
6. ADB now works normally and `adb devices` successfully detects the connected Android device.

The issue is reproducible with:
- Android Platform-Tools 37.0.0-14910828
- Android Platform-Tools 37.0.1-15733141

I also tested Platform-Tools 37.0.1 with `ADB_USB_LEGACY=1`, but the issue still occurs when SockFilter is enabled.

TCP port 5037 was not occupied by another process, and there was no existing adb.exe process before starting the server.

### Expected Behavior

ADB should be able to start its server and operate normally while AdGuard's SockFilter driver is enabled.

`adb devices` should successfully communicate with the ADB server and detect connected Android devices.

### Actual Behavior

With SockFilter enabled, the ADB server terminates immediately.

Normal startup produces:

```text
* daemon not running; starting now at tcp:5037
could not read ok from ADB Server
* failed to start daemon
adb.exe: failed to check server version: cannot connect to daemon
````

Running ADB in foreground mode produces:

```text
F adb : fdevent_poll.cpp:55 failed to read from fdevent interrupt fd: Resource temporarily unavailable
```

With ADB tracing enabled:

```cmd
set "ADB_TRACE=fdevent sysdeps"
adb nodaemon server
```

the relevant trace is:

```text
D adb : sysdeps_win32.cpp:1132 port 0 type tcp => fd 2048
D adb : sysdeps_win32.cpp:1393 adb_socketpair: bound on port 13905
D adb : sysdeps_win32.cpp:1055 port 13905 type tcp => fd 2049
D adb : sysdeps_win32.cpp:1277 adb_socket_accept on fd 2048 returns fd 2050
D adb : sysdeps_win32.cpp:545 adb_close: 2048(lo-server:0)
D adb : fdevent_poll.cpp:83 fdevent_set: (fdevent 0: fd 2050 R), events = 1
D adb : sysdeps_win32.cpp:1132 port 5037 type tcp => fd 2048
D adb : fdevent_poll.cpp:113 --- --- waiting for events
D adb : fdevent_poll.cpp:135 poll(), pollfds = 2048() 2050(R)
D adb : fdevent_poll.cpp:187 (fdevent 0: fd 2050 R) got events 1
F adb : fdevent_poll.cpp:55 failed to read from fdevent interrupt fd: Resource temporarily unavailable
```

After switching AdGuard from SockFilter to WFP, this fatal error disappears and ADB works normally.

### Screenshots

_No response_

### Additional Information

### A/B test results

| Configuration | Result |
| -------------------------------------------- | ------------------------------------ |
| SockFilter + ADB 37.0.0 | Fails |
| SockFilter + ADB 37.0.1 | Fails |
| SockFilter + ADB 37.0.1 + `ADB_USB_LEGACY=1` | Fails |
| WFP + ADB 37.0.1 | Works |
| WFP + `adb devices` | Connected Android device is detected |

No relevant system configuration was changed between the failing SockFilter test and the successful WFP test other than switching the AdGuard network driver.

### Technical observation

ADB's Windows implementation creates an internal socket pair using TCP loopback.

With SockFilter enabled, ADB reports the internal socket as readable:

```text
(fdevent 0: fd 2050 R) got events 1
```

but the immediately following read fails with:

```text
Resource temporarily unavailable
```

ADB then terminates.

With the WFP driver enabled instead, the same fdevent/socket polling sequence continues normally without the fatal error.

This suggests a possible compatibility issue between SockFilter and ADB's internal loopback socket polling behavior. I cannot determine the exact cause inside SockFilter.

### Other network software installed

The system also has network components associated with VMware, SoftEther VPN, Surfshark/OpenVPN, and McAfee VPN.

However, these components were present in both tests. Switching only AdGuard from SockFilter to WFP was sufficient to make ADB work again.

### Workaround

Switching AdGuard's network driver from SockFilter to WFP resolves the issue.

[adb-trace.txt](https://github.com/user-attachments/files/31607612/adb-trace.txt)

[winsock.txt](https://github.com/user-attachments/files/31607613/winsock.txt)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.