Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
Make server --path work with pledge() security
Justine Tunneye85cc5a8e5ed
diff --git a/llama.cpp/server/server.cpp b/llama.cpp/server/server.cppindex 558e60dd..26e8730e 100644--- a/llama.cpp/server/server.cpp+++ b/llama.cpp/server/server.cpp@@ -3016,11 +3016,14 @@ int main(int argc, char **argv)// - Filesystem access is disabled entirely (except ZipOS).// - On Linux, network access is restricted to accept() only.// Cosmopolitan Libc implements pledge() on Linux using SECCOMP.- const char *promises;+ char promises[32];if (IsOpenbsd()) {- promises = "stdio inet";+ strlcpy(promises, "stdio inet", sizeof(promises));} else {- promises = "stdio anet";+ strlcpy(promises, "stdio anet", sizeof(promises));+ }+ if (!startswith(sparams.public_path.c_str(), "/zip/")) {+ strlcat(promises, " rpath", sizeof(promises));}__pledge_mode = PLEDGE_PENALTY_RETURN_EPERM;if (pledge(0, 0)) {