NC firmware update (thanks spsf). opencomputers now uses mutiple gpus to speed up rendering and now has net drivers. currently working on kernel memory protections to prevent malicious kernel drivers. spm does not work on opencomputers, this is a known issue i am working on fixing it :D sorry for the slow development.

This commit is contained in:
Astronand committed 2026-11-04 14:19:15 -05:00
1 parent fbaafc7cff
commit ef4b856ee6
89 files changed
+3955 -563

No files matched your search

@@ -10,26 +10,62 @@ local function bit_is_set(num, bit)
return math.floor(num / (2 ^ bit)) % 2 == 1
end
local function loadExecutable(path)
kernel.vfs.access(path, "rx")
local fd = kernel.vfs.open(path, "r")
local data = kernel.vfs.read(fd, 1024 * 1024 * 4)
if kernel.vfs.type(path)~="file" then error("Target is not file") end
local fd = kernel.vfs.open(path, "r")
if not fd then
error("ENOENT: " .. tostring(path))
end
local chunks = {}
local total = 0
local ok, err = pcall(function()
while true do
local chunk = kernel.vfs.read(fd, 2048)
if not chunk or #chunk == 0 then
break
end
chunks[#chunks + 1] = chunk
total = total + #chunk
end
end)
kernel.vfs.close(fd)
if not ok then
error("EIO reading executable: " .. tostring(err))
end
local data = table.concat(chunks)
local env = kernel.freshUserEnv()
local func, err = load(data, "@" .. path, "t", env)
if not func then kernel.log("Failed to load executable: " .. tostring(err).. " : ".. tostring(path)); error("ENOEXEC: " .. tostring(err)) end
local meta = kernel.vfs.lstat(path)
local suid_set = bit_is_set(meta.perms, 6)
if not func then
kernel.log(
"Failed to load executable: " ..
tostring(err) .. " : " .. tostring(path)
)
error("ENOEXEC: " .. tostring(err))
end
local meta = kernel.vfs.lstat(path)
local suid_set = bit_is_set(meta.perms, 6)
local caller_uid = kernel.currentTask and kernel.currentTask.uid or kernel.uid
local euid = suid_set and meta.owner or caller_uid
local euid = suid_set and meta.owner or caller_uid
return func, euid, suid_set
end
local function createTask(func, name, envars, args, tgid, real_uid, eff_uid, clearFds)
local id = nextpid
nextpid = nextpid + 1
@@ -142,6 +178,8 @@ function sys.exec(path, args, envars, clearFds)
task.args = args or {}
task.envars = envars or task.envars or {}
task.name = path
task.ivs = 0
task.vs = 0
task.coro = coroutine.create(function()
local ok, err = xpcall(func, debug.traceback, table.unpack(task.args))
@@ -251,7 +289,7 @@ function sys.stop(pid)
end
end
function sys.continue(pid)
function sys.cont(pid)
local task = tasks[tostring(pid)]
if not task then
return false, "Task does not exist"
@@ -394,7 +432,7 @@ sysc["getTask"] = sys.getTask
sysc["collect"] = sys.collect
sysc["kill"] = sys.kill
sysc["stop"] = sys.stop
sysc["continue"] = sys.continue
sysc["continue"] = sys.cont
sysc["getpid"] = sys.getpid
sysc["getppid"] = sys.getppid
sysc["getTasks"] = sys.getTasks