mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 09:13:37 +01:00
sys/tools/syscalls: desupport capabilities.conf
We haven't used this since commitbe67ea40c5
in 2021 so stop carrying it forward. Also remove support for setting the list in syscalls.conf via the capenabled variable. This was last used by cloudabi (removed in 2021 by commitcf0ee8738e
).
This commit is contained in:
parent
74231c8172
commit
ec86d763d1
@ -47,10 +47,8 @@ local config = {
|
||||
ptr_intptr_t_cast = "intptr_t",
|
||||
obsol = {},
|
||||
unimpl = {},
|
||||
capabilities_conf = "capabilities.conf",
|
||||
compat_set = "native",
|
||||
mincompat = 0,
|
||||
capenabled = {},
|
||||
-- System calls that require ABI-specific handling.
|
||||
syscall_abi_change = {},
|
||||
-- System calls that appear to require handling, but don't.
|
||||
@ -222,8 +220,7 @@ function config.merge(fh)
|
||||
-- Match for pipe, that's how abi_flags
|
||||
-- is formatted.
|
||||
config[k] = util.setFromString(v, "[^|]+")
|
||||
elseif k:find("capenabled") or
|
||||
k:find("syscall_abi_change") or
|
||||
elseif k:find("syscall_abi_change") or
|
||||
k:find("syscall_no_abi_change") or
|
||||
k:find("obsol") or
|
||||
k:find("unimpl") then
|
||||
@ -263,50 +260,4 @@ function config.mergeCompat()
|
||||
end
|
||||
end
|
||||
|
||||
-- Parses the provided capabilities.conf. Returns a string (comma separated
|
||||
-- list) as its formatted in capabilities.conf, or NIL and a message if no file
|
||||
-- was provided.
|
||||
local function grabCapenabled(file, open_fail_ok)
|
||||
local capentries = {}
|
||||
local commentExpr = "#.*"
|
||||
|
||||
if file == nil then
|
||||
return nil, "No file given"
|
||||
end
|
||||
|
||||
local fh, msg, errno = io.open(file)
|
||||
if fh == nil then
|
||||
if not open_fail_ok then
|
||||
util.abort(errno, msg)
|
||||
end
|
||||
return nil, msg
|
||||
end
|
||||
|
||||
for nextline in fh:lines() do
|
||||
-- Strip any comments.
|
||||
nextline = nextline:gsub(commentExpr, "")
|
||||
if nextline ~= "" then
|
||||
capentries[nextline] = true
|
||||
end
|
||||
end
|
||||
|
||||
assert(fh:close())
|
||||
return capentries
|
||||
end
|
||||
|
||||
-- Merge capability (Capsicum) configuration into the global config.
|
||||
function config.mergeCapability()
|
||||
-- We ignore errors here if we're relying on the default configuration.
|
||||
if not config.modifications.capenabled then
|
||||
config.capenabled = grabCapenabled(config.capabilities_conf,
|
||||
config.modifications.capabilities_conf == nil)
|
||||
elseif config.capenabled ~= "" then
|
||||
-- We have a comma separated list from the format of
|
||||
-- capabilities.conf, split it into a set with boolean values
|
||||
-- for each key.
|
||||
config.capenabled = util.setFromString(config.capenabled,
|
||||
"[^,]+")
|
||||
end
|
||||
end
|
||||
|
||||
return config
|
||||
|
@ -48,14 +48,9 @@ end
|
||||
function syscall:processCap()
|
||||
self.cap = "0"
|
||||
local stripped = util.stripAbiPrefix(self.name, self.prefix)
|
||||
if config.capenabled ~= nil and (config.capenabled[self.name] ~= nil or
|
||||
config.capenabled[stripped] ~= nil) then
|
||||
self.cap = "SYF_CAPENABLED"
|
||||
else
|
||||
for k, _ in pairs(self.type) do
|
||||
if k == "CAPENABLED" then
|
||||
self.cap = "SYF_CAPENABLED"
|
||||
end
|
||||
for k, _ in pairs(self.type) do
|
||||
if k == "CAPENABLED" then
|
||||
self.cap = "SYF_CAPENABLED"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -40,7 +40,6 @@ local sysfile, configfile = arg[1], arg[2]
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
||||
|
@ -180,7 +180,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed syscall table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -98,7 +98,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed syscall table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -84,7 +84,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed system call table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -77,7 +77,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed syscall table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -96,7 +96,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed syscall table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -61,7 +61,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed syscall table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -229,7 +229,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed system call table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
@ -255,7 +255,6 @@ if script then
|
||||
|
||||
config.merge(configfile)
|
||||
config.mergeCompat()
|
||||
config.mergeCapability()
|
||||
|
||||
-- The parsed system call table.
|
||||
local tbl = FreeBSDSyscall:new{sysfile = sysfile, config = config}
|
||||
|
Loading…
Reference in New Issue
Block a user