Kernel: Remove sys$shbuf_seal() and userland wrappers

There are no remaining users of this syscall so let it go. :^)
This commit is contained in:
Andreas Kling 2021-01-17 00:18:01 +01:00
parent 5522e8f59d
commit 05dbfe9ab6
Notes: sideshowbarker 2024-07-18 23:09:24 +09:00
13 changed files with 0 additions and 68 deletions

View file

@ -165,15 +165,4 @@ SharedBuffer::~SharedBuffer()
} }
} }
void SharedBuffer::seal()
{
#if defined(__serenity__)
int rc = shbuf_seal(m_shbuf_id);
if (rc < 0) {
perror("shbuf_seal");
ASSERT_NOT_REACHED();
}
#endif
}
} }

View file

@ -39,7 +39,6 @@ public:
bool share_with(pid_t); bool share_with(pid_t);
int shbuf_id() const { return m_shbuf_id; } int shbuf_id() const { return m_shbuf_id; }
void seal();
int size() const { return m_size; } int size() const { return m_size; }
template<typename T> template<typename T>

View file

@ -129,7 +129,6 @@ namespace Kernel {
S(chown) \ S(chown) \
S(fchmod) \ S(fchmod) \
S(symlink) \ S(symlink) \
S(shbuf_seal) \
S(sendmsg) \ S(sendmsg) \
S(recvmsg) \ S(recvmsg) \
S(getsockopt) \ S(getsockopt) \

View file

@ -338,7 +338,6 @@ public:
int sys$shbuf_allow_pid(int, pid_t peer_pid); int sys$shbuf_allow_pid(int, pid_t peer_pid);
void* sys$shbuf_get(int shbuf_id, Userspace<size_t*> size); void* sys$shbuf_get(int shbuf_id, Userspace<size_t*> size);
int sys$shbuf_release(int shbuf_id); int sys$shbuf_release(int shbuf_id);
int sys$shbuf_seal(int shbuf_id);
int sys$halt(); int sys$halt();
int sys$reboot(); int sys$reboot();
int sys$realpath(Userspace<const Syscall::SC_realpath_params*>); int sys$realpath(Userspace<const Syscall::SC_realpath_params*>);

View file

@ -185,17 +185,4 @@ void SharedBuffer::destroy_if_unused()
} }
} }
void SharedBuffer::seal()
{
LOCKER(shared_buffers().lock());
m_writable = false;
for (auto& ref : m_refs) {
// TODO: Region needs to be RefCounted!
if (auto* region = ref.region.unsafe_ptr()) {
region->set_writable(false);
region->remap();
}
}
}
} }

View file

@ -70,7 +70,6 @@ public:
static void share_all_shared_buffers(Process& from_process, Process& with_process); static void share_all_shared_buffers(Process& from_process, Process& with_process);
size_t size() const { return m_vmobject->size(); } size_t size() const { return m_vmobject->size(); }
void destroy_if_unused(); void destroy_if_unused();
void seal();
AnonymousVMObject& vmobject() { return m_vmobject; } AnonymousVMObject& vmobject() { return m_vmobject; }
const AnonymousVMObject& vmobject() const { return m_vmobject; } const AnonymousVMObject& vmobject() const { return m_vmobject; }
int id() const { return m_shbuf_id; } int id() const { return m_shbuf_id; }

View file

@ -134,21 +134,4 @@ void* Process::sys$shbuf_get(int shbuf_id, Userspace<size_t*> user_size)
return shared_buffer.ref_for_process_and_get_address(*this); return shared_buffer.ref_for_process_and_get_address(*this);
} }
int Process::sys$shbuf_seal(int shbuf_id)
{
REQUIRE_PROMISE(shared_buffer);
LOCKER(shared_buffers().lock());
auto it = shared_buffers().resource().find(shbuf_id);
if (it == shared_buffers().resource().end())
return -EINVAL;
auto& shared_buffer = *(*it).value;
if (!shared_buffer.is_shared_with(m_pid))
return -EPERM;
#ifdef SHARED_BUFFER_DEBUG
klog() << "Sealing shared buffer " << shbuf_id;
#endif
shared_buffer.seal();
return 0;
}
} }

