@@ -8200,6 +8200,47 @@ IMPL(mknodat)
}
#endif
+IMPL(mount)
+{
+ char *p1 = NULL, *p2, *p3 = NULL;
+ abi_long ret = -TARGET_EFAULT;
+
+ if (arg1) {
+ p1 = lock_user_string(arg1);
+ if (!p1) {
+ goto exit1;
+ }
+ }
+ p2 = lock_user_string(arg2);
+ if (!p2) {
+ goto exit2;
+ }
+ if (arg3) {
+ p3 = lock_user_string(arg3);
+ if (!p3) {
+ goto exit3;
+ }
+ }
+
+ /* FIXME - arg5 should be locked, but it isn't clear how to do that
+ * since it's not guaranteed to be a NULL-terminated string.
+ */
+ ret = mount(p1, p2, p3, (unsigned long)arg4, arg5 ? g2h(arg5) : NULL);
+ ret = get_errno(ret);
+
+ if (arg3) {
+ unlock_user(p3, arg3, 0);
+ }
+ exit3:
+ unlock_user(p2, arg2, 0);
+ exit2:
+ if (arg1) {
+ unlock_user(p1, arg1, 0);
+ }
+ exit1:
+ return ret;
+}
+
#if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE)
IMPL(name_to_handle_at)
{
@@ -8373,6 +8414,21 @@ IMPL(time)
}
#endif
+#ifdef TARGET_NR_umount
+IMPL(umount)
+{
+ char *p = lock_user_string(arg1);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(umount(p));
+ unlock_user(p, arg1, 0);
+ return ret;
+}
+#endif
+
#ifdef TARGET_NR_unlink
IMPL(unlink)
{
@@ -8483,69 +8539,6 @@ IMPL(everything_else)
char *fn;
switch(num) {
- case TARGET_NR_mount:
- {
- /* need to look at the data field */
- void *p2, *p3;
-
- if (arg1) {
- p = lock_user_string(arg1);
- if (!p) {
- return -TARGET_EFAULT;
- }
- } else {
- p = NULL;
- }
-
- p2 = lock_user_string(arg2);
- if (!p2) {
- if (arg1) {
- unlock_user(p, arg1, 0);
- }
- return -TARGET_EFAULT;
- }
-
- if (arg3) {
- p3 = lock_user_string(arg3);
- if (!p3) {
- if (arg1) {
- unlock_user(p, arg1, 0);
- }
- unlock_user(p2, arg2, 0);
- return -TARGET_EFAULT;
- }
- } else {
- p3 = NULL;
- }
-
- /* FIXME - arg5 should be locked, but it isn't clear how to
- * do that since it's not guaranteed to be a NULL-terminated
- * string.
- */
- if (!arg5) {
- ret = mount(p, p2, p3, (unsigned long)arg4, NULL);
- } else {
- ret = mount(p, p2, p3, (unsigned long)arg4, g2h(arg5));
- }
- ret = get_errno(ret);
-
- if (arg1) {
- unlock_user(p, arg1, 0);
- }
- unlock_user(p2, arg2, 0);
- if (arg3) {
- unlock_user(p3, arg3, 0);
- }
- }
- return ret;
-#ifdef TARGET_NR_umount
- case TARGET_NR_umount:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(umount(p));
- unlock_user(p, arg1, 0);
- return ret;
-#endif
#ifdef TARGET_NR_stime /* not on alpha */
case TARGET_NR_stime:
{
@@ -12896,6 +12889,7 @@ static impl_fn * const syscall_table[] = {
#ifdef TARGET_NR_mknodat
[TARGET_NR_mknodat] = impl_mknodat,
#endif
+ [TARGET_NR_mount] = impl_mount,
#if defined(TARGET_NR_name_to_handle_at) && defined(CONFIG_OPEN_BY_HANDLE)
[TARGET_NR_name_to_handle_at] = impl_name_to_handle_at,
#endif
@@ -12910,6 +12904,9 @@ static impl_fn * const syscall_table[] = {
#ifdef TARGET_NR_time
[TARGET_NR_time] = impl_time,
#endif
+#ifdef TARGET_NR_umount
+ [TARGET_NR_umount] = impl_umount,
+#endif
#ifdef TARGET_NR_unlink
[TARGET_NR_unlink] = impl_unlink,
#endif
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall.c | 123 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 63 deletions(-) -- 2.17.0