Page MenuHomeFreeBSD

Set pcpu curpmap for powerpc64
ClosedPublic

Authored by jhibbits on Jul 11 2019, 3:45 AM.

Details

Summary

If an illegal instruction is encountered on a process running on a
powerpc64 kernel it would attempt to sync the cache before retrying the
instruction "just in case". However, since curpmap is not set, when
moea64_sync_icache() attempts to lock the pmap, it's locking on a NULL pointer,
triggering a panic. Fix this by adding a (assumed unnecessary) fallback to curthread's pmap in moea64_sync_icache().

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhibbits created this revision.Jul 11 2019, 3:45 AM
luporl accepted this revision.Jul 11 2019, 12:30 PM
This revision is now accepted and ready to land.Jul 11 2019, 12:30 PM
alfredo.junior_eldorado.org.br requested changes to this revision.Jul 11 2019, 1:12 PM

@jhibbits , I tested this patch on elfv2 kernel and it still panics

This revision now requires changes to proceed.Jul 11 2019, 1:12 PM
jhibbits updated this revision to Diff 59664.Jul 12 2019, 12:37 AM

Simplify the code. Revert to the first version tested.

jhibbits updated this revision to Diff 59665.Jul 12 2019, 12:39 AM

It helps if I use an actual pointer.

jhibbits edited the summary of this revision. (Show Details)Jul 12 2019, 12:40 AM

Thank you @jhibbits, this patch works fine for me:

# ./mksnapshot 
Illegal instruction (core dumped)

And kernel doesn't panic.

Just for the record, the illegal instruction was:

Thread 1 received signal SIGILL, Illegal instruction.
0x000000deaf7432e0 in ?? ()
(gdb) bt
#0  0x000000deaf7432e0 in ?? ()
#1  0x0000000010815298 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, bool, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Handle<v8::internal::Object>, v8::internal::Execution::MessageHandling, v8::internal::Execution::Target) ()
#2  0x000000001081557c in v8::internal::Execution::TryCall(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::Execution::MessageHandling, v8::internal::MaybeHandle<v8::internal::Object>*, v8::internal::Execution::Target) ()
#3  0x0000000010445970 in v8::internal::Bootstrapper::CompileNative(v8::internal::Isolate*, v8::internal::Vector<char const>, v8::internal::Handle<v8::internal::String>, int, v8::internal::Handle<v8::internal::Object>*, v8::internal::NativesFlag) ()
#4  0x0000000010445774 in v8::internal::Bootstrapper::CompileBuiltin(v8::internal::Isolate*, int) ()
#5  0x0000000010449bf0 in v8::internal::Genesis::InstallNatives(v8::internal::GlobalContextType) ()
#6  0x000000001044dc0c in v8::internal::Genesis::Genesis(v8::internal::Isolate*, v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, unsigned long, v8::DeserializeInternalFieldsCallback, v8::internal::GlobalContextType) ()
#7  0x0000000010430aa8 in v8::internal::Bootstrapper::CreateEnvironment(v8::internal::MaybeHandle<v8::internal::JSGlobalProxy>, v8::Local<v8::ObjectTemplate>, v8::ExtensionConfiguration*, unsigned long, v8::DeserializeInternalFieldsCallback, v8::internal::GlobalContextType) ()
#8  0x00000000103fbd10 in v8::NewContext(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, unsigned long, v8::DeserializeInternalFieldsCallback) ()
#9  0x00000000103d37f8 in v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::MaybeLocal<v8::ObjectTemplate>, v8::MaybeLocal<v8::Value>, v8::DeserializeInternalFieldsCallback) ()
#10 0x00000000103d06c8 in main ()
(gdb) disass *$pc,+4
Dump of assembler code from 0xdeaf7432e0 to 0xdeaf7432e4:
=> 0x000000deaf7432e0:	.long 0xde
End of assembler dump.
(gdb)
This revision is now accepted and ready to land.Jul 12 2019, 2:19 PM
This revision was automatically updated to reflect the committed changes.