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

CP-49659: Test modinfo returning non-ASCII characters and fix the triggered error #112

Conversation

bernhardkaindl
Copy link
Collaborator

@bernhardkaindl bernhardkaindl commented May 23, 2024

Fix CP-49659:

  • Test modinfo returning non-ASCII characters and
  • fix the error triggered by it.

XS8: If these kernel modules are loaded, the bugtool file modinfo.out is broken:

bq2415x_charger bq2415x charger driver
cb710           ENE CB710 memory card reader driver
cb710-mmc       ENE CB710 memory card reader driver
cdc_mbim        USB CDC MBIM host driver              (for MBIM Mobile broadband modems)
dell-smm-hwmon  Dell laptop SMM BIOS hwmon driver     (for Dell Laptops)
gl520sm         GL520SM driver                        (I2C temperature/voltage Sensor)
i2c-via         i2c for Via vt82c586b southbridge     (Via Chipsets)
nf_dup_ipv4     nf_dup_ipv4: Duplicate IPv4 packet
nf_dup_ipv6     nf_dup_ipv6: IPv6 packet duplication
nft_socket      nf_tables socket match module
nft_tproxy      nf_tables tproxy support module
qmi_wwan        Qualcomm MSM Interface (QMI) WWAN driver
ums-isd200      Driver for In-System Design, Inc. ISD200 ASIC
via686a         VIA 686A Sensor device               (I2C temperature/voltage Sensor)
xt_TEE          Xtables: Reroute packet copy

That means it should only happen if the server uses one of the two I2C sensors or the cb710, or the customer sets up very specific network filtering rules manually in Dom0.

In these rare cases, the issue surfaces by the bugtool file modinfo.out having this content:

Traceback (most recent call last):
  File "./xen-bugtool", line 733, in collect_data
    s = no_unicode(v["func"](cap))
  File "./xen-bugtool", line 1640, in module_info
    return output.getvalue().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48009: ordinal not in range(128)

Reproduced by loading one of the kernel modules using:

modprobe cb710
xen-bugtool -y --entries=kernel-info

This command would gather data to diagnose the trigger in a specific case:

modinfo `cut -d' ' -f1 /proc/modules` >modinfo.out

Script to produce or confirm the list of kernel modules triggering this issue on such kernel:

find /usr/lib -name *.ko | sed -n 's|.*/||;s/.ko//p'|xargs modinfo >modinfo.out
for i in `grep -P '([^\x00-\x7F]|filename)' modinfo.out|grep -B1 -P '([^\x00-\x7F])'|sed -n 's|.*/||;s/.ko//p'|sort`;do printf %-16.16s $i;modinfo -d $i;done

@bernhardkaindl bernhardkaindl requested a review from ashwin9390 May 23, 2024 14:41
@bernhardkaindl bernhardkaindl force-pushed the CP-49659-fix-modinfo-unicode-error branch from 6c53787 to fafb784 Compare May 23, 2024 14:43
@coveralls
Copy link

Coverage Status

coverage: 93.042% (+0.007%) from 93.035%
when pulling fafb784 on xenserver-next:CP-49659-fix-modinfo-unicode-error
into c8aae6e on xenserver:master.

Copy link
Collaborator Author

@bernhardkaindl bernhardkaindl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The 1st commit updates the test for the failing function to be a strict XFAIL (ensuring the test reproduced the bug)

  • The 2nd commit fixes the XFAIL added in the 1st commit to ensure that the test and the fix match.

As both commits (also the XFAIL-ing test) pass CI (see the check for fafb784 above), this is the confirmation that this bug is fixed in this PR.

@bernhardkaindl bernhardkaindl merged commit 2bc9efe into xenserver:master May 23, 2024
3 checks passed
@bernhardkaindl bernhardkaindl removed the request for review from rosslagerwall May 23, 2024 16:40
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.

4 participants