diff options
Diffstat (limited to 'debian/patches')
3 files changed, 233 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series index 51f5d2f8..5acb1734 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -48,3 +48,5 @@ crash0001-xxx-crash-logging-works.patch fixes0001-utils-settrans-implement-active-translator-stacking.patch fixes0002-Avoid-superfluous-locking-of-node.patch fixes0003-fstests-new-micro-benchmark.patch +startup0001-Unify-and-document-the-way-fsids-are-handled-in-triv.patch +startup0002-startup-implement-bits-of-the-fs-and-io-protocols.patch diff --git a/debian/patches/startup0001-Unify-and-document-the-way-fsids-are-handled-in-triv.patch b/debian/patches/startup0001-Unify-and-document-the-way-fsids-are-handled-in-triv.patch new file mode 100644 index 00000000..78571584 --- /dev/null +++ b/debian/patches/startup0001-Unify-and-document-the-way-fsids-are-handled-in-triv.patch @@ -0,0 +1,88 @@ +From 7c31427a144e98941620a55b225a8452e4b5985b Mon Sep 17 00:00:00 2001 +From: Justus Winter <justus@gnupg.org> +Date: Tue, 26 Apr 2016 15:43:26 +0200 +Subject: [PATCH hurd 1/2] Unify and document the way fsids are handled in + trivfs translators + +* doc/hurd.texi: Clarify what happens if 'trivfs_fsid' is zero. +* login/utmp.c: Leave 'trivfs_fsid' at zero. +* pfinet/main.c: Likewise. +* trans/ifsock.c: Likewise. +* trans/proxy-defpager.c: Likewise. +--- + doc/hurd.texi | 4 +++- + login/utmp.c | 2 +- + pfinet/main.c | 1 - + trans/ifsock.c | 2 +- + trans/proxy-defpager.c | 2 -- + 5 files changed, 5 insertions(+), 6 deletions(-) + +diff --git a/doc/hurd.texi b/doc/hurd.texi +index 525bfa7..2bcf561 100644 +--- a/doc/hurd.texi ++++ b/doc/hurd.texi +@@ -2284,7 +2284,9 @@ and functions: + @deftypevarx {extern int} trivfs_fsid + These variables are returned in the @var{st_fstype} and @var{st_fsid} + fields of @code{struct stat}. @var{trivfs_fstype} should be chosen +-from the @code{FSTYPE_*} constants found in @code{<hurd/hurd_types.h>}. ++from the @code{FSTYPE_*} constants found in ++@code{<hurd/hurd_types.h>}. If @code{trivfs_fsid} is zero, trivfs ++will use the pid of the translator instead. + @end deftypevar + + @deftypevar {extern int} trivfs_allow_open +diff --git a/login/utmp.c b/login/utmp.c +index c7c1ac0..f366d44 100644 +--- a/login/utmp.c ++++ b/login/utmp.c +@@ -364,7 +364,7 @@ S_login_get_login_collection(file_t utmp, int *pid) + #define PT_PROC 2 /* Our process handle. */ + + int trivfs_fstype = FSTYPE_MISC; +-int trivfs_fsid = 0; /* ??? */ ++int trivfs_fsid = 0; + + int trivfs_support_read = 0; + int trivfs_support_write = 0; +diff --git a/pfinet/main.c b/pfinet/main.c +index 4bfa318..5e4b749 100644 +--- a/pfinet/main.c ++++ b/pfinet/main.c +@@ -283,7 +283,6 @@ main (int argc, + pfinet_bucket = ports_create_bucket (); + addrport_class = ports_create_class (clean_addrport, 0); + socketport_class = ports_create_class (clean_socketport, 0); +- trivfs_fsid = getpid (); + mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, + &fsys_identity); + +diff --git a/trans/ifsock.c b/trans/ifsock.c +index 13a2133..908fe13 100644 +--- a/trans/ifsock.c ++++ b/trans/ifsock.c +@@ -51,7 +51,7 @@ struct port_class *node_class; + struct port_bucket *port_bucket; + + int trivfs_fstype = FSTYPE_IFSOCK; +-int trivfs_fsid = 0; /* ??? */ ++int trivfs_fsid = 0; + + int trivfs_support_read = 0; + int trivfs_support_write = 0; +diff --git a/trans/proxy-defpager.c b/trans/proxy-defpager.c +index 9a8436a..e2b15ea 100644 +--- a/trans/proxy-defpager.c ++++ b/trans/proxy-defpager.c +@@ -286,8 +286,6 @@ main (int argc, char **argv) + if (bootstrap == MACH_PORT_NULL) + error (1, 0, "Must be started as a translator"); + +- trivfs_fsid = getpid (); +- + err = trivfs_add_protid_port_class (&trivfs_protid_class); + if (err) + error (1, 0, "error creating protid port class"); +-- +2.1.4 + diff --git a/debian/patches/startup0002-startup-implement-bits-of-the-fs-and-io-protocols.patch b/debian/patches/startup0002-startup-implement-bits-of-the-fs-and-io-protocols.patch new file mode 100644 index 00000000..44a93d2d --- /dev/null +++ b/debian/patches/startup0002-startup-implement-bits-of-the-fs-and-io-protocols.patch @@ -0,0 +1,143 @@ +From 68f7f0c06adfc6b93933073040d7d3380dedd336 Mon Sep 17 00:00:00 2001 +From: Justus Winter <justus@gnupg.org> +Date: Sat, 23 Apr 2016 17:52:33 +0200 +Subject: [PATCH hurd 2/2] startup: implement bits of the fs and io protocols + +* startup/Makefile: Build fs and io server with default +implementations. +(mung_msg_S.h): Tune regexp only to match the include guard. +* startup/startup.c (demuxer): Add new protocols. Nicer implementation. +(S_file_check_access): New function. +(S_io_restrict_auth): Likewise. +--- + startup/Makefile | 6 +++-- + startup/startup.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++------- + 2 files changed, 67 insertions(+), 11 deletions(-) + +diff --git a/startup/Makefile b/startup/Makefile +index ee2ecdd5..db062ad 100644 +--- a/startup/Makefile ++++ b/startup/Makefile +@@ -21,15 +21,17 @@ makemode := server + SRCS = startup.c + OBJS = $(SRCS:.c=.o) \ + startupServer.o notifyServer.o startup_replyUser.o msgServer.o \ +- startup_notifyUser.o fsysServer.o ++ startup_notifyUser.o fsysServer.o fsServer.o ioServer.o + target = startup + HURDLIBS = shouldbeinlibc + + # startup does not use libports. Disable the default payload to port + # conversion. + MIGSFLAGS="-DHURD_DEFAULT_PAYLOAD_TO_PORT=1" ++fsServer-CFLAGS="-DMIG_EOPNOTSUPP=EOPNOTSUPP" ++ioServer-CFLAGS="-DMIG_EOPNOTSUPP=EOPNOTSUPP" + + include ../Makeconf + + mung_msg_S.h: msg_S.h +- sed 's/msg_server/mung_msg_server/' < $< > $@ ++ sed 's/_msg_server/_mung_msg_server/' < $< > $@ +diff --git a/startup/startup.c b/startup/startup.c +index 9c45f4b..d7544f2 100644 +--- a/startup/startup.c ++++ b/startup/startup.c +@@ -51,12 +51,16 @@ + #include <version.h> + #include <argp.h> + #include <pids.h> ++#include <idvec.h> + + #include "startup_notify_U.h" + #include "startup_reply_U.h" + #include "startup_S.h" + #include "notify_S.h" + #include "mung_msg_S.h" ++#include "fsys_S.h" ++#include "fs_S.h" ++#include "io_S.h" + + /* host_reboot flags for when we crash. */ + static int crash_flags = RB_AUTOBOOT; +@@ -502,15 +506,19 @@ static int + demuxer (mach_msg_header_t *inp, + mach_msg_header_t *outp) + { +- extern int notify_server (mach_msg_header_t *, mach_msg_header_t *); +- extern int startup_server (mach_msg_header_t *, mach_msg_header_t *); +- extern int msg_server (mach_msg_header_t *, mach_msg_header_t *); +- extern int fsys_server (mach_msg_header_t *, mach_msg_header_t *); +- +- return (notify_server (inp, outp) || +- msg_server (inp, outp) || +- fsys_server (inp, outp) || +- startup_server (inp, outp)); ++ mig_routine_t routine; ++ if ((routine = notify_server_routine (inp)) || ++ (routine = msg_server_routine (inp)) || ++ (routine = fsys_server_routine (inp)) || ++ (routine = fs_server_routine (inp)) || ++ (routine = io_server_routine (inp)) || ++ (routine = startup_server_routine (inp))) ++ { ++ (*routine) (inp, outp); ++ return TRUE; ++ } ++ else ++ return FALSE; + } + + error_t +@@ -1703,3 +1711,49 @@ S_fsys_forward (mach_port_t server, mach_port_t requestor, + { + return EOPNOTSUPP; + } ++ ++error_t ++S_file_check_access (mach_port_t server, ++ int *allowed) ++{ ++ if (server != startup) ++ return EOPNOTSUPP; ++ *allowed = 0; ++ return 0; ++} ++ ++error_t ++S_io_stat (mach_port_t server, ++ struct stat *st) ++{ ++ if (server != startup) ++ return EOPNOTSUPP; ++ ++ memset (st, 0, sizeof *st); ++ ++ st->st_fstype = FSTYPE_MISC; ++ st->st_fsid = getpid(); ++ st->st_mode = S_IFCHR | S_IROOT; ++ ++ return 0; ++} ++ ++error_t ++S_io_restrict_auth (mach_port_t server, ++ mach_port_t *newport, ++ mach_msg_type_name_t *newporttype, ++ uid_t *uids, size_t nuids, ++ uid_t *gids, size_t ngids) ++{ ++ struct idvec user = { uids, (unsigned) nuids, (unsigned) nuids }; ++ ++ if (server != startup) ++ return EOPNOTSUPP; ++ ++ if (! idvec_contains (&user, 0)) ++ return EPERM; ++ ++ *newport = server; ++ *newporttype = MACH_MSG_TYPE_COPY_SEND; ++ return 0; ++} +-- +2.1.4 + |