foo
This commit is contained in:
+13
-11
@@ -1,8 +1,8 @@
|
||||
#include <zinnia/spin.h>
|
||||
#include <zinnia/string.h>
|
||||
#include <zinnia/syscall.h>
|
||||
#include <zinnia/usercopy.h>
|
||||
#include <config.h>
|
||||
#include <zinnia/string.h>
|
||||
#include <uapi/utsname.h>
|
||||
|
||||
static struct spinlock uname_lock = {};
|
||||
@@ -13,9 +13,10 @@ static struct __utsname uname_buf = {
|
||||
.version = CONFIG_KERNEL_FLAVOR,
|
||||
.nodename = "localhost",
|
||||
.machine = ZINNIA_ARCH,
|
||||
.domainname = "none",
|
||||
};
|
||||
|
||||
struct syscall_ret sys_setuname(__user const struct __utsname* ptr) {
|
||||
struct syscall_ret sys_setuname(const __user struct __utsname* ptr) {
|
||||
struct syscall_ret ret = {};
|
||||
|
||||
if (!ptr) {
|
||||
@@ -33,11 +34,12 @@ struct syscall_ret sys_setuname(__user const struct __utsname* ptr) {
|
||||
|
||||
spin_lock(&uname_lock);
|
||||
|
||||
strncpy(uname_buf.sysname, read_buf.sysname, sizeof(uname_buf.sysname));
|
||||
strncpy(uname_buf.release, read_buf.release, sizeof(uname_buf.release));
|
||||
strncpy(uname_buf.version, read_buf.version, sizeof(uname_buf.version));
|
||||
strncpy(uname_buf.nodename, read_buf.nodename, sizeof(uname_buf.nodename));
|
||||
strncpy(uname_buf.machine, read_buf.machine, sizeof(uname_buf.machine));
|
||||
strncpy(uname_buf.sysname, read_buf.sysname, sizeof(uname_buf.sysname) - 1);
|
||||
strncpy(uname_buf.release, read_buf.release, sizeof(uname_buf.release) - 1);
|
||||
strncpy(uname_buf.version, read_buf.version, sizeof(uname_buf.version) - 1);
|
||||
strncpy(uname_buf.nodename, read_buf.nodename, sizeof(uname_buf.nodename) - 1);
|
||||
strncpy(uname_buf.machine, read_buf.machine, sizeof(uname_buf.machine) - 1);
|
||||
strncpy(uname_buf.domainname, read_buf.domainname, sizeof(uname_buf.domainname) - 1);
|
||||
|
||||
spin_unlock(&uname_lock);
|
||||
|
||||
@@ -53,11 +55,11 @@ struct syscall_ret sys_getuname(__user struct __utsname* ptr) {
|
||||
}
|
||||
|
||||
spin_lock(&uname_lock);
|
||||
|
||||
if (!usercopy_write(ptr, &uname_buf, sizeof(uname_buf)))
|
||||
ret.errno = EFAULT;
|
||||
|
||||
struct __utsname write_buf = uname_buf;
|
||||
spin_unlock(&uname_lock);
|
||||
|
||||
if (!usercopy_write(ptr, &write_buf, sizeof(write_buf)))
|
||||
ret.errno = EFAULT;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user