recodesign node.js运行时获取权限错误?

mlnl4t2r  于 2023-05-06  发布在  Node.js
关注(0)|答案(1)|浏览(138)

出于某种原因,我需要重新设计node.js。
我尝试用自己的mac appId和codesign --deep --timestamp --options runtime -f -s 'Developer ID Application: xxxxxxxx' ~/Library/Keychains/login.keychain-db node命令重新设计node.js。
一切看起来都很好,我可以用命令codesign -d -vvvv node看到节点的签名
但是当我用node -p 'process'运行recodesign node.js时,我得到了这个错误:

#
# Fatal error in , line 0
# Check failed: reservation_.SetPermissions(unprotect_start, unprotect_size, FLAG_write_code_using_rwx ? PageAllocator::kReadWriteExecute : PageAllocator::kReadWrite).
#
#
#
#FailureMessage Object: 0x7ff7bc3c2a50
 1: 0x103c7c5e2 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/lib/gsf/bin/node]
 2: 0x104d68133 V8_Fatal(char const*, ...) [/usr/local/lib/gsf/bin/node]
 3: 0x103fbb4d4 v8::internal::MemoryChunk::SetCodeModificationPermissions() [/usr/local/lib/gsf/bin/node]
 4: 0x103f38f89 v8::internal::Heap::UnprotectAndRegisterMemoryChunk(v8::internal::MemoryChunk*, v8::internal::UnprotectMemoryOrigin) [/usr/local/lib/gsf/bin/node]
 5: 0x103f0c8ac v8::internal::Heap::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/lib/gsf/bin/node]
 6: 0x103f3ed01 v8::internal::Heap::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/lib/gsf/bin/node]
 7: 0x103f0b810 v8::internal::Factory::CodeBuilder::AllocateCode(bool) [/usr/local/lib/gsf/bin/node]
 8: 0x103f0afa9 v8::internal::Factory::CodeBuilder::BuildInternal(bool) [/usr/local/lib/gsf/bin/node]
 9: 0x103de1ea3 v8::internal::baseline::BaselineCompiler::Build(v8::internal::Isolate*) [/usr/local/lib/gsf/bin/node]
10: 0x103df4063 v8::internal::GenerateBaselineCode(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SharedFunctionInfo>) [/usr/local/lib/gsf/bin/node]
11: 0x103e2e1c7 v8::internal::Compiler::CompileSharedWithBaseline(v8::internal::Isolate*, v8::internal::Handle<v8::internal::SharedFunctionInfo>, v8::internal::Compiler::ClearExceptionFlag, v8::internal::IsCompiledScope*) [/usr/local/lib/gsf/bin/node]
12: 0x103e2e553 v8::internal::Compiler::CompileBaseline(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Compiler::ClearExceptionFlag, v8::internal::IsCompiledScope*) [/usr/local/lib/gsf/bin/node]
13: 0x103dde048 v8::internal::baseline::BaselineBatchCompiler::CompileBatch(v8::internal::Handle<v8::internal::JSFunction>) [/usr/local/lib/gsf/bin/node]
14: 0x103dddf87 v8::internal::baseline::BaselineBatchCompiler::EnqueueFunction(v8::internal::Handle<v8::internal::JSFunction>) [/usr/local/lib/gsf/bin/node]
15: 0x1042f0861 v8::internal::(anonymous namespace)::BytecodeBudgetInterruptFromBytecode(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>) [/usr/local/lib/gsf/bin/node]
16: 0x1042ef453 v8::internal::Runtime_BytecodeBudgetInterruptFromBytecode(int, unsigned long*, v8::internal::Isolate*) [/usr/local/lib/gsf/bin/node]
17: 0x1046adff9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/lib/gsf/bin/node]

下面是我的重新设计脚本:

# download node.js
curl https://nodejs.org/dist/v17.8.0/node-v17.8.0-darwin-arm64.tar.xz -o node-v17.8.0-darwin-arm64.tar.xz

tar -xJf node-v17.8.0-darwin-arm64.tar.xz

cd node-v17.8.0-darwin-arm64/bin

codesign --deep --timestamp --options runtime -f -s 'Developer ID Application: xxxxxxx Company Limited (xxxxxxxxx)' ~/Library/Keychains/login.keychain-db  node

codesign -d -vvvv node

是什么原因导致这个错误?
如何修复这个错误?
谢谢

vyswwuz2

vyswwuz21#

我使用blow命令重新设计了node.js,看起来工作正常。

codesign --deep --timestamp --preserve-metadata=entitlements --options runtime -f -s 'Developer ID Application: xxxxxxxx' --entitlements node.entitlements ~/Library/Keychains/login.keychain-db node

--preserve-metadata=entitlements是关键。

为什么有人投票This question does not show any research effort; it is unclear or not useful。我研究这个问题很久了。如果你认为这道题没有用,那你为什么不知道怎么做这道题呢?

这些自以为是的家伙太烦人了。

相关问题