Skip to content

fix(deepin-os-release): Filter out RDRAND hardware random warnings to ensure clean output#560

Open
gitee-zeqi wants to merge 1 commit intolinuxdeepin:masterfrom
gitee-zeqi:master
Open

fix(deepin-os-release): Filter out RDRAND hardware random warnings to ensure clean output#560
gitee-zeqi wants to merge 1 commit intolinuxdeepin:masterfrom
gitee-zeqi:master

Conversation

@gitee-zeqi
Copy link
Copy Markdown

在某些平台,CPU 的硬件随机数指令 RDRAND 持续返回异常值。这导致某些第三方加密库在动态库初始化阶段检测到失败,并向 stderr 输出固定的 WARNING 文本:

WARNING: CPU random generator seem to be failing, disabling hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff

这样会影响到一些项目的cmake编译,如下:

# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.3

# compile CXX with /usr/bin/c++
CXX_DEFINES = -DDEEPIN_DDE -DDSG_DATA_DIR=\"/usr/share/dsg\" -DDSYSINFO_PREFIX=\"\" -DPREFIX=\"/usr\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_MESSAGELOGCONTEXT -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_X11EXTRAS_LIB -DQT_XML_LIB -DQ_HOST_NAME=\"x86_64\" -DQ_HOST_X86_64 -DQ_OS_DEEPIN_VERSION="\"WARNING: CPU random generator seem to be failing, disabling hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff
25\"" -DQ_OS_VERSION="\"WARNING: CPU random generator seem to be failing, disabling hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff
25.3.1\""

CXX_INCLUDES = -I/home/ocean/Desktop/gxde-top-panel-plugins/obj-x86_64-linux-gnu/frame -I/home/ocean/Desktop/gxde-top-panel-plugins/frame -I/home/ocean/Desktop/gxde-top-panel-plugins/obj-x86_64-linux-gnu/frame/dde-dock_autogen/include -I/usr/include/libdframeworkdbus-2.0 -I/usr/include/x86_64-linux-gnu/qt5/QtGui/5.15.15 -I/usr/include/x86_64-linux-gnu/qt5/QtGui/5.15.15/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore/5.15.15 -I/usr/include/x86_64-linux-gnu/qt5/QtCore/5.15.15/QtCore -I/home/ocean/Desktop/gxde-top-panel-plugins/obj-x86_64-linux-gnu -I/usr/include/x86_64-linux-gnu/qt5/QGSettings -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/libmount -I/usr/include/blkid -I/home/ocean/Desktop/gxde-top-panel-plugins/frame/../interfaces -isystem /usr/include/dtk5/DWidget -isystem /usr/include/dtk5/DGui -isystem /usr/include/dtk5/DCore -isystem /usr/include/dtk5/DLog -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtSvg -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -isystem /usr/include/x86_64-linux-gnu/qt5/QtPrintSupport -isystem /usr/include/x86_64-linux-gnu/qt5/QtXml -isystem /usr/include/x86_64-linux-gnu/qt5/QtConcurrent -isystem /usr/include/x86_64-linux-gnu/qt5/QtX11Extras

CXX_FLAGS = -g -Wall -Ofast -std=gnu++14   -DQ_OS_WARNING: CPU RANDOM GENERATOR SEEM TO BE FAILING, DISABLING HARDWARE RANDOM NUMBER GENERATION WARNING: RDRND GENERATED: 0XFFFFFFFF 0XFFFFFFFF 0XFFFFFFFF 0XFFFFFFFF GXDE -DQ_OS_DEEPIN_WARNING: CPU RANDOM GENERATOR SEEM TO BE FAILING, DISABLING HARDWARE RANDOM NUMBER GENERATION WARNING: RDRND GENERATED: 0XFFFFFFFF 0XFFFFFFFF 0XFFFFFFFF 0XFFFFFFFF COMMUNITY -fPIC

在终端的输出,修改前:

/usr/libexec/dtk5/DCore/bin/deepin-os-release --deepin-versionn-version
WARNING: CPU random generator seem to be failing, disabling hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffff
25ocean@ocean-hplaptop14sdk0xxx:~/Desktop/gxde-top-panel-plugins$

修改后:

ocean@ocean-hplaptop14sdk0xxx:~/Desktop/dtk5core$ /usr/libexec/dtk5/DCore/bin/deepin-os-release --deepin-version
25ocean@ocean-hplaptop14sdk0xxx:~/Desktop/dtk5core$

解决方法:
添加一个基于管道 + QThread 的 stderr 过滤器,过滤掉警告

… ensure clean output

This fix adds a pipe-based stderr filter using QThread, precisely discarding
the known RDRAND warning lines while preserving all other stderr messages.
@deepin-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gitee-zeqi

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link
Copy Markdown
Contributor

Hi @gitee-zeqi. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants