diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-01-18 16:15:03 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-01-18 16:15:03 +0100 |
commit | afc4e00b7204a5729407b0388ae62e9719adba97 (patch) | |
tree | d8d9d168cfad66625a9da59efd42a6c2503224d1 /debian/patches | |
parent | 2f1d122476d8f948db6b99bad8a7a3918e940019 (diff) |
add fix-receiver-lookups.patch
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/fix-receiver-lookups.patch | 218 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 219 insertions, 0 deletions
diff --git a/debian/patches/fix-receiver-lookups.patch b/debian/patches/fix-receiver-lookups.patch new file mode 100644 index 00000000..adc9e974 --- /dev/null +++ b/debian/patches/fix-receiver-lookups.patch @@ -0,0 +1,218 @@ +diff --git a/proc/mgt.c b/proc/mgt.c +index 602ba84..5e0accd 100644 +--- a/proc/mgt.c ++++ b/proc/mgt.c +@@ -417,7 +417,7 @@ S_proc_handle_exceptions (struct proc *p, + the thread_set_state requested by proc_handle_exceptions and then + send an exception_raise message as requested. */ + kern_return_t +-S_proc_exception_raise (mach_port_t excport, ++S_proc_exception_raise (struct exc *e, + mach_port_t reply, + mach_msg_type_name_t reply_type, + mach_port_t thread, +@@ -428,8 +428,7 @@ S_proc_exception_raise (mach_port_t excport, + { + error_t err; + struct proc *p; +- struct exc *e = ports_lookup_port (proc_bucket, excport, exc_class); +- if (!e) ++ if (!e || e->pi.bucket != proc_bucket || e->pi.class != exc_class) + return EOPNOTSUPP; + + p = task_find (task); +@@ -455,7 +454,6 @@ S_proc_exception_raise (mach_port_t excport, + the faulting thread's state to run its recovery code, which should + dequeue that message. */ + err = thread_set_state (thread, e->flavor, e->thread_state, e->statecnt); +- ports_port_deref (e); + mach_port_deallocate (mach_task_self (), thread); + mach_port_deallocate (mach_task_self (), task); + if (err) +@@ -484,7 +482,6 @@ S_proc_exception_raise (mach_port_t excport, + /* Nuke the task; we will get a notification message and report that + it died with SIGNO. */ + task_terminate (task); +- ports_port_deref (e); + + /* In the MACH_SEND_NOTIFY_IN_PROGRESS case, the kernel did a + pseudo-receive of the RPC request message that may have added user +diff --git a/proc/mig-decls.h b/proc/mig-decls.h +new file mode 100644 +index 0000000..0d5bd4d +--- /dev/null ++++ b/proc/mig-decls.h +@@ -0,0 +1,42 @@ ++/* Translation functions for mig. ++ ++ Copyright (C) 2013 Free Software Foundation, Inc. ++ ++ Written by Justus Winter <4winter@informatik.uni-hamburg.de> ++ ++ This file is part of the GNU Hurd. ++ ++ The GNU Hurd is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ The GNU Hurd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ ++ ++#ifndef __MIG_DECLS_H__ ++#define __MIG_DECLS_H__ ++ ++#include "proc.h" ++ ++typedef struct exc* exc_t; ++ ++static inline exc_t __attribute__ ((unused)) ++begin_using_exc_port (mach_port_t port) ++{ ++ return ports_lookup_port (NULL, port, exc_class); ++} ++ ++static inline void __attribute__ ((unused)) ++end_using_exc (exc_t exc) ++{ ++ if (exc != NULL) ++ ports_port_deref (exc); ++} ++ ++#endif +diff --git a/proc/proc_exc.defs b/proc/proc_exc.defs +index e9c58f1..c910824 100644 +--- a/proc/proc_exc.defs ++++ b/proc/proc_exc.defs +@@ -33,9 +33,15 @@ subsystem proc_exc 2400; + #include <mach/std_types.defs> + + ServerPrefix S_; ++import "mig-decls.h"; ++ ++type exception_t = mach_port_copy_send_t ++ cusertype: mach_port_t ++ intran: exc_t begin_using_exc_port (exception_t) ++ destructor: end_using_exc (exc_t); + + routine proc_exception_raise ( +- exception_port: mach_port_t; ++ exception_port: exception_t; + replyport reply: mach_port_poly_t; + msgoption flags: integer_t; + thread: mach_port_t; +diff --git a/trans/Makefile b/trans/Makefile +index 291df2f..c0386d0 100644 +--- a/trans/Makefile ++++ b/trans/Makefile +@@ -1,6 +1,6 @@ + # + # Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2006, 2007, +-# 2008 Free Software Foundation, Inc. ++# 2008, 2013 Free Software Foundation, Inc. + # + # This program is free software; you can redistribute it and/or + # modify it under the terms of the GNU General Public License as +@@ -32,6 +32,10 @@ OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o passwordServer.o \ + HURDLIBS = ports netfs trivfs iohelp fshelp pipe ihash shouldbeinlibc + LDLIBS += -lpthread + password-LDLIBS = $(LIBCRYPT) ++password-MIGSFLAGS=\ ++ "-DIO_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \ ++ "-DIO_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \ ++ "-DPASSWORD_IMPORTS=import <hurd/trivfs.h>;" + + include ../Makeconf + +diff --git a/trans/password.c b/trans/password.c +index 6f15a9e..344b78b 100644 +--- a/trans/password.c ++++ b/trans/password.c +@@ -1,5 +1,5 @@ + /* Hurd standard password server. +- Copyright (C) 1999 Free Software Foundation ++ Copyright (C) 1999, 2013 Free Software Foundation + Written by Mark Kettenis. + + The GNU Hurd is free software; you can redistribute it and/or +@@ -135,10 +135,9 @@ trivfs_goaway (struct trivfs_control *fsys, int flags) + + /* Implement password_check_user as described in <hurd/password.defs>. */ + kern_return_t +-S_password_check_user (io_t server, uid_t user, char *pw, ++S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw, + mach_port_t *port, mach_msg_type_name_t *port_type) + { +- struct trivfs_protid *cred; + struct ugids ugids = UGIDS_INIT; + auth_t auth; + error_t err; +@@ -150,10 +149,16 @@ S_password_check_user (io_t server, uid_t user, char *pw, + return strdup (pw); + } + +- cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]); + if (! cred) + return EOPNOTSUPP; + ++ if (cred->pi.bucket != port_bucket || ++ cred->pi.class != trivfs_protid_portclasses[0]) ++ { ++ ports_port_deref (cred); ++ return EOPNOTSUPP; ++ } ++ + /* Verify password. */ + err = ugids_add_user (&ugids, user, 1); + if (!err) +@@ -173,17 +178,14 @@ S_password_check_user (io_t server, uid_t user, char *pw, + } + + ugids_fini (&ugids); +- +- ports_port_deref (cred); + return err; + } + + /* Implement password_check_group as described in <hurd/password.defs>. */ + kern_return_t +-S_password_check_group (io_t server, uid_t group, char *pw, ++S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw, + mach_port_t *port, mach_msg_type_name_t *port_type) + { +- struct trivfs_protid *cred; + struct ugids ugids = UGIDS_INIT; + auth_t auth; + error_t err; +@@ -195,10 +197,16 @@ S_password_check_group (io_t server, uid_t group, char *pw, + return strdup (pw); + } + +- cred = ports_lookup_port (port_bucket, server, trivfs_protid_portclasses[0]); + if (! cred) + return EOPNOTSUPP; +- ++ ++ if (cred->pi.bucket != port_bucket || ++ cred->pi.class != trivfs_protid_portclasses[0]) ++ { ++ ports_port_deref (cred); ++ return EOPNOTSUPP; ++ } ++ + /* Verify password. */ + err = ugids_add_gid (&ugids, group, 1); + if (!err) +@@ -218,7 +226,5 @@ S_password_check_group (io_t server, uid_t group, char *pw, + } + + ugids_fini (&ugids); +- +- ports_port_deref (cred); + return err; + } diff --git a/debian/patches/series b/debian/patches/series index e52ac2eb..1ef1db0f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,3 +45,4 @@ proc_set_init_task.patch newRPC.patch revert-remove-threadvars-hack.patch xkb-compat.patch +fix-receiver-lookups.patch |