I'm trying to run a windows app on Linux Mint 20.03.
Wine installed Mono to install the app since it uses .NET. When launching the app from the terminal, I've got all of these messages:
01a4:fixme:iphlpapi:NotifyAddrChange (Handle 000000000081F1E8, overlapped 0000019800034090): stub
01a4:fixme:win:GetPointerDevices (000000000081EB0C 0000000000000000): partial stub
01a4:fixme:system:QueryDisplayConfig (00000002 000000000081EB20 00000198047BFE20 000000000081EB10 00000198000BF100 0000000000000000): semi-stub
01a4:fixme:system:DisplayConfigGetDeviceInfo Unimplemented packet type: 11
01a4:fixme:win:GetPointerDevices (000000000081EB0C 0000000000000000): partial stub
01a4:fixme:system:QueryDisplayConfig (00000002 000000000081EB20 00000198047BFE20 000000000081EB10 00000198000BF100 0000000000000000): semi-stub
01a4:fixme:system:DisplayConfigGetDeviceInfo Unimplemented packet type: 11
01a4:fixme:win:GetPointerDevices (000000000081EB0C 0000000000000000): partial stub
01a4:fixme:system:QueryDisplayConfig (00000002 000000000081EB20 00000198047BFE20 000000000081EB10 00000198000BF100 0000000000000000): semi-stub
01a4:fixme:system:DisplayConfigGetDeviceInfo Unimplemented packet type: 11
021c:fixme:wtsapi:WTSRegisterSessionNotification Stub 0000000000020074 0x00000000
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497F0B0 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
01a4:fixme:service:I_ScRegisterDeviceNotification Notification filters are not yet implemented.
01a4:fixme:wtsapi:WTSRegisterSessionNotification Stub 0000000000030042 0x00000000
0228:fixme:sync:NtSetInformationJobObject stub: 0x32c 4 0xfcff028 4
0230:fixme:file:ReplaceFileW Ignoring flags 2
01a4:fixme:combase:RoGetActivationFactory (L"Windows.Devices.Enumeration.DeviceAccessInformation", {574bd3d3-5f30-45cd-8a94-724fe5973084}, 000000000081CB00): semi-stub
01a4:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Devices.Enumeration.DeviceAccessInformation"
01a4:fixme:combase:RoGetActivationFactory (L"Windows.Devices.Enumeration.DeviceAccessInformation", {574bd3d3-5f30-45cd-8a94-724fe5973084}, 000000000081CB00): semi-stub
01a4:err:combase:RoGetActivationFactory Failed to find library for L"Windows.Devices.Enumeration.DeviceAccessInformation"
01a4:fixme:system:EnableNonClientDpiScaling (0000000000030040): stub
01a4:fixme:win:RegisterTouchWindow (0000000000030040 00000002): stub
021c:fixme:wtsapi:WTSRegisterSessionNotification Stub 000000000002004E 0x00000000
01a4:fixme:dwmapi:DwmSetWindowAttribute (0000000000030040, 2, 000000000081C584, 4) stub
01a4:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 000000000081B94C, 0000000000000000 000000000081B948
01a4:fixme:nls:get_dummy_preferred_ui_language (0x38 000000000081B94C 0000000000000000 000000000081B948) returning a dummy value (current locale)
01a4:fixme:nls:RtlGetThreadPreferredUILanguages 00000038, 000000000081B94C, 000000000081B932 000000000081B948
01a4:fixme:nls:get_dummy_preferred_ui_language (0x38 000000000081B94C 000000000081B932 000000000081B948) returning a dummy value (current locale)
01a4:fixme:dwrite:dwritefontface5_HasVariations 0000000001775CE0: stub
01a4:fixme:win:RegisterPowerSettingNotification (000000000002004E,{2b84c20e-ad23-4ddf-93db-05ffbd7efca5},0): stub
0254:err:winediag:ntlm_check_version ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
0254:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
0254:fixme:powrprof:PowerRegisterSuspendResumeNotification (0x00000002,000000000081FCF0,000000000081FCE8) stub!
0254:fixme:heap:RtlSetHeapInformation 0000000000000000 1 0000000000000000 0 stub
0254:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 00000212002410B0, 16) stub
027c:fixme:winsock:WSALookupServiceBeginW (0000000006ACDBE0 0x00000ff0 0000000006ACDC58) Stub!
027c:fixme:iphlpapi:NotifyAddrChange (Handle 0000000006ACDDB8, overlapped 0000021200310B10): stub
027c:fixme:wlanapi:WlanEnumInterfaces (0000000000000001, 0000000000000000, 0000000006ACCD88) semi-stub
027c:fixme:wlanapi:WlanEnumInterfaces (0000000000000001, 0000000000000000, 0000000006ACCD88) semi-stub
01a4:fixme:shcore:GetCurrentProcessExplicitAppUserModelID 000000000081BC90: stub
0298:fixme:file:NtLockFile I/O completion on lock not implemented yet
0298:fixme:heap:PrefetchVirtualMemory process FFFFFFFFFFFFFFFF, count 0000000000000001, addresses 000000000A3CF400, flags 0 stub.
027c:fixme:winsock:setsockopt Ignoring SO_RANDOMIZE_PORT
01a4:fixme:win:RegisterTouchWindow (0000000000020070 00000002): stub
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497EC00 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
027c:fixme:wlanapi:WlanEnumInterfaces (0000000000000001, 0000000000000000, 0000000006ACCA88) semi-stub
02a8:err:winediag:ntlm_check_version ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
02a8:err:ntlm:ntlm_LsaApInitializePackage no NTLM support, expect problems
02a8:fixme:powrprof:PowerRegisterSuspendResumeNotification (0x00000002,000000000081FCF0,000000000081FCE8) stub!
02a8:fixme:heap:RtlSetHeapInformation 0000000000000000 1 0000000000000000 0 stub
02a8:fixme:ntdll:EtwEventSetInformation (deadbeef, 2, 000002B6002410B0, 16) stub
02a8:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
02a8:fixme:thread:QueryThreadCycleTime (FFFFFFFFFFFFFFFE,000000000081EB48): stub!
02f8:fixme:kernelbase:AppPolicyGetThreadInitializationType FFFFFFFFFFFFFFFA, 000000000D48FE10
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497EED0 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
027c:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497E480 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497E270 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
027c:fixme:winsock:setsockopt Ignoring SO_RANDOMIZE_PORT
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000019804CB30C0 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000019804B93260 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 000001980497EC60 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
02a8:fixme:dwrite:dwritefontface5_HasVariations 00000000016A40A0: stub
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000000000000000 len=0 000000000FCFEF2C),stub!
0228:fixme:winstation:GetUserObjectSecurity (0000000000000008 000000000FCFEF28 0000019804F197B0 len=40 000000000FCFEF2C),stub!
0228:fixme:ntdll:NtSetInformationToken TokenIntegrityLevel stub!
0228:fixme:ntdll:NtFilterToken flags 0x1 unsupported
0228:fixme:ntdll:NtFilterToken support for restricting sids not yet implemented
01f0:fixme:ntdll:NtQuerySystemInformation info_class SYSTEM_PERFORMANCE_INFORMATION
01dc:fixme:kernelbase:AppPolicyGetProcessTerminationMethod FFFFFFFFFFFFFFFA, 000000000081FD40
Am I missing something?
Related
I have not found any question that addresses an issue I face with a puppeteer script. The script runs fine and produces a screenshot, except that it crashes at the end in browser.close(). I reduced the script to its essence to reproduce the issue:
import puppeteer from 'puppeteer';
import { PendingXHR } from 'pending-xhr-puppeteer';
const puppeteerOptions = {
headless: true,
dumpio: true,
userDataDir: './user-data',
defaultViewport: null,
args: [
'--window-size=1200,800',
'--disable-notifications',
'--disable-geolocation',
'--disable-infobars',
'--disable-extensions',
'--disable-session-crashed-bubble',
'--disable-gpu',
'--disable-features=NetworkService',
'--disable-audio-output',
'--mute-audio',
'--silent-debugger-extension-api',
'--single-process',
'--disable-setuid-sandbox',
'--full-memory-crash-report',
'--unlimited-storage'
]
}
let url = process.argv[2];
if(!url) {
console.log('Specify URL');
process.exit(1);
}
const sleep = m => new Promise(r => setTimeout(r, m)); // sleep is a setTimeout that can be awaited
(async() => {
console.log('==> initialize headless browser');
const browser = await puppeteer.launch(puppeteerOptions);
const page = await browser.newPage();
const pendingXHR = new PendingXHR(page);
try {
console.log('==> load ' + url);
await page.setDefaultNavigationTimeout(0);
await page.goto(url, { waitUntil: 'networkidle0' }); // wait for page load
console.log('==> await page.setRequestInterception');
await page.setRequestInterception(true); // intercept requests, for next line
console.log('==> await pendingXHR.waitForAllXhrFinished');
await pendingXHR.waitForAllXhrFinished(); // wait for all requests to finish
console.log('==> generate screenshot');
await page.screenshot({ path: './screenshot.png', fullPage: true });
await sleep(2000);
} catch (error) {
console.log('==> Catch ERROR: ' + error.message);
}
console.log('==> page.close()');
await page.close();
await sleep(2000);
console.log('==> browser.close()');
await browser.close();
console.log('==> script end');
})();
Script output with Received signal 11 <unknown> 000000000000 crash:
-bash-4.2$ node demo https://www.google.com/
==> initialize headless browser
[0818/152036.508006:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
DevTools listening on ws://127.0.0.1:45180/devtools/browser/82b03d2a-eaba-44b0-b6f5-e571a8cbe093
==> load https://www.google.com/
==> await page.setRequestInterception
==> await pendingXHR.waitForAllXhrFinished
==> generate screenshot
==> page.close()
==> browser.close()
Received signal 11 <unknown> 000000000000
#0 0x5601f8f7c612 base::debug::CollectStackTrace()
#1 0x5601f8edb193 base::debug::StackTrace::StackTrace()
#2 0x5601f8f7c131 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f9371ffd5d0 (/usr/lib64/libpthread-2.17.so+0xf5cf)
#4 0x5601f8f366f4 base::SupportsUserData::GetUserData()
#5 0x5601f6c9ca0e content::RenderProcessHostImpl::UnregisterHost()
#6 0x5601f6c9c1f4 content::RenderProcessHostImpl::~RenderProcessHostImpl()
#7 0x5601f6c9ce2e content::RenderProcessHostImpl::~RenderProcessHostImpl()
#8 0x5601f6c9bfa8 content::RenderProcessHostImpl::ShutDownInProcessRenderer()
#9 0x5601f68ac5df content::BrowserMainLoop::ShutdownThreadsAndCleanUp()
#10 0x5601f68adead content::BrowserMainRunnerImpl::Shutdown()
#11 0x5601fe67a557 headless::HeadlessContentMainDelegate::RunProcess()
#12 0x5601f8a66942 content::RunBrowserProcessMain()
#13 0x5601f8a67ed9 content::ContentMainRunnerImpl::RunBrowser()
#14 0x5601f8a67a70 content::ContentMainRunnerImpl::Run()
#15 0x5601f8a64c54 content::RunContentProcess()
#16 0x5601f8a655e4 content::ContentMain()
#17 0x5601f8abf3ba headless::(anonymous namespace)::RunContentMain()
#18 0x5601f8abf0c5 headless::HeadlessShellMain()
#19 0x5601f52da1e3 ChromeMain
#20 0x7f936d8903d5 __libc_start_main
#21 0x5601f52da02a _start
r8: 00007ffefefdc440 r9: 0000000000000001 r10: 0000000000000002 r11: 00005601feeeb5a0
r12: 000004e80065d400 r13: 00005601fee60530 r14: 000004e80023cd08 r15: 000004e80065d400
di: 000004e80023cd18 si: 00005601f354dd90 bp: 00007ffefefdc470 bx: 000004e80035c700
dx: badbad00badbad08 ax: 000004e80023cd18 cx: badbad00badbad00 sp: 00007ffefefdc470
ip: 00005601f8f366f4 efl: 0000000000010206 cgf: 0000000000000033 erf: 0000000000000000
trp: 000000000000000d msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
==> script end
-bash-4.2$
I am using the chromium that npm installs with puppeteer.
Environment used:
-bash-4.2$ uname -a
Linux xxxxxxxx-02 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
-bash-4.2$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
-bash-4.2$ node --version
v14.20.0
-bash-4.2$ grep '"version"' /usr/lib/node_modules/puppeteer/package.json
"version": "16.1.1"
-bash-4.2$ grep '"version"' /usr/lib/node_modules/pending-xhr-puppeteer/package.json
"version": "2.3.3"
-bash-4.2$ ls /usr/lib/node_modules/puppeteer/.local-chromium/
linux-1022525
Any idea how to fix this crash?
UPDATE: I filed a bug report at https://github.com/puppeteer/puppeteer/issues/8818
UPDATE 2022-08-26: Related chromium bug: https://crbug.com/1356885
UPDATE 2022-09-26: Confirmed chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1356885
Same issue. appears to happen only on .close() and the rest of the process runs fine. there are some errors on launch but they dont seem to affect the output. I dont know whether to care about these up front errors or not but the stack dump on .close() definitely is not good! do you still think it is a chromium bug or related? I am still assuming it is my fault, just dont know how to fix any of this. input welcome! :)
[0926/160220.212118:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[0926/160220.271606:ERROR:angle_platform_impl.cc(43)] DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
ERR: DisplayVkXcb.cpp:59 (initialize): xcb_connect() failed, error 1
[0926/160220.271685:ERROR:angle_platform_impl.cc(43)] Display.cpp:992 (initialize): ANGLE Display::initialize error 12289: Not initialized.
ERR: Display.cpp:992 (initialize): ANGLE Display::initialize error 12289: Not initialized.
[0926/160220.271775:ERROR:gl_display.cc(506)] EGL Driver message (Critical) eglInitialize: Not initialized.
[0926/160220.271786:ERROR:gl_display.cc(879)] eglInitialize SwANGLE failed with error EGL_NOT_INITIALIZED
[0926/160220.271815:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[0926/160220.276601:ERROR:gpu_channel_manager.cc(839)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0926/160220.276638:ERROR:shared_image_stub.cc(489)] SharedImageStub: unable to create context
[0926/160220.276661:ERROR:gpu_channel.cc(608)] GpuChannel: Failed to create SharedImageStub
version: HeadlessChrome/105.0.5173.0
[0926/160221.622346:ERROR:gpu_channel_manager.cc(839)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0926/160221.622396:ERROR:shared_image_stub.cc(489)] SharedImageStub: unable to create context
[0926/160221.622411:ERROR:gpu_channel.cc(608)] GpuChannel: Failed to create SharedImageStub
[0926/160221.622701:ERROR:gpu_channel_manager.cc(839)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
[0926/160221.622711:ERROR:shared_image_stub.cc(489)] SharedImageStub: unable to create context
[0926/160221.622720:ERROR:gpu_channel.cc(608)] GpuChannel: Failed to create SharedImageStub
Error on .close() - stack dump: (after the program runs successfully otherwise.
Received signal 11 <unknown> 000000000000
#0 0x555a40aaf612 base::debug::CollectStackTrace()
#1 0x555a40a0e193 base::debug::StackTrace::StackTrace()
#2 0x555a40aaf131 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f8dfab15730 (/lib/x86_64-linux-gnu/libpthread-2.28.so+0x1272f)
#4 0x555a40a696f4 base::SupportsUserData::GetUserData()
#5 0x555a3e7cfa0e content::RenderProcessHostImpl::UnregisterHost()
#6 0x555a3e7cf1f4 content::RenderProcessHostImpl::~RenderProcessHostImpl()
#7 0x555a3e7cfe2e content::RenderProcessHostImpl::~RenderProcessHostImpl()
#8 0x555a3e7cefa8 content::RenderProcessHostImpl::ShutDownInProcessRenderer()
#9 0x555a3e3df5df content::BrowserMainLoop::ShutdownThreadsAndCleanUp()
#10 0x555a3e3e0ead content::BrowserMainRunnerImpl::Shutdown()
#11 0x555a461ad557 headless::HeadlessContentMainDelegate::RunProcess()
#12 0x555a40599942 content::RunBrowserProcessMain()
#13 0x555a4059aed9 content::ContentMainRunnerImpl::RunBrowser()
#14 0x555a4059aa70 content::ContentMainRunnerImpl::Run()
#15 0x555a40597c54 content::RunContentProcess()
#16 0x555a405985e4 content::ContentMain()
#17 0x555a405f23ba headless::(anonymous namespace)::RunContentMain()
#18 0x555a405f20c5 headless::HeadlessShellMain()
#19 0x555a3ce0d1e3 ChromeMain
#20 0x7f8df940f09b __libc_start_main
#21 0x555a3ce0d02a _start
r8: 00007ffd410e2060 r9: 0000000000000001 r10: 0000000000000002 r11: 0000555a46a1e5a0
r12: 00002fdc0068cf00 r13: 0000555a46993530 r14: 00002fdc00210c08 r15: 00002fdc0068cf00
di: 00002fdc00210c18 si: 0000555a3b080d90 bp: 00007ffd410e2090 bx: 00002fdc003541c0
dx: badbad00badbad08 ax: 00002fdc00210c18 cx: badbad00badbad00 sp: 00007ffd410e2090
ip: 0000555a40a696f4 efl: 0000000000010206 cgf: 002b000000000033 erf: 0000000000000000
trp: 000000000000000d msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Problem:
I am trying to access the arguments used for a syscall using ptrace. I am facing the issue that some arguments are actual pointers like in int mprotect(void *addr, size_t len, int prot) and some others are pointers to strings like in int access(const char *pathname, int mode) which I would like to evaluate to the human readable string. This results in an address in both cases but I only want to read the value from memory in the latter case.
I would be interested in knowing if this issue can be solved without annotating the types for every syscall and why reading from the second pointer from the examples is failing.
Examples:
user_regs_struct containing a pointer to a string in rdi
user_regs_struct { r15: 140737354130144, r14: 0, r13: 140737354083728, r12: 0, rbp: 140737488344944, rbx: 140737354129688, r11: 582, r10: 34, r9: 0, r8: 0, rax: 18446744073709551578, rcx: 140737354045899, rdx: 93824992369384, rsi: 4, rdi: 140737354083728, orig_rax: 21, rip: 140737354045899, cs: 51, eflags: 582, rsp: 140737488344232, ss: 43, fs_base: 0, gs_base: 0, ds: 0, es: 0, fs: 0, gs: 0 }
Reading from rdi results in:
"/etc/ld.so.preload"
user_regs_struct containing a pointer in rdi
user_regs_struct { r15: 140737353856352, r14: 140737353785344, r13: 140737488340648, r12: 4, rbp: 140737488341504, rbx: 140737488340480, r11: 582, r10: 50, r9: 0, r8: 4294967295, rax: 18446744073709551578, rcx: 140737354046679, rdx: 3, rsi: 5640, rdi: 140737353785344, orig_rax: 9, rip: 140737354046679, cs: 51, eflags: 582, rsp: 140737488340472, ss: 43, fs_base: 0, gs_base: 0, ds: 0, es: 0, fs: 0, gs: 0 }
Reading from rdi results in:
thread 'main' panicked at 'Failed to read data for pid 33885: EIO: I/O error', src/main.rs:85:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Relevant line of code:
let res: c_long = ptrace::read(pid, address).unwrap_or_else(|err| {
panic!("Failed to read data for pid {}: {}", pid, err);
});
I used the mutex to synchronize the two kernel threads. After running, panic occurred in the system and abnormal memory was found in mutex by kdump.
Here is a simplified code example, You can run it directly to reproduce the problem.
I changed the memory allocation method to use kmalloc instead of vmalloc, and then it worked, Who knows why?
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
#include <linux/slab.h>
struct product {
struct list_head list;
struct mutex lock;
bool finish;
};
struct task_struct *task1;
struct task_struct *task2;
spinlock_t spin;
struct list_head products;
struct product *create_product(void)
{
struct product *p_prod;
p_prod = vmalloc(sizeof(struct product));
// p_prod = kmalloc(sizeof(struct product), GFP_KERNEL);
if(!p_prod)
return NULL;
INIT_LIST_HEAD(&p_prod->list);
mutex_init(&p_prod->lock);
p_prod->finish = false;
return p_prod;
}
void remove_product(struct product **pp_prod)
{
vfree(*pp_prod);
// kfree(*pp_prod);
*pp_prod = NULL;
}
int producer(void *data)
{
while(!kthread_should_stop())
{
struct product *p_prod = create_product();
if(!p_prod)
continue;
spin_lock(&spin);
list_add_tail(&p_prod->list, &products);
spin_unlock(&spin);
while (true)
{
mutex_lock(&p_prod->lock);
if(p_prod->finish)
{
mutex_unlock(&p_prod->lock);
schedule();
break;
}
mutex_unlock(&p_prod->lock);
}
remove_product(&p_prod);
}
do_exit(0);
}
int consumer(void *data)
{
while(!kthread_should_stop())
{
struct product *p_prod;
spin_lock(&spin);
if(list_empty(&products))
{
spin_unlock(&spin);
schedule();
continue;
}
p_prod = list_first_entry(&products, struct product, list);
list_del(&p_prod->list);
spin_unlock(&spin);
mutex_lock(&p_prod->lock);
p_prod->finish = true;
mutex_unlock(&p_prod->lock);
}
do_exit(0);
}
static int __init kdemo_init(void) {
printk(">>> demo driver begin!\n");
spin_lock_init(&spin);
INIT_LIST_HEAD(&products);
task1 = kthread_run(producer, NULL, "hdz-producer");
task2 = kthread_run(consumer, NULL, "hdz-consumer");
return 0;
}
static void __exit kdemo_exit(void) {
kthread_stop(task1);
kthread_stop(task2);
printk(">>> demo driver exit!\n");
}
module_init(kdemo_init);
module_exit(kdemo_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("xxxx#xxx.com");
MODULE_VERSION("1.0");
dmesg log and consumer stack
[ 176.599116] >>> demo driver begin!
[ 177.167659] BUG: unable to handle kernel NULL pointer dereference at 0000000000000fb0
[ 177.167695] IP: [<ffffffff9e0caa47>] wake_q_add+0x17/0x50
[ 177.167719] PGD 0
[ 177.167729] Oops: 0002 [#1] SMP
[ 177.167743] Modules linked in: kdemo(OE) mpt3sas mptctl mptbase nvmet_rdma nvmet nvme_rdma nvme_fabrics nvme nvme_core drbd(OE) dell_rbu kvdo(OE) uds(OE) bonding sha512_ssse3 sha512_generic qat_api(OE) usdm_drv(OE) intel_qat(OE) authenc uio ib_isert iscsi_target_mod ib_srpt target_core_mod ib_srp scsi_transport_srp scsi_tgt ib_ucm rpcrdma sunrpc rdma_ucm ib_umad ib_uverbs ib_iser rdma_cm ib_ipoib iw_cm libiscsi scsi_transport_iscsi ib_cm mlx5_ib ib_core intelcas(OE) inteldisk(OE) iTCO_wdt iTCO_vendor_support dell_smbios sparse_keymap dcdbas skx_edac intel_powerclamp coretemp intel_rapl iosf_mbi kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd sg joydev pcspkr ipmi_si i2c_i801 lpc_ich shpchp ipmi_devintf ipmi_msghandler mei_me acpi_power_meter
[ 177.168071] mei acpi_pad wmi nfit libnvdimm dm_multipath binfmt_misc ip_tables xfs libcrc32c mgag200 drm_kms_helper crc32c_intel syscopyarea sysfillrect sysimgblt mlx5_core fb_sys_fops ttm ixgbe drm igb mlxfw devlink mdio ptp i2c_algo_bit pps_core i2c_core dca sr_mod cdrom sd_mod crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common ahci libahci libata mpt2sas raid_class scsi_transport_sas megaraid_sas dm_mirror dm_region_hash dm_log dm_mod
[ 177.168263] CPU: 24 PID: 5412 Comm: hdz-consumer Kdump: loaded Tainted: G OE ------------ 3.10.0-862.el7.x86_64 #1
[ 177.168297] Hardware name: Dell Inc. PowerEdge R740/08D89F, BIOS 2.10.2 02/24/2021
[ 177.168320] task: ffff93db22af3f40 ti: ffff93dc89354000 task.ti: ffff93dc89354000
[ 177.168344] RIP: 0010:[<ffffffff9e0caa47>] [<ffffffff9e0caa47>] wake_q_add+0x17/0x50
[ 177.168372] RSP: 0018:ffff93dc89357e48 EFLAGS: 00010246
[ 177.168389] RAX: 0000000000000000 RBX: ffffbe2ce6533018 RCX: 0000000000000fb0
[ 177.168410] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff93dc89357e58
[ 177.168432] RBP: ffff93dc89357e48 R08: ffffbe2ce6533000 R09: 0000000000000000
[ 177.168453] R10: 0000000000000001 R11: 0000000000000001 R12: ffffbe2ce6533014
[ 177.168475] R13: ffff93dc89357e58 R14: 0000000000000000 R15: 0000000000000000
[ 177.168497] FS: 0000000000000000(0000) GS:ffff93dca9400000(0000) knlGS:0000000000000000
[ 177.168540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 177.168560] CR2: 0000000000000fb0 CR3: 00000002b7a0e000 CR4: 00000000007607e0
[ 177.168583] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 177.168606] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 177.168629] PKRU: 00000000
[ 177.168640] Call Trace:
[ 177.168656] [<ffffffff9e711b2e>] __mutex_unlock_slowpath+0x5e/0x90
[ 177.168679] [<ffffffff9e710fab>] mutex_unlock+0x1b/0x20
[ 177.168699] [<ffffffffc0637064>] consumer+0x64/0x90 [kdemo]
[ 177.168723] [<ffffffffc0637000>] ? 0xffffffffc0636fff
[ 177.168746] [<ffffffff9e0bae31>] kthread+0xd1/0xe0
[ 177.168765] [<ffffffff9e0bad60>] ? insert_kthread_work+0x40/0x40
[ 177.168788] [<ffffffff9e71f61d>] ret_from_fork_nospec_begin+0x7/0x21
[ 177.168811] [<ffffffff9e0bad60>] ? insert_kthread_work+0x40/0x40
[ 177.168831] Code: 09 00 00 31 c9 31 d2 e8 18 41 ff ff eb e4 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 8d 8e b0 0f 00 00 31 c0 ba 01 00 00 00 48 89 e5 <f0> 48 0f b1 96 b0 0f 00 00 48 85 c0 74 0b 5d c3 66 0f 1f 84 00
[ 177.168996] RIP [<ffffffff9e0caa47>] wake_q_add+0x17/0x50
[ 177.169017] RSP <ffff93dc89357e48>
[ 177.169959] CR2: 0000000000000fb0
producer stask
crash> bt 5411
PID: 5411 TASK: ffff93db22af4f10 CPU: 1 COMMAND: "hdz-producer"
bt: page excluded: kernel virtual address: ffffffffffffffff type: "cpu_online_map"
#0 [ffff93dca8e48e48] crash_nmi_callback at ffffffff9e0533b7
#1 [ffff93dca8e48e58] nmi_handle at ffffffff9e71790c
#2 [ffff93dca8e48eb0] do_nmi at ffffffff9e717b2d
#3 [ffff93dca8e48ef0] end_repeat_nmi at ffffffff9e716d79
#4 [ffff93dca8e48f28] __vmalloc_node_range at ffffffff9e1d7518
[exception RIP: mutex_unlock+20]
RIP: ffffffff9e710fa4 RSP: ffff93ddafd73e98 RFLAGS: 00000202
RAX: 0000000000000010 RBX: 0000000000000010 RCX: 0000000000000202
RDX: ffff93ddafd73e98 RSI: 0000000000000018 RDI: 0000000000000001
RBP: ffffffff9e710fa4 R8: ffffffff9e710fa4 R9: 0000000000000018
R10: ffff93ddafd73e98 R11: 0000000000000202 R12: ffffffffffffffff
R13: ffffbe2ce6535010 R14: ffffffffc0639240 R15: 0000000000000000
ORIG_RAX: ffffffffc0639240 CS: 0010 SS: 0018
--- <(unknown) exception stack> ---
#5 [ffff93ddafd73e98] mutex_unlock at ffffffff9e710fa4
#6 [ffff93ddafd73ea0] producer at ffffffffc0637145 [kdemo]
#7 [ffff93ddafd73ec8] kthread at ffffffff9e0bae31
#8 [ffff93ddafd73f50] ret_from_fork_nospec_begin at ffffffff9e71f61d
I've written an application that runs on my Ubuntu 18.04 x64 server on Digital Ocean. I'm keeping the application running with PM2.
The code runs successfully for the first several iterations (it's a web scraper that runs every 15 minutes) but after a few hours the app breaks down. Here are the error logs (each starts with date):
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
info # 03-20-2019 19:30:15 –– No updates –– 2019-20-03 // The is a successful log...
debug # 03-20-2019 19:45:44 –– Navigation Timeout Exceeded: 30000ms exceeded
debug # 03-20-2019 20:15:20 –– Failed to launch chrome!
[0320/201518.129756:FATAL:zygote_host_impl_linux.cc(170)] Check failed: process.IsValid(). Failed to launch zygote process
#0 0x55e0a9ef8f29 base::debug::CollectStackTrace()
#1 0x55e0a9e5e593 base::debug::StackTrace::StackTrace()
#2 0x55e0a9e72d1e logging::LogMessage::~LogMessage()
#3 0x55e0ab4dbd79 service_manager::ZygoteHostImpl::LaunchZygote()
#4 0x55e0a9ab4950 content::(anonymous namespace)::LaunchZygoteHelper()
#5 0x55e0ab4db128 service_manager::ZygoteCommunication::Init()
#6 0x55e0ab4e1353 service_manager::CreateGenericZygote()
#7 0x55e0a9ab41fb content::ContentMainRunnerImpl::Initialize()
#8 0x55e0a9ae6fca service_manager::Main()
#9 0x55e0a9ab2791 content::ContentMain()
#10 0x55e0ae14e178 headless::(anonymous namespace)::RunContentMain()
#11 0x55e0ae14e205 headless::HeadlessBrowserMain()
#12 0x55e0a9ae5ca3 headless::HeadlessShellMain()
#13 0x55e0a7a1d1ac ChromeMain
#14 0x7f59a1e33b97 __libc_start_main
#15 0x55e0a7a1d02a _start
Received signal 6
#0 0x55e0a9ef8f29 base::debug::CollectStackTrace()
#1 0x55e0a9e5e593 base::debug::StackTrace::StackTrace()
#2 0x55e0a9ef8ab1 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f59a80aa890 <unknown>
#4 0x7f59a1e50e97 gsignal
#5 0x7f59a1e52801 abort
#6 0x55e0a9ef78e5 base::debug::BreakDebugger()
#7 0x55e0a9e72f61 logging::LogMessage::~LogMessage()
#8 0x55e0ab4dbd79 service_manager::ZygoteHostImpl::LaunchZygote()
#9 0x55e0a9ab4950 content::(anonymous namespace)::LaunchZygoteHelper()
#10 0x55e0ab4db128 service_manager::ZygoteCommunication::Init()
#11 0x55e0ab4e1353 service_manager::CreateGenericZygote()
#12 0x55e0a9ab41fb content::ContentMainRunnerImpl::Initialize()
#13 0x55e0a9ae6fca service_manager::Main()
#14 0x55e0a9ab2791 content::ContentMain()
#15 0x55e0ae14e178 headless::(anonymous namespace)::RunContentMain()
#16 0x55e0ae14e205 headless::HeadlessBrowserMain()
#17 0x55e0a9ae5ca3 headless::HeadlessShellMain()
#18 0x55e0a7a1d1ac ChromeMain
#19 0x7f59a1e33b97 __libc_start_main
#20 0x55e0a7a1d02a _start
r8: 0000000000000000 r9: 00007ffc5ad954f0 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffc5ad95798 r13: 000000000000007a r14: 00007ffc5ad96200 r15: 00007ffc5ad961f8
di: 0000000000000002 si: 00007ffc5ad954f0 bp: 00007ffc5ad95740 bx: 000036f0ed7d7000
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f59a1e50e97 sp: 00007ffc5ad954f0
ip: 00007f59a1e50e97 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
debug # 03-20-2019 20:30:34 –– Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r637110
debug # 03-20-2019 20:45:31 –– Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r637110
debug # 03-20-2019 21:00:30 –– Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r637110
debug # 03-20-2019 21:15:05 –– Failed to launch chrome!
[0320/211503.503077:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
[0320/211503.899485:FATAL:simple_thread.cc(56)] Check failed: success.
#0 0x55e159dbef29 base::debug::CollectStackTrace()
#1 0x55e159d24593 base::debug::StackTrace::StackTrace()
#2 0x55e159d38d1e logging::LogMessage::~LogMessage()
#3 0x55e159d959ff base::SimpleThread::Start()
#4 0x55e15876edd2 content::SandboxHostLinux::Init()
#5 0x55e15997a125 content::ContentMainRunnerImpl::Initialize()
#6 0x55e1599acfca service_manager::Main()
#7 0x55e159978791 content::ContentMain()
#8 0x55e15e014178 headless::(anonymous namespace)::RunContentMain()
#9 0x55e15e014205 headless::HeadlessBrowserMain()
#10 0x55e1599abca3 headless::HeadlessShellMain()
#11 0x55e1578e31ac ChromeMain
#12 0x7f4000b8ab97 __libc_start_main
#13 0x55e1578e302a _start
Received signal 6
#0 0x55e159dbef29 base::debug::CollectStackTrace()
#1 0x55e159d24593 base::debug::StackTrace::StackTrace()
#2 0x55e159dbeab1 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7f4006e01890 <unknown>
#4 0x7f4000ba7e97 gsignal
#5 0x7f4000ba9801 abort
#6 0x55e159dbd8e5 base::debug::BreakDebugger()
#7 0x55e159d38f61 logging::LogMessage::~LogMessage()
#8 0x55e159d959ff base::SimpleThread::Start()
#9 0x55e15876edd2 content::SandboxHostLinux::Init()
#10 0x55e15997a125 content::ContentMainRunnerImpl::Initialize()
#11 0x55e1599acfca service_manager::Main()
#12 0x55e159978791 content::ContentMain()
#13 0x55e15e014178 headless::(anonymous namespace)::RunContentMain()
#14 0x55e15e014205 headless::HeadlessBrowserMain()
#15 0x55e1599abca3 headless::HeadlessShellMain()
#16 0x55e1578e31ac ChromeMain
#17 0x7f4000b8ab97 __libc_start_main
#18 0x55e1578e302a _start
r8: 0000000000000000 r9: 00007ffc5b48ace0 r10: 0000000000000008 r11: 0000000000000246
r12: 00007ffc5b48af88 r13: 0000000000000047 r14: 00007ffc5b48b8e8 r15: 00007ffc5b48b8e0
di: 0000000000000002 si: 00007ffc5b48ace0 bp: 00007ffc5b48af30 bx: 00000233a2484b00
dx: 0000000000000000 ax: 0000000000000000 cx: 00007f4000ba7e97 sp: 00007ffc5b48ace0
ip: 00007f4000ba7e97 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.
TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
The puppeteer part of my program looks like this:
const fetchContracts = async (url) => {
const browser = await pupeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox']});
const page = await browser.newPage(); // Create new instance of puppet
const pendingXHR = new PendingXHR(page);
await page.goto(url, { waitUntil: 'networkidle2' }); // Ensure no network requests are happening (in last 500ms).
await Promise.all([
page.click("#agree_statement"),
page.waitForNavigation()
]);
await page.click(".form-check-input");
await Promise.all([
page.click(".btn-primary"),
page.waitForNavigation()
]);
await pendingXHR.waitForAllXhrFinished();
await page.click('.sorting:nth-child(5)');
await pendingXHR.waitForAllXhrFinished();
await page.click('.sorting_asc');
await pendingXHR.waitForAllXhrFinished();
let html = await page.content();
await page.close();
return html;
}
Does anyone know what I am doing wrong? I have very little experience with stack traces and error logging. Thank you.
I forgot to quit out of the browser! I was quitting out of the page, but leaving the browser hanging, which was causing all sorts of memory problems on my server. Here's the PIDs on my server to prove what was going wrong.
After adding in await browser.close(); my code is working again!
A hardware is performing memory operation and resulting in a page-fault. How can I determine the virtual address that is causing following double fault error message so that I can pin the address?
[ 52.330981] PANIC: double fault, error_code: 0x0
[ 52.331972] Kernel panic - not syncing: Machine halted.
[ 52.332916] CPU: 0 PID: 1432 Comm: stress Tainted: G OE 4.15.0-23-generic #25~16.04.1-Ubuntu
[ 52.334584] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[ 52.336673] Call Trace:
[ 52.337151] <#DF>
[ 52.337549] dump_stack+0x63/0x8b
[ 52.338152] panic+0xe4/0x244
[ 52.338690] df_debug+0x2d/0x30
[ 52.339450] do_double_fault+0x9a/0x130
[ 52.340187] double_fault+0x1e/0x30
[ 52.340836] RIP: 0010:error_entry+0x1e/0x100
[ 52.341674] RSP: 0000:fffffe0000002000 EFLAGS: 00010046
[ 52.342605] RAX: 0000000090c009e7 RBX: 0000000000000001 RCX: ffffffff90c009e7
[ 52.343896] RDX: 0000000004ba1000 RSI: ffffffff90c015ff RDI: fffffe0000002078
[ 52.345153] RBP: fffffe0000002079 R08: 0000000000000000 R09: 0000000000000000
[ 52.346407] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 52.347739] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 52.349054] ? native_iret+0x7/0x7
[ 52.349729] ? async_page_fault+0xf/0x50
[ 52.350463] </#DF>
[ 52.350908] <ENTRY_TRAMPOLINE>
[ 52.351503] RIP: 0010:do_async_page_fault+0x0/0x80
[ 52.352443] RSP: 0000:fffffe0000002120 EFLAGS: 00010012
[ 52.353416] RAX: 0000000090c009e7 RBX: 0000000000000001 RCX: ffffffff90c009e7
[ 52.354770] RDX: 0000000004ba1000 RSI: 0000000000000000 RDI: fffffe0000002128
[ 52.356160] RBP: fffffe0000002129 R08: 0000000000000000 R09: 0000000000000000
[ 52.357500] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
[ 52.358814] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 52.360157] ? native_iret+0x7/0x7
[ 52.360849] ? kvm_async_pf_task_wait+0x220/0x220
[ 52.361717] ? async_page_fault+0x25/0x50
[ 52.362521] ? native_iret+0x7/0x7
[ 52.363136] RIP: 0010:async_page_fault+0x0/0x50
[ 52.364052] RSP: 0000:fffffe00000021d0 EFLAGS: 00010006
[ 52.365021] RAX: 00007f780fef3010 RBX: 00007f780b352010 RCX: 00007f780b352010
[ 52.366391] RDX: 0000000004ba1000 RSI: 0000000008001000 RDI: 0000000000000000
[ 52.367729] RBP: 0000000008000000 R08: ffffffffffffffff R09: 0000000000000000
[ 52.369046] R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000001000
[ 52.370437] R13: 00007f7813351010 R14: 0000000000000002 R15: fffffffffffff000
[ 52.372447] ? async_page_fault+0x25/0x50
[ 52.373650] </ENTRY_TRAMPOLINE>
[ 52.374788] Kernel Offset: 0xf200000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
[ 52.376319] ---[ end Kernel panic - not syncing: Machine halted.