View file

@ -393,8 +393,6 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return virt$shbuf_get(arg1, arg2); return virt$shbuf_get(arg1, arg2);
case SC_shbuf_release: case SC_shbuf_release:
return virt$shbuf_release(arg1); return virt$shbuf_release(arg1);
case SC_shbuf_seal:
return virt$shbuf_seal(arg1);
case SC_profiling_enable: case SC_profiling_enable:
return virt$profiling_enable(arg1); return virt$profiling_enable(arg1);
case SC_profiling_disable: case SC_profiling_disable:
@ -604,13 +602,6 @@ int Emulator::virt$shbuf_release(int shbuf_id)
return rc; return rc;
} }
int Emulator::virt$shbuf_seal(int shbuf_id)
{
auto* region = m_mmu.shbuf_region(shbuf_id);
ASSERT(region);
return region->seal();
}
int Emulator::virt$profiling_enable(pid_t pid) int Emulator::virt$profiling_enable(pid_t pid)
{ {
return syscall(SC_profiling_enable, pid); return syscall(SC_profiling_enable, pid);

View file

@ -95,7 +95,6 @@ private:
int virt$shbuf_allow_pid(int, pid_t peer_pid); int virt$shbuf_allow_pid(int, pid_t peer_pid);
FlatPtr virt$shbuf_get(int shbuf_id, FlatPtr size); FlatPtr virt$shbuf_get(int shbuf_id, FlatPtr size);
int virt$shbuf_release(int shbuf_id); int virt$shbuf_release(int shbuf_id);
int virt$shbuf_seal(int shbuf_id);
int virt$profiling_enable(pid_t); int virt$profiling_enable(pid_t);
int virt$profiling_disable(pid_t); int virt$profiling_disable(pid_t);
int virt$disown(pid_t); int virt$disown(pid_t);

View file

@ -109,11 +109,6 @@ int SharedBufferRegion::allow_pid(pid_t pid)
return syscall(SC_shbuf_allow_pid, m_shbuf_id, pid); return syscall(SC_shbuf_allow_pid, m_shbuf_id, pid);
} }
int SharedBufferRegion::seal()
{
return syscall(SC_shbuf_seal, m_shbuf_id);
}
int SharedBufferRegion::release() int SharedBufferRegion::release()
{ {
return syscall(SC_shbuf_release, m_shbuf_id); return syscall(SC_shbuf_release, m_shbuf_id);

View file

@ -52,7 +52,6 @@ public:
int shbuf_id() const { return m_shbuf_id; } int shbuf_id() const { return m_shbuf_id; }
int allow_pid(pid_t); int allow_pid(pid_t);
int seal();
int release(); int release();
private: private:

View file

@ -95,12 +95,6 @@ int shbuf_release(int shbuf_id)
__RETURN_WITH_ERRNO(rc, rc, -1); __RETURN_WITH_ERRNO(rc, rc, -1);
} }
int shbuf_seal(int shbuf_id)
{
int rc = syscall(SC_shbuf_seal, shbuf_id);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int shbuf_create(int size, void** buffer) int shbuf_create(int size, void** buffer)
{ {
int rc = syscall(SC_shbuf_create, size, buffer); int rc = syscall(SC_shbuf_create, size, buffer);

View file

@ -37,7 +37,6 @@ int shbuf_create(int, void** buffer);
int shbuf_allow_pid(int, pid_t peer_pid); int shbuf_allow_pid(int, pid_t peer_pid);
void* shbuf_get(int shbuf_id, size_t* size); void* shbuf_get(int shbuf_id, size_t* size);
int shbuf_release(int shbuf_id); int shbuf_release(int shbuf_id);
int shbuf_seal(int shbuf_id);
int module_load(const char* path, size_t path_length); int module_load(const char* path, size_t path_length);
int module_unload(const char* name, size_t name_length); int module_unload(const char* name, size_t name_length);