diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-02 00:29:37 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-02 00:29:37 +0100 |
commit | df1a438eae4acd80c9a9ac8cfcf596ff21adef1c (patch) | |
tree | a9bf557001bfaddf46da6fdc49293b0d02715718 /debian/patches | |
parent | 370e931feb0f74481b30236a11e8de95f2cba8d6 (diff) |
add patch series
Diffstat (limited to 'debian/patches')
30 files changed, 3132 insertions, 0 deletions
diff --git a/debian/patches/0001-libports-add-ports_lookup_payload-and-ports_payload_.patch b/debian/patches/0001-libports-add-ports_lookup_payload-and-ports_payload_.patch new file mode 100644 index 00000000..71d0b602 --- /dev/null +++ b/debian/patches/0001-libports-add-ports_lookup_payload-and-ports_payload_.patch @@ -0,0 +1,137 @@ +From 580b142c1e0c76195888f4a1101ee831e7f986be Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 23 Nov 2013 16:19:08 +0100 +Subject: [PATCH hurd 01/29] libports: add `ports_lookup_payload' and + `ports_payload_get_name' + +These two functions map payloads to objects and port names. The former +can be used like `ports_lookup_port' to look up objects, the latter to +map payloads to port names if the server function expects a +`mach_port_t'. + +* libports/ports.h: Add function ports_payload_get_name. +* libports/lookup-payload.c: New file. +* libports/ports.h (ports_lookup_payload): Add declaration. +* libports/Makefile (SRCS): Add lookup-payload.c. +--- + libports/Makefile | 2 +- + libports/extern-inline.c | 22 ++++++++++++++++++++ + libports/ports.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 76 insertions(+), 1 deletion(-) + create mode 100644 libports/extern-inline.c + +diff --git a/libports/Makefile b/libports/Makefile +index 30da1c1..f49cb9f 100644 +--- a/libports/Makefile ++++ b/libports/Makefile +@@ -36,7 +36,7 @@ SRCS = create-bucket.c create-class.c \ + interrupt-operation.c interrupt-on-notify.c interrupt-notified-rpcs.c \ + dead-name.c create-port.c import-port.c default-uninhibitable-rpcs.c \ + claim-right.c transfer-right.c create-port-noinstall.c create-internal.c \ +- interrupted.c ++ interrupted.c extern-inline.c + + installhdrs = ports.h + +diff --git a/libports/extern-inline.c b/libports/extern-inline.c +new file mode 100644 +index 0000000..fbc9e53 +--- /dev/null ++++ b/libports/extern-inline.c +@@ -0,0 +1,22 @@ ++/* Run time callable functions for extern inlines. ++ Copyright (C) 2014 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/>. */ ++ ++#define PORTS_DEFINE_EI ++#include "ports.h" +diff --git a/libports/ports.h b/libports/ports.h +index 652edb8..a625b47 100644 +--- a/libports/ports.h ++++ b/libports/ports.h +@@ -29,6 +29,12 @@ + #include <pthread.h> + #include <refcount.h> + ++#ifdef PORTS_DEFINE_EI ++#define PORTS_EI ++#else ++#define PORTS_EI __extern_inline ++#endif ++ + /* These are global values for common flags used in the various structures. + Not all of these are meaningful in all flag fields. */ + #define PORTS_INHIBITED 0x0100 /* block RPC's */ +@@ -234,6 +240,53 @@ mach_port_t ports_get_send_right (void *port); + void *ports_lookup_port (struct port_bucket *bucket, + mach_port_t port, struct port_class *class); + ++/* Like ports_lookup_port, but uses PAYLOAD to look up the object. If ++ this function is used, PAYLOAD must be a pointer to the port ++ structure. */ ++extern void *ports_lookup_payload (struct port_bucket *bucket, ++ unsigned long payload, ++ struct port_class *class); ++ ++/* This returns the ports name. This function can be used as ++ intranpayload function turning payloads back into port names. If ++ this function is used, PAYLOAD must be a pointer to the port ++ structure. */ ++extern mach_port_t ports_payload_get_name (unsigned int payload); ++ ++#if defined(__USE_EXTERN_INLINES) || defined(PORTS_DEFINE_EI) ++ ++PORTS_EI void * ++ports_lookup_payload (struct port_bucket *bucket, ++ unsigned long payload, ++ struct port_class *class) ++{ ++ struct port_info *pi = (struct port_info *) payload; ++ ++ if (pi && bucket && pi->bucket != bucket) ++ pi = NULL; ++ ++ if (pi && class && pi->class != class) ++ pi = NULL; ++ ++ if (pi) ++ refcounts_unsafe_ref (&pi->refcounts, NULL); ++ ++ return pi; ++} ++ ++PORTS_EI mach_port_t ++ports_payload_get_name (unsigned int payload) ++{ ++ struct port_info *pi = (struct port_info *) payload; ++ ++ if (pi) ++ return pi->port_right; ++ ++ return MACH_PORT_NULL; ++} ++ ++#endif /* Use extern inlines. */ ++ + /* Allocate another reference to PORT. */ + void ports_port_ref (void *port); + +-- +2.1.3 + diff --git a/debian/patches/0002-libports-add-a-payload-aware-intrans-function.patch b/debian/patches/0002-libports-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..8b961144 --- /dev/null +++ b/debian/patches/0002-libports-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,54 @@ +From 466bacfa2728a9b164196d002a5c49d644ef9c95 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 8 Apr 2014 23:40:26 +0200 +Subject: [PATCH hurd 02/29] libports: add a payload-aware intrans function + +* libports/mig-decls.h (begin_using_port_info_payload): New function. +* libports/mig-mutate.h: Add mutator. +--- + libports/mig-decls.h | 6 ++++++ + libports/mig-mutate.h | 4 ++++ + 2 files changed, 10 insertions(+) + +diff --git a/libports/mig-decls.h b/libports/mig-decls.h +index f8c4f15..c88ff26 100644 +--- a/libports/mig-decls.h ++++ b/libports/mig-decls.h +@@ -30,6 +30,12 @@ begin_using_port_info_port (mach_port_t port) + return ports_lookup_port (0, port, 0); + } + ++static inline struct port_info * __attribute__ ((unused)) ++begin_using_port_info_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (0, payload, 0); ++} ++ + static inline void __attribute__ ((unused)) + end_using_port_info (struct port_info *p) + { +diff --git a/libports/mig-mutate.h b/libports/mig-mutate.h +index 4c011b6..1c96fea 100644 +--- a/libports/mig-mutate.h ++++ b/libports/mig-mutate.h +@@ -19,6 +19,8 @@ + + #define NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) ++#define NOTIFY_INTRAN_PAYLOAD \ ++ port_info_t begin_using_port_info_payload + #define NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) + #define NOTIFY_IMPORTS \ +@@ -26,6 +28,8 @@ + + #define INTERRUPT_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) ++#define INTERRUPT_INTRAN_PAYLOAD \ ++ port_info_t begin_using_port_info_payload + #define INTERRUPT_DESTRUCTOR \ + end_using_port_info (port_info_t) + #define INTERRUPT_IMPORTS \ +-- +2.1.3 + diff --git a/debian/patches/0003-libdiskfs-add-payload-aware-intrans-functions.patch b/debian/patches/0003-libdiskfs-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..50e99b33 --- /dev/null +++ b/debian/patches/0003-libdiskfs-add-payload-aware-intrans-functions.patch @@ -0,0 +1,109 @@ +From 23c08045d7afca712d0a22f5663e7e74cc420345 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 10:43:18 +0100 +Subject: [PATCH hurd 03/29] libdiskfs: add payload-aware intrans functions + +* libdiskfs/diskfs.h (diskfs_begin_using_protid_payload): New function. +(diskfs_begin_using_control_payload): Likewise. +(diskfs_begin_using_bootinfo_payload): Likewise. +* libdiskfs/fsmutations.h: Add mutators. +--- + libdiskfs/diskfs.h | 29 +++++++++++++++++++++++++++++ + libdiskfs/fsmutations.h | 5 +++++ + 2 files changed, 34 insertions(+) + +diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h +index e59ba99..2818225 100644 +--- a/libdiskfs/diskfs.h ++++ b/libdiskfs/diskfs.h +@@ -833,8 +833,14 @@ error_t diskfs_start_protid (struct peropen *po, struct protid **cred); + void diskfs_finish_protid (struct protid *cred, struct iouser *user); + + extern struct protid * diskfs_begin_using_protid_port (file_t port); ++extern struct protid * ++diskfs_begin_using_protid_payload (unsigned long payload); + extern struct diskfs_control * diskfs_begin_using_control_port (fsys_t port); ++extern struct diskfs_control * ++diskfs_begin_using_control_port_payload (unsigned long payload); + extern struct bootinfo *diskfs_begin_using_bootinfo_port (exec_startup_t port); ++struct bootinfo * ++diskfs_begin_using_bootinfo_payload (unsigned long payload); + + extern void diskfs_end_using_protid_port (struct protid *cred); + extern void diskfs_end_using_control_port (struct diskfs_control *cred); +@@ -851,6 +857,14 @@ diskfs_begin_using_protid_port (file_t port) + return ports_lookup_port (diskfs_port_bucket, port, diskfs_protid_class); + } + ++DISKFS_EXTERN_INLINE struct protid * ++diskfs_begin_using_protid_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (diskfs_port_bucket, ++ payload, ++ diskfs_protid_class); ++} ++ + /* And for the fsys interface. */ + DISKFS_EXTERN_INLINE struct diskfs_control * + diskfs_begin_using_control_port (fsys_t port) +@@ -858,6 +872,14 @@ diskfs_begin_using_control_port (fsys_t port) + return ports_lookup_port (diskfs_port_bucket, port, NULL); + } + ++DISKFS_EXTERN_INLINE struct diskfs_control * ++diskfs_begin_using_control_port_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (diskfs_port_bucket, ++ payload, ++ NULL); ++} ++ + /* And for the exec_startup interface. */ + DISKFS_EXTERN_INLINE struct bootinfo * + diskfs_begin_using_bootinfo_port (exec_startup_t port) +@@ -865,6 +887,13 @@ diskfs_begin_using_bootinfo_port (exec_startup_t port) + return ports_lookup_port (diskfs_port_bucket, port, diskfs_execboot_class); + } + ++DISKFS_EXTERN_INLINE struct bootinfo * ++diskfs_begin_using_bootinfo_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (diskfs_port_bucket, ++ payload, ++ diskfs_execboot_class); ++} + + /* Called by MiG after server routines have been run; this + balances begin_using_protid_port, and is arranged for the io +diff --git a/libdiskfs/fsmutations.h b/libdiskfs/fsmutations.h +index 3f9362b..c2167c6 100644 +--- a/libdiskfs/fsmutations.h ++++ b/libdiskfs/fsmutations.h +@@ -18,12 +18,15 @@ + /* Only CPP macro definitions should go in this file. */ + + #define FILE_INTRAN protid_t diskfs_begin_using_protid_port (file_t) ++#define FILE_INTRAN_PAYLOAD protid_t diskfs_begin_using_protid_payload + #define FILE_DESTRUCTOR diskfs_end_using_protid_port (protid_t) + + #define IO_INTRAN protid_t diskfs_begin_using_protid_port (io_t) ++#define IO_INTRAN_PAYLOAD protid_t diskfs_begin_using_protid_payload + #define IO_DESTRUCTOR diskfs_end_using_protid_port (protid_t) + + #define FSYS_INTRAN control_t diskfs_begin_using_control_port (fsys_t) ++#define FSYS_INTRAN_PAYLOAD control_t diskfs_begin_using_control_port_payload + #define FSYS_DESTRUCTOR diskfs_end_using_control_port (control_t) + + #define FILE_IMPORTS import "libdiskfs/priv.h"; +@@ -33,6 +36,8 @@ + + #define EXEC_STARTUP_INTRAN \ + bootinfo_t diskfs_begin_using_bootinfo_port (exec_startup_t) ++#define EXEC_STARTUP_INTRAN_PAYLOAD \ ++ bootinfo_t diskfs_begin_using_bootinfo_payload + #define EXEC_STARTUP_DESTRUCTOR \ + diskfs_end_using_bootinfo (bootinfo_t) + #define EXEC_STARTUP_IMPORTS \ +-- +2.1.3 + diff --git a/debian/patches/0004-libnetfs-add-a-payload-aware-intrans-function.patch b/debian/patches/0004-libnetfs-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..ad44a022 --- /dev/null +++ b/debian/patches/0004-libnetfs-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,52 @@ +From 9a4bee5a8d6726d71002889a9e9d54dc417ce9d6 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 10:45:44 +0100 +Subject: [PATCH hurd 04/29] libnetfs: add a payload-aware intrans function + +* libnetfs/priv.h (begin_using_protid_payload): New function. +* libnetfs/mutations.h: Add mutator. +--- + libnetfs/mutations.h | 3 +++ + libnetfs/priv.h | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/libnetfs/mutations.h b/libnetfs/mutations.h +index e60a220..088d8a0 100644 +--- a/libnetfs/mutations.h ++++ b/libnetfs/mutations.h +@@ -23,12 +23,15 @@ + #define IO_SELECT_REPLY_PORT + + #define FILE_INTRAN protid_t begin_using_protid_port (file_t) ++#define FILE_INTRAN_PAYLOAD protid_t begin_using_protid_payload + #define FILE_DESTRUCTOR end_using_protid_port (protid_t) + + #define IO_INTRAN protid_t begin_using_protid_port (io_t) ++#define IO_INTRAN_PAYLOAD protid_t begin_using_protid_payload + #define IO_DESTRUCTOR end_using_protid_port (protid_t) + + #define FSYS_INTRAN control_t begin_using_control_port (fsys_t) ++#define FSYS_INTRAN_PAYLOAD control_t begin_using_control_payload + #define FSYS_DESTRUCTOR end_using_control_port (control_t) + + #define FILE_IMPORTS import "libnetfs/netfs.h"; import "libnetfs/priv.h"; +diff --git a/libnetfs/priv.h b/libnetfs/priv.h +index ba31080..36c8f53 100644 +--- a/libnetfs/priv.h ++++ b/libnetfs/priv.h +@@ -44,6 +44,12 @@ begin_using_control_port (fsys_t port) + return ports_lookup_port (netfs_port_bucket, port, netfs_control_class); + } + ++static inline struct netfs_control * __attribute__ ((unused)) ++begin_using_control_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (netfs_port_bucket, payload, netfs_control_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_control_port (struct netfs_control *cred) + { +-- +2.1.3 + diff --git a/debian/patches/0005-libtrivfs-add-payload-aware-intrans-functions.patch b/debian/patches/0005-libtrivfs-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..b92a0645 --- /dev/null +++ b/debian/patches/0005-libtrivfs-add-payload-aware-intrans-functions.patch @@ -0,0 +1,113 @@ +From a3f0d8a363f7c872757f99523c737918c369d522 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 11:04:38 +0100 +Subject: [PATCH hurd 05/29] libtrivfs: add payload-aware intrans functions + +* libtrivfs/mig-decls.h (trivfs_begin_using_protid_payload): New function. +(trivfs_begin_using_control_payload): Likewise. +* libtrivfs/mig-mutate.h: Add mutators. +--- + libtrivfs/mig-decls.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ + libtrivfs/mig-mutate.h | 3 +++ + 2 files changed, 61 insertions(+) + +diff --git a/libtrivfs/mig-decls.h b/libtrivfs/mig-decls.h +index 2baaee8..13a9eb7 100644 +--- a/libtrivfs/mig-decls.h ++++ b/libtrivfs/mig-decls.h +@@ -61,6 +61,35 @@ trivfs_begin_using_protid (mach_port_t port) + return ports_lookup_port (0, port, trivfs_dynamic_protid_port_classes[0]); + } + ++static inline struct trivfs_protid * __attribute__ ((unused)) ++trivfs_begin_using_protid_payload (unsigned long payload) ++{ ++ if (trivfs_protid_nportclasses + trivfs_num_dynamic_protid_port_classes > 1) ++ { ++ struct port_info *pi = ports_lookup_payload (NULL, payload, NULL); ++ int i; ++ ++ if (pi) ++ { ++ for (i = 0; i < trivfs_protid_nportclasses; i++) ++ if (pi->class == trivfs_protid_portclasses[i]) ++ return (struct trivfs_protid *) pi; ++ for (i = 0; i < trivfs_num_dynamic_protid_port_classes; i++) ++ if (pi->class == trivfs_dynamic_protid_port_classes[i]) ++ return (struct trivfs_protid *) pi; ++ ports_port_deref (pi); ++ } ++ ++ return NULL; ++ } ++ else if (trivfs_protid_nportclasses == 1) ++ return ports_lookup_payload (NULL, payload, ++ trivfs_protid_portclasses[0]); ++ else ++ return ports_lookup_payload (NULL, payload, ++ trivfs_dynamic_protid_port_classes[0]); ++} ++ + static inline void __attribute__ ((unused)) + trivfs_end_using_protid (struct trivfs_protid *cred) + { +@@ -95,6 +124,35 @@ trivfs_begin_using_control (mach_port_t port) + return ports_lookup_port (0, port, trivfs_dynamic_control_port_classes[0]); + } + ++static inline struct trivfs_control * __attribute__ ((unused)) ++trivfs_begin_using_control_payload (unsigned long payload) ++{ ++ if (trivfs_cntl_nportclasses + trivfs_num_dynamic_control_port_classes > 1) ++ { ++ struct port_info *pi = ports_lookup_payload (NULL, payload, NULL); ++ int i; ++ ++ if (pi) ++ { ++ for (i = 0; i < trivfs_cntl_nportclasses; i++) ++ if (pi->class == trivfs_cntl_portclasses[i]) ++ return (struct trivfs_control *) pi; ++ for (i = 0; i < trivfs_num_dynamic_control_port_classes; i++) ++ if (pi->class == trivfs_dynamic_control_port_classes[i]) ++ return (struct trivfs_control *) pi; ++ ports_port_deref (pi); ++ } ++ ++ return NULL; ++ } ++ else if (trivfs_cntl_nportclasses == 1) ++ return ports_lookup_payload (NULL, payload, ++ trivfs_cntl_portclasses[0]); ++ else ++ return ports_lookup_payload (NULL, payload, ++ trivfs_dynamic_control_port_classes[0]); ++} ++ + static inline void __attribute__ ((unused)) + trivfs_end_using_control (struct trivfs_control *cred) + { +diff --git a/libtrivfs/mig-mutate.h b/libtrivfs/mig-mutate.h +index cc15d38..dcbebf6 100644 +--- a/libtrivfs/mig-mutate.h ++++ b/libtrivfs/mig-mutate.h +@@ -20,13 +20,16 @@ + #define REPLY_PORTS + + #define FILE_INTRAN trivfs_protid_t trivfs_begin_using_protid (file_t) ++#define FILE_INTRAN_PAYLOAD trivfs_protid_t trivfs_begin_using_protid_payload + #define FILE_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t) + #define FILE_IMPORTS import "libtrivfs/mig-decls.h"; + + #define IO_INTRAN trivfs_protid_t trivfs_begin_using_protid (io_t) ++#define IO_INTRAN_PAYLOAD trivfs_protid_t trivfs_begin_using_protid_payload + #define IO_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t) + #define IO_IMPORTS import "libtrivfs/mig-decls.h"; + + #define FSYS_INTRAN trivfs_control_t trivfs_begin_using_control (fsys_t) ++#define FSYS_INTRAN_PAYLOAD trivfs_control_t trivfs_begin_using_control_payload + #define FSYS_DESTRUCTOR trivfs_end_using_control (trivfs_control_t) + #define FSYS_IMPORTS import "libtrivfs/mig-decls.h"; +-- +2.1.3 + diff --git a/debian/patches/0006-libpager-add-a-payload-aware-intrans-function.patch b/debian/patches/0006-libpager-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..de4d15ce --- /dev/null +++ b/debian/patches/0006-libpager-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,51 @@ +From 1cafbbf8d116b131cb41f734d4feb65560ac5034 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 4 Apr 2014 14:19:59 +0200 +Subject: [PATCH hurd 06/29] libpager: add a payload-aware intrans function + +* libpager/mig-decls.h (begin_using_pager_payload): New function. +* libpager/mig-mutate.h: Add mutators. +--- + libpager/mig-decls.h | 6 ++++++ + libpager/mig-mutate.h | 3 +++ + 2 files changed, 9 insertions(+) + +diff --git a/libpager/mig-decls.h b/libpager/mig-decls.h +index 0c7b402..7e6b64f 100644 +--- a/libpager/mig-decls.h ++++ b/libpager/mig-decls.h +@@ -32,6 +32,12 @@ begin_using_pager (mach_port_t port) + return ports_lookup_port (0, port, _pager_class); + } + ++static inline struct pager * __attribute__ ((unused)) ++begin_using_pager_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (0, payload, _pager_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_pager (struct pager *p) + { +diff --git a/libpager/mig-mutate.h b/libpager/mig-mutate.h +index 9e9065f..c4f30ce 100644 +--- a/libpager/mig-mutate.h ++++ b/libpager/mig-mutate.h +@@ -18,11 +18,14 @@ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ + + #define MEMORY_OBJECT_INTRAN pager_t begin_using_pager (memory_object_t) ++#define MEMORY_OBJECT_INTRAN_PAYLOAD pager_t begin_using_pager_payload + #define MEMORY_OBJECT_DESTRUCTOR end_using_pager (pager_t) + #define MEMORY_OBJECT_IMPORTS import "mig-decls.h"; + + #define NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) ++#define NOTIFY_INTRAN_PAYLOAD \ ++ port_info_t begin_using_port_info_payload + #define NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) + #define NOTIFY_IMPORTS \ +-- +2.1.3 + diff --git a/debian/patches/0007-libcons-add-a-payload-aware-intrans-function.patch b/debian/patches/0007-libcons-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..a4bcb303 --- /dev/null +++ b/debian/patches/0007-libcons-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,44 @@ +From e36f31c6aecdc4ac1653b18aa99c23c0bba62e37 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 14:12:25 +0100 +Subject: [PATCH hurd 07/29] libcons: add a payload-aware intrans function + +* libcons/mutations.h: Add mutator. +* libcons/priv.h (begin_using_notify_payload): New function. +--- + libcons/mutations.h | 1 + + libcons/priv.h | 6 ++++++ + 2 files changed, 7 insertions(+) + +diff --git a/libcons/mutations.h b/libcons/mutations.h +index c895447..4751340 100644 +--- a/libcons/mutations.h ++++ b/libcons/mutations.h +@@ -21,6 +21,7 @@ + /* Only CPP macro definitions should go in this file. */ + + #define FS_NOTIFY_INTRAN cons_notify_t begin_using_notify_port (fs_notify_t) ++#define FS_NOTIFY_INTRAN_PAYLOAD cons_notify_t begin_using_notify_payload + #define FS_NOTIFY_DESTRUCTOR end_using_notify_port (cons_notify_t) + + #define FS_NOTIFY_IMPORTS import "priv.h"; +diff --git a/libcons/priv.h b/libcons/priv.h +index 38971ff..6cdf3db 100644 +--- a/libcons/priv.h ++++ b/libcons/priv.h +@@ -80,6 +80,12 @@ begin_using_notify_port (fs_notify_t port) + return ports_lookup_port (cons_port_bucket, port, cons_port_class); + } + ++static inline cons_notify_t ++begin_using_notify_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (cons_port_bucket, payload, cons_port_class); ++} ++ + /* Called by MiG after server routines have been run; this balances + begin_using_notify_port, and is arranged for the fs_notify + interfaces by mutations.h. */ +-- +2.1.3 + diff --git a/debian/patches/0008-auth-add-a-payload-aware-intrans-function.patch b/debian/patches/0008-auth-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..0ac6aa96 --- /dev/null +++ b/debian/patches/0008-auth-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,43 @@ +From 74f2d9a3a4b74b8e4984348d34cb9c920fc86570 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 14:43:31 +0100 +Subject: [PATCH hurd 08/29] auth: add a payload-aware intrans function + +* auth/mig-mutate.h: Add mutator. +* auth/mig-decls.h (auth_payload_to_handle): New function. +--- + auth/mig-decls.h | 6 ++++++ + auth/mig-mutate.h | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/auth/mig-decls.h b/auth/mig-decls.h +index 09c7c70..fa7b06d 100644 +--- a/auth/mig-decls.h ++++ b/auth/mig-decls.h +@@ -32,6 +32,12 @@ auth_port_to_handle (mach_port_t auth) + return ports_lookup_port (auth_bucket, auth, authhandle_portclass); + } + ++static inline struct authhandle * __attribute__ ((unused)) ++auth_payload_to_handle (unsigned long payload) ++{ ++ return ports_lookup_payload (auth_bucket, payload, authhandle_portclass); ++} ++ + static inline void __attribute__ ((unused)) + end_using_authhandle (struct authhandle *auth) + { +diff --git a/auth/mig-mutate.h b/auth/mig-mutate.h +index ea40c70..5cc8914 100644 +--- a/auth/mig-mutate.h ++++ b/auth/mig-mutate.h +@@ -20,5 +20,6 @@ + /* CPP definitions for MiG processing of auth.defs for auth server. */ + + #define AUTH_INTRAN authhandle_t auth_port_to_handle (auth_t) ++#define AUTH_INTRAN_PAYLOAD authhandle_t auth_payload_to_handle + #define AUTH_DESTRUCTOR end_using_authhandle (authhandle_t) + #define AUTH_IMPORTS import "mig-decls.h"; +-- +2.1.3 + diff --git a/debian/patches/0009-console-add-a-payload-aware-intrans-function.patch b/debian/patches/0009-console-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..4b41901d --- /dev/null +++ b/debian/patches/0009-console-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,52 @@ +From 928ba7f02e91f2bc64a8ffa1bb7bcd8cc2fe4a56 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 10:40:56 +0100 +Subject: [PATCH hurd 09/29] console: add a payload-aware intrans function + +* console/priv.h (begin_using_protid_payload): New function. +* console/mutations.h: Add mutators. +--- + console/mutations.h | 3 +++ + libnetfs/priv.h | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/console/mutations.h b/console/mutations.h +index 4e1cc7e..87906cc 100644 +--- a/console/mutations.h ++++ b/console/mutations.h +@@ -21,12 +21,15 @@ + /* Only CPP macro definitions should go in this file. */ + + #define IO_INTRAN protid_t begin_using_protid_port (io_t) ++#define IO_INTRAN_PAYLOAD protid_t begin_using_protid_payload + #define IO_DESTRUCTOR end_using_protid_port (protid_t) + + #define TIOCTL_IMPORTS import "libnetfs/priv.h"; + + #define NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) ++#define NOTIFY_INTRAN_PAYLOAD \ ++ port_info_t begin_using_port_info_payload + #define NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) + #define NOTIFY_IMPORTS \ +diff --git a/libnetfs/priv.h b/libnetfs/priv.h +index 36c8f53..3c5bcd4 100644 +--- a/libnetfs/priv.h ++++ b/libnetfs/priv.h +@@ -31,6 +31,12 @@ begin_using_protid_port (file_t port) + return ports_lookup_port (netfs_port_bucket, port, netfs_protid_class); + } + ++static inline struct protid * __attribute__ ((unused)) ++begin_using_protid_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (netfs_port_bucket, payload, netfs_protid_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_protid_port (struct protid *cred) + { +-- +2.1.3 + diff --git a/debian/patches/0010-console-client-make-the-demuxer-payload-aware.patch b/debian/patches/0010-console-client-make-the-demuxer-payload-aware.patch new file mode 100644 index 00000000..c1f58e35 --- /dev/null +++ b/debian/patches/0010-console-client-make-the-demuxer-payload-aware.patch @@ -0,0 +1,36 @@ +From 445eb03674d068963456eb4eb1085c5f245b33f7 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 4 Apr 2014 16:53:25 +0200 +Subject: [PATCH hurd 10/29] console-client: make the demuxer payload-aware + +* console-client/trans.c (console_demuxer): make the demuxer payload-aware. +--- + console-client/trans.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/console-client/trans.c b/console-client/trans.c +index 67cd149..224229e 100644 +--- a/console-client/trans.c ++++ b/console-client/trans.c +@@ -63,8 +63,16 @@ console_demuxer (mach_msg_header_t *inp, + ret = netfs_demuxer (inp, outp); + if (ret) + return ret; +- +- user = ports_lookup_port (netfs_port_bucket, inop->msgh_local_port, netfs_protid_class); ++ ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ user = ports_lookup_payload (netfs_port_bucket, ++ inop->msgh_protected_payload, ++ netfs_protid_class); ++ else ++ user = ports_lookup_port (netfs_port_bucket, ++ inop->msgh_local_port, ++ netfs_protid_class); + if (!user) + return ret; + +-- +2.1.3 + diff --git a/debian/patches/0011-exec-add-payload-aware-intrans-functions.patch b/debian/patches/0011-exec-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..6dd7f355 --- /dev/null +++ b/debian/patches/0011-exec-add-payload-aware-intrans-functions.patch @@ -0,0 +1,53 @@ +From 11bcfb23a9de36ad424d050a705dd8b37dbd5ff2 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 11:08:39 +0100 +Subject: [PATCH hurd 11/29] exec: add payload-aware intrans functions + +* exec/execmutations.h: Add mutators. +* exec/mig-decls.h (begin_using_bootinfo_payload): New function. +--- + exec/execmutations.h | 3 +++ + exec/mig-decls.h | 6 ++++++ + 2 files changed, 9 insertions(+) + +diff --git a/exec/execmutations.h b/exec/execmutations.h +index 2acca7a..0b5b8bb 100644 +--- a/exec/execmutations.h ++++ b/exec/execmutations.h +@@ -1,6 +1,7 @@ + /* CPP definitions for MiG processing of exec.defs for exec server. */ + + #define FILE_INTRAN trivfs_protid_t trivfs_begin_using_protid (file_t) ++#define FILE_INTRAN_PAYLOAD trivfs_protid_t trivfs_begin_using_protid_payload + #define FILE_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t) + + #define EXEC_IMPORTS \ +@@ -9,6 +10,8 @@ + + #define EXEC_STARTUP_INTRAN \ + bootinfo_t begin_using_bootinfo_port (exec_startup_t) ++#define EXEC_STARTUP_INTRAN_PAYLOAD \ ++ bootinfo_t begin_using_bootinfo_payload + #define EXEC_STARTUP_DESTRUCTOR \ + end_using_bootinfo (bootinfo_t) + #define EXEC_STARTUP_IMPORTS \ +diff --git a/exec/mig-decls.h b/exec/mig-decls.h +index 0437414..cf3e17d 100644 +--- a/exec/mig-decls.h ++++ b/exec/mig-decls.h +@@ -30,6 +30,12 @@ begin_using_bootinfo_port (mach_port_t port) + return ports_lookup_port (port_bucket, port, execboot_portclass); + } + ++static inline struct bootinfo * __attribute__ ((unused)) ++begin_using_bootinfo_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (port_bucket, payload, execboot_portclass); ++} ++ + static inline void __attribute__ ((unused)) + end_using_bootinfo (struct bootinfo *b) + { +-- +2.1.3 + diff --git a/debian/patches/0012-pfinet-add-payload-aware-intrans-functions.patch b/debian/patches/0012-pfinet-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..6b5555ac --- /dev/null +++ b/debian/patches/0012-pfinet-add-payload-aware-intrans-functions.patch @@ -0,0 +1,73 @@ +From 9b34b8da7e4f3a0378b864e649c0345b43ff2b63 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 11:10:20 +0100 +Subject: [PATCH hurd 12/29] pfinet: add payload-aware intrans functions + +* pfinet/mig-mutate.h: Add mutators. +* pfinet/mig-decls.h (begin_using_socket_payload): New function. +(begin_using_sockaddr_payload): Likewise. +--- + pfinet/mig-decls.h | 12 ++++++++++++ + pfinet/mig-mutate.h | 4 ++++ + 2 files changed, 16 insertions(+) + +diff --git a/pfinet/mig-decls.h b/pfinet/mig-decls.h +index ec8fb23..67bcbfc 100644 +--- a/pfinet/mig-decls.h ++++ b/pfinet/mig-decls.h +@@ -32,6 +32,12 @@ begin_using_socket_port (mach_port_t port) + return ports_lookup_port (pfinet_bucket, port, socketport_class); + } + ++static inline struct sock_user * __attribute__ ((unused)) ++begin_using_socket_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (pfinet_bucket, payload, socketport_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_socket_port (struct sock_user *user) + { +@@ -45,6 +51,12 @@ begin_using_sockaddr_port (mach_port_t port) + return ports_lookup_port (pfinet_bucket, port, addrport_class); + } + ++static inline struct sock_addr * __attribute__ ((unused)) ++begin_using_sockaddr_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (pfinet_bucket, payload, addrport_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_sockaddr_port (struct sock_addr *addr) + { +diff --git a/pfinet/mig-mutate.h b/pfinet/mig-mutate.h +index 0a1eeb8..2bc385b 100644 +--- a/pfinet/mig-mutate.h ++++ b/pfinet/mig-mutate.h +@@ -23,18 +23,22 @@ + #define IO_SELECT_REPLY_PORT + + #define IO_INTRAN sock_user_t begin_using_socket_port (io_t) ++#define IO_INTRAN_PAYLOAD sock_user_t begin_using_socket_payload + #define IO_DESTRUCTOR end_using_socket_port (sock_user_t) + #define IO_IMPORTS import "mig-decls.h"; + #define IIOCTL_IMPORTS import "mig-decls.h"; + + #define SOCKET_INTRAN sock_user_t begin_using_socket_port (socket_t) ++#define SOCKET_INTRAN_PAYLOAD sock_user_t begin_using_socket_payload + #define SOCKET_DESTRUCTOR end_using_socket_port (sock_user_t) + #define SOCKET_IMPORTS \ + import "mig-decls.h"; \ + import "../libtrivfs/mig-decls.h"; \ + + #define ADDRPORT_INTRAN sock_addr_t begin_using_sockaddr_port (addr_port_t) ++#define ADDRPORT_INTRAN_PAYLOAD sock_addr_t begin_using_sockaddr_payload + #define ADDRPORT_DESTRUCTOR end_using_sockaddr_port (sock_addr_t) + + #define PF_INTRAN trivfs_protid_t trivfs_begin_using_protid (pf_t) ++#define PF_INTRAN_PAYLOAD trivfs_protid_t trivfs_begin_using_protid_payload + #define PF_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t) +-- +2.1.3 + diff --git a/debian/patches/0013-pfinet-make-the-demuxers-payload-aware.patch b/debian/patches/0013-pfinet-make-the-demuxers-payload-aware.patch new file mode 100644 index 00000000..39cb33ff --- /dev/null +++ b/debian/patches/0013-pfinet-make-the-demuxers-payload-aware.patch @@ -0,0 +1,74 @@ +From 09be8ecd3a467ab1772f9fd533212afaefd1e814 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 13 Apr 2014 14:03:48 +0200 +Subject: [PATCH hurd 13/29] pfinet: make the demuxers payload-aware + +* pfinet/ethernet.c (ethernet_demuxer): Make the demuxer payload-aware. +* pfinet/main.c (pfinet_demuxer): Likewise. +--- + pfinet/ethernet.c | 20 +++++++++++++++++++- + pfinet/main.c | 12 ++++++++++-- + 2 files changed, 29 insertions(+), 3 deletions(-) + +diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c +index 053fd1b..1678243 100644 +--- a/pfinet/ethernet.c ++++ b/pfinet/ethernet.c +@@ -116,12 +116,30 @@ ethernet_demuxer (mach_msg_header_t *inp, + int datalen; + struct ether_device *edev; + struct device *dev = 0; ++ mach_port_t local_port; + + if (inp->msgh_id != NET_RCV_MSG_ID) + return 0; + ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ { ++ struct port_info *pi = ports_lookup_payload (NULL, ++ inp->msgh_protected_payload, ++ NULL); ++ if (pi) ++ { ++ local_port = pi->port_right; ++ ports_port_deref (pi); ++ } ++ else ++ local_port = MACH_PORT_NULL; ++ } ++ else ++ local_port = inp->msgh_local_port; ++ + for (edev = ether_dev; edev; edev = edev->next) +- if (inp->msgh_local_port == edev->readptname) ++ if (local_port == edev->readptname) + dev = &edev->dev; + + if (! dev) +diff --git a/pfinet/main.c b/pfinet/main.c +index 0f1fbfc..8716fdb 100644 +--- a/pfinet/main.c ++++ b/pfinet/main.c +@@ -86,8 +86,16 @@ pfinet_demuxer (mach_msg_header_t *inp, + + /* We have several classes in one bucket, which need to be demuxed + differently. */ +- pi = ports_lookup_port(pfinet_bucket, inp->msgh_local_port, socketport_class); +- ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ pi = ports_lookup_payload (pfinet_bucket, ++ inp->msgh_protected_payload, ++ socketport_class); ++ else ++ pi = ports_lookup_port (pfinet_bucket, ++ inp->msgh_local_port, ++ socketport_class); ++ + if (pi) + { + ports_port_deref (pi); +-- +2.1.3 + diff --git a/debian/patches/0014-pflocal-add-payload-aware-intrans-functions.patch b/debian/patches/0014-pflocal-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..620d3133 --- /dev/null +++ b/debian/patches/0014-pflocal-add-payload-aware-intrans-functions.patch @@ -0,0 +1,67 @@ +From c1466449b07279e97488459cb05869b9168d681f Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 11:13:29 +0100 +Subject: [PATCH hurd 14/29] pflocal: add payload-aware intrans functions + +* pflocal/mig-mutate.h: Add mutators. +* pflocal/mig-decls.c (begin_using_sock_user_payload): New function. +(begin_using_addr_payload): Likewise. +--- + pflocal/mig-decls.h | 12 ++++++++++++ + pflocal/mig-mutate.h | 3 +++ + 2 files changed, 15 insertions(+) + +diff --git a/pflocal/mig-decls.h b/pflocal/mig-decls.h +index 983de9d..b1da797 100644 +--- a/pflocal/mig-decls.h ++++ b/pflocal/mig-decls.h +@@ -36,6 +36,12 @@ begin_using_sock_user_port(mach_port_t port) + return (sock_user_t)ports_lookup_port (0, port, sock_user_port_class); + } + ++static inline sock_user_t __attribute__ ((unused)) ++begin_using_sock_user_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (NULL, payload, sock_user_port_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_sock_user_port (sock_user_t sock_user) + { +@@ -49,6 +55,12 @@ begin_using_addr_port(mach_port_t port) + return (addr_t)ports_lookup_port (0, port, addr_port_class); + } + ++static inline addr_t __attribute__ ((unused)) ++begin_using_addr_payload (unsigned long payload) ++{ ++ return ports_lookup_port (NULL, payload, addr_port_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_addr_port (addr_t addr) + { +diff --git a/pflocal/mig-mutate.h b/pflocal/mig-mutate.h +index b149473..238c806 100644 +--- a/pflocal/mig-mutate.h ++++ b/pflocal/mig-mutate.h +@@ -21,13 +21,16 @@ + #define IO_SELECT_REPLY_PORT + + #define IO_INTRAN sock_user_t begin_using_sock_user_port (io_t) ++#define IO_INTRAN_PAYLOAD sock_user_t begin_using_sock_user_payload + #define IO_DESTRUCTOR end_using_sock_user_port (sock_user_t) + + #define IO_IMPORTS import "mig-decls.h"; + + #define SOCKET_INTRAN sock_user_t begin_using_sock_user_port (socket_t) ++#define SOCKET_INTRAN_PAYLOAD sock_user_t begin_using_sock_user_payload + #define SOCKET_DESTRUCTOR end_using_sock_user_port (sock_user_t) + #define ADDRPORT_INTRAN addr_t begin_using_addr_port (addr_port_t) ++#define ADDRPORT_INTRAN_PAYLOAD addr_t begin_using_addr_payload + #define ADDRPORT_DESTRUCTOR end_using_addr_port (addr_t) + + #define SOCKET_IMPORTS import "mig-decls.h"; +-- +2.1.3 + diff --git a/debian/patches/0015-proc-add-payload-aware-intrans-functions.patch b/debian/patches/0015-proc-add-payload-aware-intrans-functions.patch new file mode 100644 index 00000000..9e4f71c5 --- /dev/null +++ b/debian/patches/0015-proc-add-payload-aware-intrans-functions.patch @@ -0,0 +1,88 @@ +From 54d9dfbeefd2d427822cf74e8556044fb3626300 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 10:31:08 +0100 +Subject: [PATCH hurd 15/29] proc: add payload-aware intrans functions + +* proc/mig-decls.h (begin_using_proc_payload): New function. +(begin_using_exc_payload): Likewise. +* proc/mig-mutate.h: Add mutators. +* proc/proc_exc.defs (exception_t): Add payload-aware in-translator +function. +--- + proc/mig-decls.h | 17 +++++++++++++++++ + proc/mig-mutate.h | 4 ++++ + proc/proc_exc.defs | 1 + + 3 files changed, 22 insertions(+) + +diff --git a/proc/mig-decls.h b/proc/mig-decls.h +index 7d36a87..eb33ef3 100644 +--- a/proc/mig-decls.h ++++ b/proc/mig-decls.h +@@ -35,6 +35,17 @@ begin_using_proc_port (mach_port_t port) + return (!p || p->p_dead) ? NULL : p; + } + ++static inline struct proc * __attribute__ ((unused)) ++begin_using_proc_payload (unsigned long payload) ++{ ++ struct proc *p; ++ p = ports_lookup_payload (proc_bucket, payload, proc_class); ++ if (p && p->p_dead) ++ ports_port_deref (p); ++ return (!p || p->p_dead) ? 0 : p; ++} ++ ++ + static inline void __attribute__ ((unused)) + end_using_proc (struct proc *p) + { +@@ -50,6 +61,12 @@ begin_using_exc_port (mach_port_t port) + return ports_lookup_port (NULL, port, exc_class); + } + ++static inline exc_t __attribute__ ((unused)) ++begin_using_exc_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (NULL, payload, exc_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_exc (exc_t exc) + { +diff --git a/proc/mig-mutate.h b/proc/mig-mutate.h +index ce9f88e..62dc2a5 100644 +--- a/proc/mig-mutate.h ++++ b/proc/mig-mutate.h +@@ -20,6 +20,8 @@ + + #define PROCESS_INTRAN \ + pstruct_t begin_using_proc_port (process_t) ++#define PROCESS_INTRAN_PAYLOAD \ ++ pstruct_t begin_using_proc_payload + #define PROCESS_DESTRUCTOR \ + end_using_proc (pstruct_t) + #define PROCESS_IMPORTS \ +@@ -27,6 +29,8 @@ + + #define NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) ++#define NOTIFY_INTRAN_PAYLOAD \ ++ port_info_t begin_using_port_info_payload + #define NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) + #define NOTIFY_IMPORTS \ +diff --git a/proc/proc_exc.defs b/proc/proc_exc.defs +index c910824..9dc3626 100644 +--- a/proc/proc_exc.defs ++++ b/proc/proc_exc.defs +@@ -38,6 +38,7 @@ 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) ++ intranpayload: exc_t begin_using_exc_payload + destructor: end_using_exc (exc_t); + + routine proc_exception_raise ( +-- +2.1.3 + diff --git a/debian/patches/0016-startup-disable-default-payload-to-port-mapping.patch b/debian/patches/0016-startup-disable-default-payload-to-port-mapping.patch new file mode 100644 index 00000000..85d7f811 --- /dev/null +++ b/debian/patches/0016-startup-disable-default-payload-to-port-mapping.patch @@ -0,0 +1,32 @@ +From b8ec92af4bb14115ad14bbfa14a3dbece34f1ff1 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 20:57:40 +0100 +Subject: [PATCH hurd 16/29] startup: disable default payload to port mapping + +startup does not use libports. Therefor, it is not necessary to use the +default payload to port translation function. + +* startup/Makefile (MIGSFLAGS): Disable the default payload to port +translation function. +--- + startup/Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/startup/Makefile b/startup/Makefile +index 23d35cb..ee2ecdd5 100644 +--- a/startup/Makefile ++++ b/startup/Makefile +@@ -25,6 +25,10 @@ OBJS = $(SRCS:.c=.o) \ + target = startup + HURDLIBS = shouldbeinlibc + ++# startup does not use libports. Disable the default payload to port ++# conversion. ++MIGSFLAGS="-DHURD_DEFAULT_PAYLOAD_TO_PORT=1" ++ + include ../Makeconf + + mung_msg_S.h: msg_S.h +-- +2.1.3 + diff --git a/debian/patches/0017-term-add-a-payload-aware-intrans-function.patch b/debian/patches/0017-term-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..419ef987 --- /dev/null +++ b/debian/patches/0017-term-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,61 @@ +From 856c00ad058dec984e629a05d6f61a80cde14acc Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Mon, 14 Apr 2014 14:21:16 +0200 +Subject: [PATCH hurd 17/29] term: add a payload-aware intrans function + +* term/mig-mutate.h: Add mutator. +--- + term/Makefile | 1 + + term/mig-decls.h | 6 ++++++ + term/mig-mutate.h | 3 +++ + 3 files changed, 10 insertions(+) + +diff --git a/term/Makefile b/term/Makefile +index 5006c0d..1419d2a 100644 +--- a/term/Makefile ++++ b/term/Makefile +@@ -33,5 +33,6 @@ include ../Makeconf + + device_replyServer-CPPFLAGS = -DTypeCheck=0 -Wno-unused # XXX + ++device_reply-MIGSFLAGS = -DMACH_PAYLOAD_TO_PORT=ports_payload_get_name + tioctl-MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h + term-MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h +diff --git a/term/mig-decls.h b/term/mig-decls.h +index c91b133..09b45c6 100644 +--- a/term/mig-decls.h ++++ b/term/mig-decls.h +@@ -32,6 +32,12 @@ begin_using_ctty_port (mach_port_t port) + return ports_lookup_port (term_bucket, port, cttyid_class); + } + ++static inline struct port_info * __attribute__ ((unused)) ++begin_using_ctty_payload (unsigned long payload) ++{ ++ return ports_lookup_payload (term_bucket, payload, cttyid_class); ++} ++ + static inline void __attribute__ ((unused)) + end_using_ctty (struct port_info *p) + { +diff --git a/term/mig-mutate.h b/term/mig-mutate.h +index 1545719..af8877e 100644 +--- a/term/mig-mutate.h ++++ b/term/mig-mutate.h +@@ -20,10 +20,13 @@ + /* Only CPP macro definitions should go in this file. */ + + #define IO_INTRAN trivfs_protid_t trivfs_begin_using_protid (io_t) ++#define IO_INTRAN_PAYLOAD trivfs_protid_t trivfs_begin_using_protid_payload + #define IO_DESTRUCTOR trivfs_end_using_protid (trivfs_protid_t) + + #define CTTY_INTRAN \ + port_info_t begin_using_ctty_port (mach_port_t) ++#define CTTY_INTRAN_PAYLOAD \ ++ port_info_t begin_using_ctty_payload + #define CTTY_DESTRUCTOR \ + end_using_ctty (port_info_t) + +-- +2.1.3 + diff --git a/debian/patches/0018-trans-fakeroot-make-the-demuxer-payload-aware.patch b/debian/patches/0018-trans-fakeroot-make-the-demuxer-payload-aware.patch new file mode 100644 index 00000000..fdf9ea8b --- /dev/null +++ b/debian/patches/0018-trans-fakeroot-make-the-demuxer-payload-aware.patch @@ -0,0 +1,48 @@ +From ee388ad55279fd8c0be5dfdb36961304c73512b7 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 23 Nov 2014 19:24:49 +0100 +Subject: [PATCH hurd 18/29] trans/fakeroot: make the demuxer payload-aware + +* trans/fakeroot.c (netfs_demuxer): Make the demuxer payload-aware. +--- + trans/fakeroot.c | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/trans/fakeroot.c b/trans/fakeroot.c +index df2de64..12173bd 100644 +--- a/trans/fakeroot.c ++++ b/trans/fakeroot.c +@@ -964,9 +964,16 @@ netfs_demuxer (mach_msg_header_t *inp, + { + /* We didn't recognize the message ID, so pass the message through + unchanged to the underlying file. */ +- struct protid *cred = ports_lookup_port (netfs_port_bucket, +- inp->msgh_local_port, +- netfs_protid_class); ++ struct protid *cred; ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ cred = ports_lookup_payload (netfs_port_bucket, ++ inp->msgh_protected_payload, ++ netfs_protid_class); ++ else ++ cred = ports_lookup_port (netfs_port_bucket, ++ inp->msgh_local_port, ++ netfs_protid_class); + if (cred == 0) + /* This must be an unknown message on our fsys control port. */ + return 0; +@@ -974,7 +981,9 @@ netfs_demuxer (mach_msg_header_t *inp, + { + error_t err; + assert (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) +- == MACH_MSG_TYPE_MOVE_SEND); ++ == MACH_MSG_TYPE_MOVE_SEND ++ || MACH_MSGH_BITS_LOCAL (inp->msgh_bits) ++ == MACH_MSG_TYPE_PROTECTED_PAYLOAD); + inp->msgh_bits = (inp->msgh_bits & MACH_MSGH_BITS_COMPLEX) + | MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, + MACH_MSGH_BITS_REMOTE (inp->msgh_bits)); +-- +2.1.3 + diff --git a/debian/patches/0019-trans-ifsock-add-a-payload-aware-intrans-function.patch b/debian/patches/0019-trans-ifsock-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..4acfca53 --- /dev/null +++ b/debian/patches/0019-trans-ifsock-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,25 @@ +From 7b96b43cdd6809af47ef23b9e6c63168c0130aae Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sun, 13 Apr 2014 17:08:38 +0200 +Subject: [PATCH hurd 19/29] trans/ifsock: add a payload-aware intrans function + +* trans/Makefile (ifsock-MIGSFLAGS): Add mutator. +--- + trans/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/trans/Makefile b/trans/Makefile +index 71e6424..eecaeeb 100644 +--- a/trans/Makefile ++++ b/trans/Makefile +@@ -39,6 +39,7 @@ password-MIGSFLAGS=\ + + ifsock-MIGSFLAGS=\ + "-DFILE_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \ ++ "-DFILE_INTRAN_PAYLOAD=trivfs_protid_t trivfs_begin_using_protid_payload" \ + "-DFILE_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \ + "-DIFSOCK_IMPORTS=import \"../libtrivfs/mig-decls.h\";" + +-- +2.1.3 + diff --git a/debian/patches/0020-trans-password-add-a-payload-aware-intrans-function.patch b/debian/patches/0020-trans-password-add-a-payload-aware-intrans-function.patch new file mode 100644 index 00000000..f8d2cbbc --- /dev/null +++ b/debian/patches/0020-trans-password-add-a-payload-aware-intrans-function.patch @@ -0,0 +1,26 @@ +From a30e0ced6a227705241586dfc118fb8a81f795ab Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 16:51:42 +0100 +Subject: [PATCH hurd 20/29] trans/password: add a payload-aware intrans + function + +* trans/Makefile (password-MIGSFLAGS): Add mutator. +--- + trans/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/trans/Makefile b/trans/Makefile +index eecaeeb..04fd276 100644 +--- a/trans/Makefile ++++ b/trans/Makefile +@@ -34,6 +34,7 @@ LDLIBS += -lpthread + password-LDLIBS = -lcrypt + password-MIGSFLAGS=\ + "-DIO_INTRAN=trivfs_protid_t trivfs_begin_using_protid (io_t)" \ ++ "-DIO_INTRAN_PAYLOAD=trivfs_protid_t trivfs_begin_using_protid_payload" \ + "-DIO_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \ + "-DPASSWORD_IMPORTS=import \"../libtrivfs/mig-decls.h\";" + +-- +2.1.3 + diff --git a/debian/patches/0021-trans-streamio-make-the-translator-payload-aware.patch b/debian/patches/0021-trans-streamio-make-the-translator-payload-aware.patch new file mode 100644 index 00000000..764dc26d --- /dev/null +++ b/debian/patches/0021-trans-streamio-make-the-translator-payload-aware.patch @@ -0,0 +1,27 @@ +From 0b6e61e8a879fa696351831c9176826fa9eb6d91 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 21 Nov 2014 05:29:36 +0100 +Subject: [PATCH hurd 21/29] trans/streamio: make the translator payload-aware + +* trans/Makefile (device_reply-MIGSFLAGS): Define MACH_PAYLOAD_TO_PORT. +--- + trans/Makefile | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/trans/Makefile b/trans/Makefile +index 04fd276..b6edb97 100644 +--- a/trans/Makefile ++++ b/trans/Makefile +@@ -44,6 +44,9 @@ ifsock-MIGSFLAGS=\ + "-DFILE_DESTRUCTOR=trivfs_end_using_protid (trivfs_protid_t)" \ + "-DIFSOCK_IMPORTS=import \"../libtrivfs/mig-decls.h\";" + ++# device_replyServer is used by the streamio translator. ++device_reply-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name" ++ + include ../Makeconf + + vpath elfcore.c $(top_srcdir)/exec +-- +2.1.3 + diff --git a/debian/patches/0022-trans-symlink-disable-default-payload-to-port-mappin.patch b/debian/patches/0022-trans-symlink-disable-default-payload-to-port-mappin.patch new file mode 100644 index 00000000..201f90db --- /dev/null +++ b/debian/patches/0022-trans-symlink-disable-default-payload-to-port-mappin.patch @@ -0,0 +1,34 @@ +From 79e0ee0fab3b79b64c4bb1d15d30af67622b9631 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 21:00:48 +0100 +Subject: [PATCH hurd 22/29] trans/symlink: disable default payload to port + mapping + +`fsysServer' is only used by the symlink translator which does not use +libports. Therefor, it is not necessary to use the default payload to +port translation function. + +* trans/Makefile (fsys-MIGSFLAGS): Disable the default payload to port +translation function. +--- + trans/Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/trans/Makefile b/trans/Makefile +index b6edb97..ce1eae7 100644 +--- a/trans/Makefile ++++ b/trans/Makefile +@@ -47,6 +47,10 @@ ifsock-MIGSFLAGS=\ + # device_replyServer is used by the streamio translator. + device_reply-MIGSFLAGS="-DMACH_PAYLOAD_TO_PORT=ports_payload_get_name" + ++# fsysServer is only used by the symlink translator which does not use ++# libports. Disable the default payload to port conversion. ++fsys-MIGSFLAGS = "-DHURD_DEFAULT_PAYLOAD_TO_PORT=1" ++ + include ../Makeconf + + vpath elfcore.c $(top_srcdir)/exec +-- +2.1.3 + diff --git a/debian/patches/0023-utils-rpctrace-make-trace_and_forward-payload-aware.patch b/debian/patches/0023-utils-rpctrace-make-trace_and_forward-payload-aware.patch new file mode 100644 index 00000000..2074689b --- /dev/null +++ b/debian/patches/0023-utils-rpctrace-make-trace_and_forward-payload-aware.patch @@ -0,0 +1,65 @@ +From 2f8b47d3c7d991f9f030dd688b2bffb2f228d48a Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 12:21:49 +0100 +Subject: [PATCH hurd 23/29] utils/rpctrace: make `trace_and_forward' + payload-aware + +As the protected payloads were retrofitted into the Mach message +format, the local port type is lost. + +* utils/rpctrace.c (is_notification): New function +(trace_and_forward): Recover the original local port type. +--- + utils/rpctrace.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/utils/rpctrace.c b/utils/rpctrace.c +index c954e51..62d3c87 100644 +--- a/utils/rpctrace.c ++++ b/utils/rpctrace.c +@@ -1195,6 +1195,16 @@ wrap_new_task (mach_msg_header_t *inp, struct req_info *req) + ports_port_deref (task_wrapper1); + } + ++/* Returns true if the given message is a Mach notification. */ ++static inline int ++is_notification (const mach_msg_header_t *InHeadP) ++{ ++ int msgh_id = InHeadP->msgh_id - 64; ++ if ((msgh_id > 8) || (msgh_id < 0)) ++ return 0; ++ return 1; ++} ++ + int + trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp) + { +@@ -1219,7 +1229,24 @@ trace_and_forward (mach_msg_header_t *inp, mach_msg_header_t *outp) + /* Look up our record for the receiving port. There is no need to check + the class, because our port bucket only ever contains one class of + ports (traced_class). */ +- info = ports_lookup_port (traced_bucket, inp->msgh_local_port, 0); ++ ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ { ++ info = ports_lookup_payload (traced_bucket, inp->msgh_protected_payload, ++ NULL); ++ if (info) ++ { ++ /* Undo the protected payload optimization. */ ++ inp->msgh_bits = MACH_MSGH_BITS ( ++ MACH_MSGH_BITS_REMOTE (inp->msgh_bits), ++ is_notification (inp)? MACH_MSG_TYPE_MOVE_SEND_ONCE: info->type) ++ | MACH_MSGH_BITS_OTHER (inp->msgh_bits); ++ inp->msgh_local_port = ports_payload_get_name (info); ++ } ++ } ++ else ++ info = ports_lookup_port (traced_bucket, inp->msgh_local_port, NULL); ++ + assert (info); + + /* A notification message from the kernel appears to have been sent +-- +2.1.3 + diff --git a/debian/patches/0024-hurd-add-intranpayload-functions-to-all-hurd-types.patch b/debian/patches/0024-hurd-add-intranpayload-functions-to-all-hurd-types.patch new file mode 100644 index 00000000..9acc163c --- /dev/null +++ b/debian/patches/0024-hurd-add-intranpayload-functions-to-all-hurd-types.patch @@ -0,0 +1,280 @@ +From abf2968653b3faa82f623b99d20de64f69c8d5e6 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Thu, 28 Nov 2013 10:24:26 +0100 +Subject: [PATCH hurd 24/29] hurd: add intranpayload functions to all hurd + types + +For each hurd type defined in hurd_types.h, add a intranpayload +function. If an X_INTRAN mutation is defined for a type, a +corresponding X_INTRAN_PAYLOAD has to be defined. If no X_INTRAN +mutation is defined, use ports_payload_get_name as intranpayload +function, turning the payload back into an port name. + +* hurd/hurd_types.defs: Add intranpayload functions. +* hurd/term.defs: Likewise. +* hurd/default_pager.defs: Include `hurd_types.defs' for +`MACH_PAYLOAD_TO_PORT'. +--- + hurd/default_pager.defs | 1 + + hurd/hurd_types.defs | 120 +++++++++++++++++++++++++++++++++++++++++++++++- + hurd/term.defs | 3 ++ + 3 files changed, 123 insertions(+), 1 deletion(-) + +diff --git a/hurd/default_pager.defs b/hurd/default_pager.defs +index 1a4290d..a97bff2 100644 +--- a/hurd/default_pager.defs ++++ b/hurd/default_pager.defs +@@ -29,6 +29,7 @@ + + subsystem default_pager 2275; + ++#include <hurd/hurd_types.defs> /* For `MACH_PAYLOAD_TO_PORT'. */ + #include <mach/std_types.defs> + #include <mach/mach_types.defs> + #include <mach/default_pager_types.defs> +diff --git a/hurd/hurd_types.defs b/hurd/hurd_types.defs +index 129a68c..57af6dc 100644 +--- a/hurd/hurd_types.defs ++++ b/hurd/hurd_types.defs +@@ -18,13 +18,67 @@ along with the GNU Hurd; see the file COPYING. If not, write to + the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + + ++/* The Hurd uses protected payloads to quickly look up the object ++ receiving a message. Looking up objects is optimized at the cost ++ of having to translate payloads back to port names if the server ++ function expect a port name rather than an object. ++ ++ Support for this is implemented in libports. Almost all of Hurd's ++ servers use libports. For servers using libports, the optimized ++ lookup is completely transparent. ++ ++ Servers not using libports are not using protected payloads ++ automatically. Define HURD_DEFAULT_PAYLOAD_TO_PORT to 1 (1 like ++ the identity function) for programs not using libports to avoid ++ injecting the default payload-to-port translation function which is ++ in libports. If you want to use protected payloads without ++ libports, you can use HURD_DEFAULT_PAYLOAD_TO_PORT to inject a ++ custom translation function. */ ++ ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++#if HURD_DEFAULT_PAYLOAD_TO_PORT ++/* Any non-numeric value will fail this test. If 1 (or any number) is ++ given, do not inject the default translator function. */ ++#undef HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif ++#else ++ import <hurd/ports.h>; ++#define HURD_DEFAULT_PAYLOAD_TO_PORT ports_payload_get_name ++#endif ++ ++/* Override the mach_port_t. Use the default payload to port ++ translation function to convert payloads back to port names for ++ this type. */ ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++#define MACH_PAYLOAD_TO_PORT HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif ++ + #include <mach/std_types.defs> + #include <mach/mach_types.defs> + #include <device/device_types.defs> ++ ++/* The Hurd types. You can inject translation functions for type X ++ using the X_INTRAN, X_INTRAN_PAYLOAD, X_OUTTRAN, and X_DESTRUCTOR. ++ ++ If you define X_INTRAN and your server is using libports, you also ++ have to define X_INTRAN_PAYLOAD. ++ ++ If you do not use libports, and do not want to use the protected ++ payload mechanism, but you do want to use X_INTRAN, you must ++ provide a X_INTRAN_PAYLOAD that either ignores the message by ++ returning NULL, or indicates an error condition in some appropriate ++ way. If you do want to use the protected payload mechanism, make ++ sure you also define an appropriate HURD_DEFAULT_PAYLOAD_TO_PORT ++ translation function. */ + + type file_t = mach_port_copy_send_t + #ifdef FILE_INTRAN + intran: FILE_INTRAN ++intranpayload: FILE_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: file_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef FILE_OUTTRAN + outtran: FILE_OUTTRAN +@@ -37,6 +91,11 @@ destructor: FILE_DESTRUCTOR + type fsys_t = mach_port_copy_send_t + #ifdef FSYS_INTRAN + intran: FSYS_INTRAN ++intranpayload: FSYS_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: fsys_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef FSYS_OUTTRAN + outtran: FSYS_OUTTRAN +@@ -50,6 +109,11 @@ destructor: FSYS_DESTRUCTOR + type io_t = mach_port_copy_send_t + #ifdef IO_INTRAN + intran: IO_INTRAN ++intranpayload: IO_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: io_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef IO_OUTTRAN + outtran: IO_OUTTRAN +@@ -62,6 +126,11 @@ destructor: IO_DESTRUCTOR + type process_t = mach_port_copy_send_t + #ifdef PROCESS_INTRAN + intran: PROCESS_INTRAN ++intranpayload: PROCESS_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: process_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef PROCESS_OUTTRAN + outtran: PROCESS_OUTTRAN +@@ -74,6 +143,11 @@ destructor: PROCESS_DESTRUCTOR + type auth_t = mach_port_copy_send_t + #ifdef AUTH_INTRAN + intran: AUTH_INTRAN ++intranpayload: AUTH_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: auth_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef AUTH_OUTTRAN + outtran: AUTH_OUTTRAN +@@ -86,6 +160,11 @@ destructor: AUTH_DESTRUCTOR + type socket_t = mach_port_copy_send_t + #ifdef SOCKET_INTRAN + intran: SOCKET_INTRAN ++intranpayload: SOCKET_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: socket_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef SOCKET_OUTTRAN + outtran: SOCKET_OUTTRAN +@@ -99,6 +178,11 @@ destructor: SOCKET_DESTRUCTOR + type pf_t = mach_port_copy_send_t + #ifdef PF_INTRAN + intran: PF_INTRAN ++intranpayload: PF_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: pf_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef PF_OUTTRAN + outtran: PF_OUTTRAN +@@ -111,6 +195,11 @@ destructor: PF_DESTRUCTOR + type addr_port_t = mach_port_copy_send_t + #ifdef ADDRPORT_INTRAN + intran: ADDRPORT_INTRAN ++intranpayload: ADDRPORT_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: addr_port_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef ADDRPORT_OUTTRAN + outtran: ADDRPORT_OUTTRAN +@@ -123,6 +212,11 @@ destructor: ADDRPORT_DESTRUCTOR + type term_t = mach_port_copy_send_t + #ifdef TERM_INTRAN + intran: TERM_INTRAN ++intranpayload: TERM_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: term_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef TERM_OUTTRAN + outtran: TERM_OUTTRAN +@@ -135,6 +229,11 @@ destructor: TERM_DESTRUCTOR + type startup_t = mach_port_copy_send_t + #ifdef STARTUP_INTRAN + intran: STARTUP_INTRAN ++intranpayload: STARTUP_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: startup_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef STARTUP_OUTTRAN + outtran: STARTUP_OUTTRAN +@@ -147,6 +246,11 @@ destructor: STARTUP_DESTRUCTOR + type fs_notify_t = mach_port_copy_send_t + #ifdef FS_NOTIFY_INTRAN + intran: FS_NOTIFY_INTRAN ++intranpayload: FS_NOTIFY_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: fs_notify_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef FS_NOTIFY_OUTTRAN + outtran: FS_NOTIFY_OUTTRAN +@@ -159,6 +263,11 @@ destructor: FS_NOTIFY_DESTRUCTOR + type exec_startup_t = mach_port_copy_send_t + #ifdef EXEC_STARTUP_INTRAN + intran: EXEC_STARTUP_INTRAN ++intranpayload: EXEC_STARTUP_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: exec_startup_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef EXEC_STARTUP_OUTTRAN + outtran: EXEC_STARTUP_OUTTRAN +@@ -171,6 +280,11 @@ destructor: EXEC_STARTUP_DESTRUCTOR + type interrupt_t = mach_port_copy_send_t + #ifdef INTERRUPT_INTRAN + intran: INTERRUPT_INTRAN ++intranpayload: INTERRUPT_INTRAN_PAYLOAD ++#else ++#ifdef HURD_DEFAULT_PAYLOAD_TO_PORT ++intranpayload: exec_startup_t HURD_DEFAULT_PAYLOAD_TO_PORT ++#endif + #endif + #ifdef INTERRUPT_OUTTRAN + outtran: INTERRUPT_OUTTRAN +@@ -184,7 +298,11 @@ destructor: INTERRUPT_DESTRUCTOR + type proccoll_t = mach_port_copy_send_t; + + type sreply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic +- ctype: mach_port_t; ++ ctype: mach_port_t ++#ifdef MACH_PAYLOAD_TO_PORT ++intranpayload: mach_port_t MACH_PAYLOAD_TO_PORT ++#endif /* MACH_PAYLOAD_TO_PORT */ ++; + + /* These macros are used in some .defs files so that every routine has a + server reply port argument #ifdef REPLY_PORTS. */ +diff --git a/hurd/term.defs b/hurd/term.defs +index 45d825d..29b94ef 100644 +--- a/hurd/term.defs ++++ b/hurd/term.defs +@@ -33,6 +33,9 @@ type ctty_t = mach_port_copy_send_t + #ifdef CTTY_INTRAN + intran: CTTY_INTRAN + #endif ++#ifdef CTTY_INTRAN_PAYLOAD ++intranpayload: CTTY_INTRAN_PAYLOAD ++#endif + #ifdef CTTY_OUTTRAN + outtran: CTTY_OUTTRAN + #endif +-- +2.1.3 + diff --git a/debian/patches/0025-libports-use-protected-payloads-to-optimize-the-obje.patch b/debian/patches/0025-libports-use-protected-payloads-to-optimize-the-obje.patch new file mode 100644 index 00000000..471a67e7 --- /dev/null +++ b/debian/patches/0025-libports-use-protected-payloads-to-optimize-the-obje.patch @@ -0,0 +1,364 @@ +From 17a4eebe9b0de469be71b931601dbde49f8fa9cd Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Sat, 23 Nov 2013 16:12:55 +0100 +Subject: [PATCH hurd 25/29] libports: use protected payloads to optimize the + object lookup + +* libports/create-internal.c (_ports_create_port_internal): Set the +protected payload to the objects address. +* libports/import-port.c (ports_import_port): Likewise. +* libports/reallocate-from-external.c (ports_reallocate_from_external): +Likewise. +* libports/reallocate-port.c (ports_reallocate_port): Likewise. +* libports/transfer-right.c (ports_transfer_right): Likewise. +* libports/manage-multithread.c (ports_manage_port_operations_multithread): +Use the protected payload as the objects address if provided. +* libports/manage-one-thread.c (ports_manage_port_operations_one_thread): +Likewise. +* libports/destroy-right.c (ports_destroy_right): Defer the +dereferencing of outstanding send rights to avoid a port_info +use-after-free if a no-senders notification is dispatched. +(struct deferred_dereference, gc_loop, start_gc, defer_dereferencing): +Simple generational garbage collection of outstanding send rights. +--- + libports/complete-deallocate.c | 2 +- + libports/create-internal.c | 6 +- + libports/destroy-right.c | 133 ++++++++++++++++++++++++++++++++++-- + libports/import-port.c | 6 +- + libports/manage-multithread.c | 22 +++++- + libports/manage-one-thread.c | 22 +++++- + libports/reallocate-from-external.c | 4 ++ + libports/reallocate-port.c | 4 ++ + libports/transfer-right.c | 3 + + 9 files changed, 193 insertions(+), 9 deletions(-) + +diff --git a/libports/complete-deallocate.c b/libports/complete-deallocate.c +index 0d852f5..6799dfd 100644 +--- a/libports/complete-deallocate.c ++++ b/libports/complete-deallocate.c +@@ -27,7 +27,7 @@ _ports_complete_deallocate (struct port_info *pi) + { + assert ((pi->flags & PORT_HAS_SENDRIGHTS) == 0); + +- if (pi->port_right) ++ if (MACH_PORT_VALID (pi->port_right)) + { + struct references result; + +diff --git a/libports/create-internal.c b/libports/create-internal.c +index 2d85931..d79dc78 100644 +--- a/libports/create-internal.c ++++ b/libports/create-internal.c +@@ -99,7 +99,11 @@ _ports_create_port_internal (struct port_class *class, + bucket->count++; + class->count++; + pthread_mutex_unlock (&_ports_lock); +- ++ ++ /* This is an optimization. It may fail. */ ++ mach_port_set_protected_payload (mach_task_self (), port, ++ (unsigned long) pi); ++ + if (install) + { + err = mach_port_move_member (mach_task_self (), pi->port_right, +diff --git a/libports/destroy-right.c b/libports/destroy-right.c +index 448b379..c229d77 100644 +--- a/libports/destroy-right.c ++++ b/libports/destroy-right.c +@@ -1,5 +1,5 @@ + /* +- Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc. ++ Copyright (C) 1995, 1996, 1999, 2014 Free Software Foundation, Inc. + Written by Michael I. Bushnell. + + This file is part of the GNU Hurd. +@@ -22,30 +22,155 @@ + #include <hurd/ihash.h> + #include <assert.h> + ++#include <pthread.h> ++#include <error.h> ++#include <time.h> ++#include <unistd.h> ++ ++/* To prevent protected payloads from becoming stale, we defer the ++ derefercing of port_info objects. Consumes PI. */ ++static error_t defer_dereferencing (struct port_info *pi); ++ + error_t + ports_destroy_right (void *portstruct) + { + struct port_info *pi = portstruct; + error_t err; + ++ mach_port_clear_protected_payload (mach_task_self (), ++ pi->port_right); ++ ++ pthread_mutex_lock (&_ports_lock); + if (pi->port_right != MACH_PORT_NULL) + { + pthread_rwlock_wrlock (&_ports_htable_lock); + hurd_ihash_locp_remove (&_ports_htable, pi->ports_htable_entry); + hurd_ihash_locp_remove (&pi->bucket->htable, pi->hentry); + pthread_rwlock_unlock (&_ports_htable_lock); ++ + err = mach_port_mod_refs (mach_task_self (), pi->port_right, + MACH_PORT_RIGHT_RECEIVE, -1); + assert_perror (err); + +- pi->port_right = MACH_PORT_NULL; +- + if (pi->flags & PORT_HAS_SENDRIGHTS) + { + pi->flags &= ~PORT_HAS_SENDRIGHTS; +- ports_port_deref (pi); ++ ++ /* There are outstanding send rights, so we might get a ++ no-senders notification. Attached to the notification ++ is a reference to the port_info object. Of course we ++ destroyed the receive right these were send to above, but ++ the message could already have been send and dequeued. ++ ++ Previously, those messages would have carried an stale ++ name, which would have caused a hash table lookup ++ failure. However, stale payloads results in port_info ++ use-after-free. Therefore, we cannot release the ++ reference here, but defer that instead. */ ++ defer_dereferencing (pi); + } ++ ++ pi->port_right = MACH_PORT_DEAD; + } ++ pthread_mutex_unlock (&_ports_lock); ++ ++ return 0; ++} ++ ++/* Simple lock-less generational garbage collection. */ ++ ++/* We maintain three lists of objects. Producers add objects to the ++ current generation G using defer_dereferencing. G-1 holds old ++ objects, G-2 holds garbage. */ ++static struct deferred_dereference ++{ ++ struct deferred_dereference *next; ++ struct port_info *pi; /* We hold a reference for these objects. */ ++} *generations[3]; /* Must be accessed using atomic ++ operations. */ ++ ++/* The current generation. Must be accessed using atomic operations. */ ++static int generation; ++ ++/* The garbage collection thread. Does not return. */ ++static void * ++gc_loop (void *arg) ++{ ++ while (1) ++ { ++ int old, garbage; ++ struct deferred_dereference *d; ++ ++ sleep (5); ++ ++ /* We are the only one updating generation, so this is safe. */ ++ old = generation; ++ ++ /* Update generation. */ ++ __atomic_store_n (&generation, (old + 1) % 3, __ATOMIC_RELAXED); ++ ++ /* This is the garbage generation. As all writers are long ++ gone, we do not need to bother with atomic operations. */ ++ garbage = (old + 2) % 3; ++ d = generations[garbage]; ++ generations[garbage] = NULL; ++ while (d != NULL) ++ { ++ struct deferred_dereference *next = d->next; ++ ++ /* Get rid of our reference. */ ++ ports_port_deref (d->pi); ++ ++ free (d); ++ d = next; ++ } ++ } ++ ++ assert (! "reached"); ++ return NULL; ++} ++ ++/* Start the gc thread. */ ++static void ++start_gc (void) ++{ ++ error_t err; ++ pthread_attr_t attr; ++ pthread_t thread; ++ ++ pthread_attr_init (&attr); ++#define STACK_SIZE (64 * 1024) ++ pthread_attr_setstacksize (&attr, STACK_SIZE); ++#undef STACK_SIZE ++ ++ err = pthread_create (&thread, &attr, gc_loop, NULL); ++ assert_perror (err); ++ err = pthread_detach (thread); ++ assert_perror (err); ++} ++ ++/* Defer the derefercing of port_info objects. Consumes PI. */ ++static error_t ++defer_dereferencing (struct port_info *pi) ++{ ++ static pthread_once_t once = PTHREAD_ONCE_INIT; ++ int g; ++ struct deferred_dereference *d; ++ pthread_once (&once, start_gc); ++ ++ d = malloc (sizeof *d); ++ if (d == NULL) ++ return ENOMEM; ++ d->pi = pi; ++ ++ retry: ++ /* Append to the current generation. */ ++ g = __atomic_load_n (&generation, __ATOMIC_RELAXED); ++ ++ d->next = __atomic_load_n (&generations[g], __ATOMIC_RELAXED); ++ if (! __atomic_compare_exchange_n (&generations[g], &d->next, d, ++ 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED)) ++ goto retry; + + return 0; + } +diff --git a/libports/import-port.c b/libports/import-port.c +index c337c85..2c638e1 100644 +--- a/libports/import-port.c ++++ b/libports/import-port.c +@@ -93,7 +93,11 @@ ports_import_port (struct port_class *class, struct port_bucket *bucket, + bucket->count++; + class->count++; + pthread_mutex_unlock (&_ports_lock); +- ++ ++ /* This is an optimization. It may fail. */ ++ mach_port_set_protected_payload (mach_task_self (), port, ++ (unsigned long) pi); ++ + mach_port_move_member (mach_task_self (), port, bucket->portset); + + if (stat.mps_srights) +diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c +index 2067cba..90b3044 100644 +--- a/libports/manage-multithread.c ++++ b/libports/manage-multithread.c +@@ -162,7 +162,27 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, + outp->RetCodeType = RetCodeType; + outp->RetCode = MIG_BAD_ID; + +- pi = ports_lookup_port (bucket, inp->msgh_local_port, 0); ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ { ++ pi = (struct port_info *) inp->msgh_protected_payload; ++ if (pi && pi->bucket == bucket) ++ ports_port_ref (pi); ++ else ++ pi = NULL; ++ } ++ else ++ { ++ pi = ports_lookup_port (bucket, inp->msgh_local_port, 0); ++ if (pi) ++ { ++ inp->msgh_bits = MACH_MSGH_BITS ( ++ MACH_MSGH_BITS_REMOTE (inp->msgh_bits), ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD); ++ inp->msgh_protected_payload = (unsigned long) pi; ++ } ++ } ++ + if (pi) + { + error_t err = ports_begin_rpc (pi, inp->msgh_id, &link); +diff --git a/libports/manage-one-thread.c b/libports/manage-one-thread.c +index cbd2df7..58c0f36 100644 +--- a/libports/manage-one-thread.c ++++ b/libports/manage-one-thread.c +@@ -57,7 +57,27 @@ ports_manage_port_operations_one_thread (struct port_bucket *bucket, + outp->RetCodeType = RetCodeType; + outp->RetCode = MIG_BAD_ID; + +- pi = ports_lookup_port (bucket, inp->msgh_local_port, 0); ++ if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) == ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD) ++ { ++ pi = (struct port_info *) inp->msgh_protected_payload; ++ if (pi && pi->bucket == bucket) ++ ports_port_ref (pi); ++ else ++ pi = NULL; ++ } ++ else ++ { ++ pi = ports_lookup_port (bucket, inp->msgh_local_port, 0); ++ if (pi) ++ { ++ inp->msgh_bits = MACH_MSGH_BITS ( ++ MACH_MSGH_BITS_REMOTE (inp->msgh_bits), ++ MACH_MSG_TYPE_PROTECTED_PAYLOAD); ++ inp->msgh_protected_payload = (unsigned long) pi; ++ } ++ } ++ + if (pi) + { + err = ports_begin_rpc (pi, inp->msgh_id, &link); +diff --git a/libports/reallocate-from-external.c b/libports/reallocate-from-external.c +index 7205bd9..d0fae1a 100644 +--- a/libports/reallocate-from-external.c ++++ b/libports/reallocate-from-external.c +@@ -71,6 +71,10 @@ ports_reallocate_from_external (void *portstruct, mach_port_t receive) + pthread_mutex_unlock (&_ports_lock); + assert_perror (err); + ++ /* This is an optimization. It may fail. */ ++ mach_port_set_protected_payload (mach_task_self (), pi->port_right, ++ (unsigned long) pi); ++ + mach_port_move_member (mach_task_self (), receive, pi->bucket->portset); + + if (stat.mps_srights) +diff --git a/libports/reallocate-port.c b/libports/reallocate-port.c +index cc534eb..4e859a1 100644 +--- a/libports/reallocate-port.c ++++ b/libports/reallocate-port.c +@@ -59,6 +59,10 @@ ports_reallocate_port (void *portstruct) + pthread_mutex_unlock (&_ports_lock); + assert_perror (err); + ++ /* This is an optimization. It may fail. */ ++ mach_port_set_protected_payload (mach_task_self (), pi->port_right, ++ (unsigned long) pi); ++ + err = mach_port_move_member (mach_task_self (), pi->port_right, + pi->bucket->portset); + assert_perror (err); +diff --git a/libports/transfer-right.c b/libports/transfer-right.c +index 776a8d2..64de7f7 100644 +--- a/libports/transfer-right.c ++++ b/libports/transfer-right.c +@@ -91,6 +91,9 @@ ports_transfer_right (void *tostruct, + err = hurd_ihash_add (&topi->bucket->htable, port, topi); + pthread_rwlock_unlock (&_ports_htable_lock); + assert_perror (err); ++ /* This is an optimization. It may fail. */ ++ mach_port_set_protected_payload (mach_task_self (), port, ++ (unsigned long) topi); + if (topi->bucket != frompi->bucket) + { + err = mach_port_move_member (mach_task_self (), port, +-- +2.1.3 + diff --git a/debian/patches/0026-libports-Fix-build.patch b/debian/patches/0026-libports-Fix-build.patch new file mode 100644 index 00000000..c35f0fbc --- /dev/null +++ b/debian/patches/0026-libports-Fix-build.patch @@ -0,0 +1,25 @@ +From da5f88d7fa960c4676ac479eaa67b14a58fc17ee Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Wed, 27 Nov 2013 11:22:29 +0100 +Subject: [PATCH hurd 26/29] libports: Fix build + +--- + libports/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libports/Makefile b/libports/Makefile +index f49cb9f..6e25cd7 100644 +--- a/libports/Makefile ++++ b/libports/Makefile +@@ -42,7 +42,7 @@ installhdrs = ports.h + + HURDLIBS= ihash + LDLIBS += -lpthread +-OBJS = $(SRCS:.c=.o) notifyServer.o interruptServer.o ++OBJS = $(SRCS:.c=.o) notifyServer.o interruptServer.o mach_portUser.o + + MIGCOMSFLAGS = -prefix ports_ + MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h +-- +2.1.3 + diff --git a/debian/patches/0027-mach-defpager-fix-build.patch b/debian/patches/0027-mach-defpager-fix-build.patch new file mode 100644 index 00000000..ce2d7203 --- /dev/null +++ b/debian/patches/0027-mach-defpager-fix-build.patch @@ -0,0 +1,25 @@ +From 1f33d9bf82670af8b70f157d87698319a6d793f8 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 14 Mar 2014 00:32:52 +0100 +Subject: [PATCH hurd 27/29] mach-defpager: fix build + +--- + mach-defpager/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile +index 09debed..ed115bd 100644 +--- a/mach-defpager/Makefile ++++ b/mach-defpager/Makefile +@@ -27,7 +27,7 @@ SRCS := default_pager.c kalloc.c wiring.c main.c setup.c + OBJS := $(SRCS:.c=.o) \ + $(addsuffix Server.o,\ + memory_object default_pager memory_object_default exc) \ +- default_pager_replyUser.o ++ default_pager_replyUser.o mach_portUser.o + + HURDLIBS:= ihash + OTHERLIBS:= -lpthread +-- +2.1.3 + diff --git a/debian/patches/0028-Replace-bzero-with-memset.patch b/debian/patches/0028-Replace-bzero-with-memset.patch new file mode 100644 index 00000000..77d07790 --- /dev/null +++ b/debian/patches/0028-Replace-bzero-with-memset.patch @@ -0,0 +1,910 @@ +From eca4e0a40045b46dfb5e4088c16d4148816ff2ef Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Mon, 1 Dec 2014 23:55:25 +0100 +Subject: [PATCH hurd 28/29] Replace `bzero' with `memset' + +For reference, this patch was created using the following semantic +patch, and then manually applying the change in all functions +containing nested functions, as those are not supported by Coccinelle. + +@@ +expression A, B; +@@ + +- bzero (A, B) ++ memset (A, 0, B) + +* auth/auth.c: Replace `bzero' with `memset'. +* boot/boot.c: Likewise. +* defpager/defpager.c: Likewise. +* exec/exec.c: Likewise. Also, drop `safe_bzero' and just use +`hurd_safe_memset' directly. +* ext2fs/ext2fs.c: Likewise. +* ext2fs/getblk.c: Likewise. +* ext2fs/pager.c: Likewise. +* fatfs/pager.c: Likewise. +* ftpfs/dir.c: Likewise. +* ftpfs/netfs.c: Likewise. +* isofs/inode.c: Likewise. +* isofs/pager.c: Likewise. +* libdiskfs/file-getfh.c: Likewise. +* libdiskfs/file-statfs.c: Likewise. +* libfshelp/fetch-root.c: Likewise. +* libfshelp/start-translator.c: Likewise. +* libftpconn/create.c: Likewise. +* libftpconn/open.c: Likewise. +* libftpconn/unix.c: Likewise. +* libpipe/pipe.c: Likewise. +* libps/procstat.c: Likewise. +* libps/spec.c: Likewise. +* libshouldbeinlibc/cacheq.c: Likewise. +* libshouldbeinlibc/idvec.c: Likewise. +* libshouldbeinlibc/ugids.c: Likewise. +* libstore/argp.c: Likewise. +* libstore/enc.c: Likewise. +* libstore/kids.c: Likewise. +* libthreads/alpha/thread.c: Likewise. +* libtreefs/fsys.c: Likewise. +* libtrivfs/file-statfs.c: Likewise. +* mach-defpager/default_pager.c: Likewise. +* pfinet/glue-include/asm/uaccess.h: Likewise. +* pfinet/io-ops.c: Likewise. +* pfinet/options.c: Likewise. +* pfinet/socket.c: Likewise. +* pfinet/timer-emul.c: Likewise. +* pflocal/io.c: Likewise. +* startup/startup.c: Likewise. +* storeio/storeio.c: Likewise. +* sutils/fstab.c: Likewise. +* usermux/usermux.c: Likewise. +* utils/fakeauth.c: Likewise. +* utils/frobauth.c: Likewise. +* utils/login.c: Likewise. +* utils/x.c: Likewise. +--- + auth/auth.c | 2 +- + boot/boot.c | 4 ++-- + defpager/defpager.c | 3 +-- + exec/exec.c | 18 +++++++----------- + ext2fs/ext2fs.c | 2 +- + ext2fs/getblk.c | 2 +- + ext2fs/pager.c | 4 ++-- + fatfs/pager.c | 2 +- + ftpfs/dir.c | 4 ++-- + ftpfs/netfs.c | 2 +- + isofs/inode.c | 2 +- + isofs/pager.c | 2 +- + libdiskfs/file-getfh.c | 2 +- + libdiskfs/file-statfs.c | 2 +- + libfshelp/fetch-root.c | 6 +++--- + libfshelp/start-translator.c | 2 +- + libftpconn/create.c | 2 +- + libftpconn/open.c | 2 +- + libftpconn/unix.c | 4 ++-- + libpipe/pipe.c | 6 +++--- + libps/procstat.c | 4 ++-- + libps/spec.c | 2 +- + libshouldbeinlibc/cacheq.c | 2 +- + libshouldbeinlibc/idvec.c | 2 +- + libshouldbeinlibc/ugids.c | 2 +- + libstore/argp.c | 2 +- + libstore/enc.c | 4 ++-- + libstore/kids.c | 2 +- + libthreads/alpha/thread.c | 2 +- + libtreefs/fsys.c | 4 ++-- + libtrivfs/file-statfs.c | 2 +- + mach-defpager/default_pager.c | 8 ++++---- + pfinet/glue-include/asm/uaccess.h | 2 +- + pfinet/io-ops.c | 2 +- + pfinet/options.c | 4 ++-- + pfinet/socket.c | 2 +- + pfinet/timer-emul.c | 2 +- + pflocal/io.c | 4 ++-- + startup/startup.c | 4 ++-- + storeio/storeio.c | 4 ++-- + sutils/fstab.c | 4 ++-- + usermux/usermux.c | 5 +++-- + utils/fakeauth.c | 2 +- + utils/frobauth.c | 2 +- + utils/login.c | 4 ++-- + utils/x.c | 4 ++-- + 46 files changed, 75 insertions(+), 79 deletions(-) + +diff --git a/auth/auth.c b/auth/auth.c +index 7d35bd3..c36bcb2 100644 +--- a/auth/auth.c ++++ b/auth/auth.c +@@ -59,7 +59,7 @@ create_authhandle (struct authhandle **new) + error_t err = ports_create_port (authhandle_portclass, auth_bucket, + sizeof **new, new); + if (! err) +- bzero (&(*new)->euids, (void *) &(*new)[1] - (void *) &(*new)->euids); ++ memset (&(*new)->euids, 0, (void *)&(*new)[1] - (void *)&(*new)->euids); + return err; + } + +diff --git a/boot/boot.c b/boot/boot.c +index e2cb907..4bdeb52 100644 +--- a/boot/boot.c ++++ b/boot/boot.c +@@ -359,7 +359,7 @@ boot_script_exec_cmd (void *hook, + *(char **) p = 0; + p = (void *) p + sizeof (char *); + memcpy (p, strings, stringlen); +- bzero (args, (vm_offset_t) arg_pos & (vm_page_size - 1)); ++ memset (args, 0, (vm_offset_t)arg_pos & (vm_page_size - 1)); + vm_write (task, trunc_page ((vm_offset_t) arg_pos), (vm_address_t) args, + stack_end - trunc_page ((vm_offset_t) arg_pos)); + munmap ((caddr_t) args, +@@ -1579,7 +1579,7 @@ S_io_stat (mach_port_t object, + if (object != pseudo_console) + return EOPNOTSUPP; + +- bzero (st, sizeof (struct stat)); ++ memset (st, 0, sizeof(struct stat)); + st->st_blksize = 1024; + return 0; + } +diff --git a/defpager/defpager.c b/defpager/defpager.c +index 3a824cf..f97b489 100644 +--- a/defpager/defpager.c ++++ b/defpager/defpager.c +@@ -45,8 +45,7 @@ expand_map (struct user_pager_info *p, vm_offset_t addr) + newsize = page + vm_page_size; + newmap = realloc (pager->map, size / vm_page_size * sizeof (off_t)); + +- bzero (pager->map + pager->size / vm_page_size * sizeof (off_t), +- (newsize - pager->size) / vm_page_size * sizeof (off_t)); ++ memset (pager->map + pager->size / vm_page_size * sizeof(off_t), 0, (newsize - pager->size) / vm_page_size * sizeof(off_t)); + pager->size = newsize; + pager->map = newmap; + } +diff --git a/exec/exec.c b/exec/exec.c +index 0ecf2d3..bbe0244 100644 +--- a/exec/exec.c ++++ b/exec/exec.c +@@ -47,13 +47,6 @@ pthread_rwlock_t std_lock = PTHREAD_RWLOCK_INITIALIZER; + + #include <hurd/sigpreempt.h> + +-static error_t +-safe_bzero (void *ptr, size_t size) +-{ +- return hurd_safe_memset (ptr, 0, size); +-} +- +- + /* Load or allocate a section. */ + static void + load_section (void *section, struct execdata *u) +@@ -328,7 +321,9 @@ load_section (void *section, struct execdata *u) + vm_deallocate (u->task, mapstart, memsz); + return; + } +- u->error = safe_bzero ((void *) (ourpage + (addr - overlap_page)), ++ u->error = hurd_safe_memset ( ++ (void *) (ourpage + (addr - overlap_page)), ++ 0, + size - (addr - overlap_page)); + if (! u->error && !(vm_prot & VM_PROT_WRITE)) + u->error = vm_protect (u->task, overlap_page, size, +@@ -887,7 +882,7 @@ do_exec (file_t file, + pthread_rwlock_unlock (&std_lock); + goto out; + } +- bzero (&boot->pi + 1, (char *) &boot[1] - (char *) (&boot->pi + 1)); ++ memset (&boot->pi + 1, 0, (char *) &boot[1] - (char *) (&boot->pi + 1)); + + /* These flags say the information we pass through to the new program + may need to be modified. */ +@@ -960,7 +955,7 @@ do_exec (file_t file, + /* Keep track of which ports in BOOT->portarray come from the original + PORTARRAY, and which we replace. */ + ports_replaced = alloca (boot->nports * sizeof *ports_replaced); +- bzero (ports_replaced, boot->nports * sizeof *ports_replaced); ++ memset (ports_replaced, 0, boot->nports * sizeof *ports_replaced); + + if (portarray[INIT_PORT_BOOTSTRAP] == MACH_PORT_NULL && + oldtask != MACH_PORT_NULL) +@@ -1326,7 +1321,8 @@ do_exec (file_t file, + /* Kill the pointers to the argument information so the cleanup + of BOOT doesn't deallocate it. It will be deallocated my MiG + when we return the error. */ +- bzero (&boot->pi + 1, (char *) &boot[1] - (char *) (&boot->pi + 1)); ++ memset (&boot->pi + 1, 0, ++ (char *) &boot[1] - (char *) (&boot->pi + 1)); + else + /* Do this before we release the last reference. */ + if (boot->nports > INIT_PORT_PROC) +diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c +index 128b6ed..beb7cad 100644 +--- a/ext2fs/ext2fs.c ++++ b/ext2fs/ext2fs.c +@@ -106,7 +106,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + if (values == 0) + return ENOMEM; + state->hook = values; +- bzero (values, sizeof *values); ++ memset (values, 0, sizeof *values); + values->sb_block = SBLOCK_BLOCK; + break; + +diff --git a/ext2fs/getblk.c b/ext2fs/getblk.c +index bde66e1..d7ddb6a 100644 +--- a/ext2fs/getblk.c ++++ b/ext2fs/getblk.c +@@ -105,7 +105,7 @@ ext2_alloc_block (struct node *node, block_t goal, int zero) + if (result && zero) + { + char *bh = disk_cache_block_ref (result); +- bzero (bh, block_size); ++ memset (bh, 0, block_size); + record_indir_poke (node, bh); + } + +diff --git a/ext2fs/pager.c b/ext2fs/pager.c +index 298dae7..ae51530 100644 +--- a/ext2fs/pager.c ++++ b/ext2fs/pager.c +@@ -265,7 +265,7 @@ file_pager_read_page (struct node *node, vm_offset_t page, + break; + STAT_INC (file_pagein_alloced_bufs); + } +- bzero (*buf + offs, block_size); ++ memset (*buf + offs, 0, block_size); + offs += block_size; + } + else +@@ -446,7 +446,7 @@ disk_pager_read_page (vm_offset_t page, void **buf, int *writelock) + if (read != length) + return EIO; + if (!err && length != vm_page_size) +- bzero ((void *)(*buf + length), vm_page_size - length); ++ memset ((void *)(*buf + length), 0, vm_page_size - length); + + *writelock = 0; + +diff --git a/fatfs/pager.c b/fatfs/pager.c +index 0c59084..10d1fc9 100644 +--- a/fatfs/pager.c ++++ b/fatfs/pager.c +@@ -152,7 +152,7 @@ root_dir_pager_read_page (vm_offset_t page, void **buf, int *writelock) + pthread_rwlock_unlock (&diskfs_root_node->dn->alloc_lock); + + if (overrun) +- bzero ((void *) *buf + vm_page_size - overrun, overrun); ++ memset ((void *)*buf + vm_page_size - overrun, 0, overrun); + + return err; + } +diff --git a/ftpfs/dir.c b/ftpfs/dir.c +index a9fea22..be20b3d 100644 +--- a/ftpfs/dir.c ++++ b/ftpfs/dir.c +@@ -64,7 +64,7 @@ rehash (struct ftpfs_dir *dir, size_t new_len) + if (! new_htable) + return ENOMEM; + +- bzero (new_htable, new_len * sizeof (struct ftpfs_dir_entry *)); ++ memset (new_htable, 0, new_len * sizeof(struct ftpfs_dir_entry *)); + + for (i = 0; i < old_len; i++) + while (old_htable[i]) +@@ -124,7 +124,7 @@ lookup (struct ftpfs_dir *dir, const char *name, int add) + e->node = 0; + e->dir = dir; + e->stat_timestamp = 0; +- bzero (&e->stat, sizeof e->stat); ++ memset (&e->stat, 0, sizeof e->stat); + e->symlink_target = 0; + e->noent = 0; + e->valid = 0; +diff --git a/ftpfs/netfs.c b/ftpfs/netfs.c +index 5359acb..cf5d907 100644 +--- a/ftpfs/netfs.c ++++ b/ftpfs/netfs.c +@@ -385,7 +385,7 @@ error_t + netfs_attempt_statfs (struct iouser *cred, struct node *node, + struct statfs *st) + { +- bzero (st, sizeof *st); ++ memset (st, 0, sizeof *st); + st->f_type = FSTYPE_FTP; + st->f_fsid = getpid (); + return 0; +diff --git a/isofs/inode.c b/isofs/inode.c +index cdc05ae..247d8ac 100644 +--- a/isofs/inode.c ++++ b/isofs/inode.c +@@ -599,7 +599,7 @@ diskfs_set_statfs (struct statfs *st) + { + /* There is no easy way to determine the number of files on an + ISO 9660 filesystem. */ +- bzero (st, sizeof *st); ++ memset (st, 0, sizeof *st); + st->f_type = FSTYPE_ISO9660; + st->f_bsize = logical_block_size; + st->f_blocks = isonum_733 (sblock->vol_sp_size); +diff --git a/isofs/pager.c b/isofs/pager.c +index d72a514..35de37e 100644 +--- a/isofs/pager.c ++++ b/isofs/pager.c +@@ -75,7 +75,7 @@ pager_read_page (struct user_pager_info *upi, + return EIO; + + if (overrun) +- bzero ((void *) *buf + vm_page_size - overrun, overrun); ++ memset ((void *)*buf + vm_page_size - overrun, 0, overrun); + + return 0; + } +diff --git a/libdiskfs/file-getfh.c b/libdiskfs/file-getfh.c +index 035705b..e4bc892 100644 +--- a/libdiskfs/file-getfh.c ++++ b/libdiskfs/file-getfh.c +@@ -50,7 +50,7 @@ diskfs_S_file_getfh (struct protid *cred, char **fh, size_t *fh_len) + + f = (union diskfs_fhandle *) *fh; + +- bzero (f, sizeof *f); ++ memset (f, 0, sizeof *f); + f->data.cache_id = node->cache_id; + f->data.gen = node->dn_stat.st_gen; + +diff --git a/libdiskfs/file-statfs.c b/libdiskfs/file-statfs.c +index 9d97ce6..c9fd6f1 100644 +--- a/libdiskfs/file-statfs.c ++++ b/libdiskfs/file-statfs.c +@@ -31,7 +31,7 @@ diskfs_S_file_statfs (struct protid *file, + + /* Start will all zeros, so the fs can skip fields for which + it has no information to contribute. */ +- bzero (statbuf, sizeof *statbuf); ++ memset (statbuf, 0, sizeof *statbuf); + + if (diskfs_readonly) + statbuf->f_flag |= ST_RDONLY; +diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c +index 45c7dd0..712c11f 100644 +--- a/libfshelp/fetch-root.c ++++ b/libfshelp/fetch-root.c +@@ -121,9 +121,9 @@ fshelp_fetch_root (struct transbox *box, void *cookie, + goto return_error; + } + +- bzero (ports, INIT_PORT_MAX * sizeof (mach_port_t)); +- bzero (fds, (STDERR_FILENO + 1) * sizeof (mach_port_t)); +- bzero (ints, INIT_INT_MAX * sizeof (int)); ++ memset (ports, 0, INIT_PORT_MAX * sizeof (mach_port_t)); ++ memset (fds, 0, (STDERR_FILENO + 1) * sizeof (mach_port_t)); ++ memset (ints, 0, INIT_INT_MAX * sizeof (int)); + + ports[INIT_PORT_CWDIR] = dotdot; + ports[INIT_PORT_CRDIR] = reauth (getcrdir ()); +diff --git a/libfshelp/start-translator.c b/libfshelp/start-translator.c +index ba5418e..7f0ae70 100644 +--- a/libfshelp/start-translator.c ++++ b/libfshelp/start-translator.c +@@ -38,7 +38,7 @@ fshelp_start_translator (fshelp_open_fn_t underlying_open_fn, + ports[i] = MACH_PORT_NULL; + for (i = 0; i < STDERR_FILENO + 1; i++) + fds[i] = MACH_PORT_NULL; +- bzero (ints, INIT_INT_MAX * sizeof (int)); ++ memset (ints, 0, INIT_INT_MAX * sizeof(int)); + + ports[INIT_PORT_CWDIR] = getcwdir (); + ports[INIT_PORT_CRDIR] = getcrdir (); +diff --git a/libftpconn/create.c b/libftpconn/create.c +index 20a6456..0ffdb49 100644 +--- a/libftpconn/create.c ++++ b/libftpconn/create.c +@@ -54,7 +54,7 @@ ftp_conn_create (const struct ftp_conn_params *params, + new->actv_data_addr = 0; + new->cwd = 0; + new->type = 0; +- bzero (&new->syshooks, sizeof new->syshooks); ++ memset (&new->syshooks, 0, sizeof new->syshooks); + + if (new->hooks && new->hooks->init) + err = (*new->hooks->init) (new); +diff --git a/libftpconn/open.c b/libftpconn/open.c +index f52bf4d..f1a1b85 100644 +--- a/libftpconn/open.c ++++ b/libftpconn/open.c +@@ -189,7 +189,7 @@ ftp_conn_open (struct ftp_conn *conn) + close (conn->control); + conn->control = -1; + } +- bzero (&conn->syshooks, sizeof conn->syshooks); ++ memset (&conn->syshooks, 0, sizeof conn->syshooks); + + csock = socket (PF_INET, SOCK_STREAM, 0); + if (csock < 0) +diff --git a/libftpconn/unix.c b/libftpconn/unix.c +index 28efefd..882fee8 100644 +--- a/libftpconn/unix.c ++++ b/libftpconn/unix.c +@@ -305,7 +305,7 @@ drwxrwxrwt 7 34 archive 512 May 1 14:28 /tmp + if (strncasecmp (p, "total ", 6) == 0) + return EAGAIN; + +- bzero (stat, sizeof *stat); ++ memset (stat, 0, sizeof *stat); + + #ifdef FSTYPE_FTP + stat->st_fstype = FSTYPE_FTP; +@@ -471,7 +471,7 @@ drwxrwxrwt 7 34 archive 512 May 1 14:28 /tmp + /* Date. Ick. */ + /* Formats: MONTH DAY HH:MM and MONTH DAY YEAR */ + +- bzero (&tm, sizeof tm); ++ memset (&tm, 0, sizeof tm); + + SKIP_WS (); + e = p + strcspn (p, " \t\n"); +diff --git a/libpipe/pipe.c b/libpipe/pipe.c +index b7ee851..9580eb7 100644 +--- a/libpipe/pipe.c ++++ b/libpipe/pipe.c +@@ -18,7 +18,7 @@ + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +-#include <string.h> /* For bzero() */ ++#include <string.h> /* For memset() */ + #include <assert.h> + #include <stdlib.h> + +@@ -58,8 +58,8 @@ pipe_create (struct pipe_class *class, struct pipe **pipe) + new->write_limit = 16*1024; + new->write_atomic = 16*1024; + +- bzero (&new->read_time, sizeof (new->read_time)); +- bzero (&new->write_time, sizeof (new->write_time)); ++ memset (&new->read_time, 0, sizeof(new->read_time)); ++ memset (&new->write_time, 0, sizeof(new->write_time)); + + pthread_cond_init (&new->pending_reads, NULL); + pthread_cond_init (&new->pending_read_selects, NULL); +diff --git a/libps/procstat.c b/libps/procstat.c +index 0d4a565..9f488cd 100644 +--- a/libps/procstat.c ++++ b/libps/procstat.c +@@ -361,7 +361,7 @@ summarize_thread_basic_info (struct procinfo *pi, ps_flags_t have) + if (!tbi) + return 0; + +- bzero (tbi, sizeof *tbi); ++ memset (tbi, 0, sizeof *tbi); + + for (i = 0; i < pi->nthreads; i++) + if (! pi->threadinfos[i].died +@@ -458,7 +458,7 @@ summarize_thread_sched_info (struct procinfo *pi) + if (!tsi) + return 0; + +- bzero (tsi, sizeof *tsi); ++ memset (tsi, 0, sizeof *tsi); + + for (i = 0; i < pi->nthreads; i++) + if (! pi->threadinfos[i].died +diff --git a/libps/spec.c b/libps/spec.c +index d645b82..d8188d6 100644 +--- a/libps/spec.c ++++ b/libps/spec.c +@@ -1036,7 +1036,7 @@ specs_add_alias (struct ps_fmt_specs *specs, + exp->nominal_fn = alias->nominal_fn ?: src->nominal_fn; + + /* Now add the list-end marker. */ +- bzero (exp + 1, sizeof (*exp)); ++ memset (exp + 1, 0, sizeof(*exp)); + + return exp; + } +diff --git a/libshouldbeinlibc/cacheq.c b/libshouldbeinlibc/cacheq.c +index c1be59c..5912f84 100644 +--- a/libshouldbeinlibc/cacheq.c ++++ b/libshouldbeinlibc/cacheq.c +@@ -97,7 +97,7 @@ cacheq_set_length (struct cacheq *cq, int length) + if (fh && th) + bcopy (fh, th, esz); /* Copy the bits in a moved entry. */ + else if (th) +- bzero (th, esz); /* Zero the bits in a new entry. */ ++ memset (th, 0, esz); /* Zero the bits in a new entry. */ + + if (th) + /* Fixup headers. */ +diff --git a/libshouldbeinlibc/idvec.c b/libshouldbeinlibc/idvec.c +index 7fdee10..c60fc9f 100644 +--- a/libshouldbeinlibc/idvec.c ++++ b/libshouldbeinlibc/idvec.c +@@ -115,7 +115,7 @@ idvec_insert (struct idvec *idvec, unsigned pos, uid_t id) + if (pos < num) + bcopy (ids + pos, ids + pos + 1, (num - pos) * sizeof (uid_t)); + else if (pos > num) +- bzero (ids + num, (pos - num) * sizeof (uid_t)); ++ memset (ids + num, 0, (pos - num) * sizeof(uid_t)); + ids[pos] = id; + idvec->num = new_num; + } +diff --git a/libshouldbeinlibc/ugids.c b/libshouldbeinlibc/ugids.c +index db1ce3c..07a11fe 100644 +--- a/libshouldbeinlibc/ugids.c ++++ b/libshouldbeinlibc/ugids.c +@@ -30,7 +30,7 @@ make_ugids () + { + struct ugids *u = malloc (sizeof (struct ugids)); + if (u) +- bzero (u, sizeof *u); ++ memset (u, 0, sizeof *u); + return u; + } + +diff --git a/libstore/argp.c b/libstore/argp.c +index 6ed7996..73146a8 100644 +--- a/libstore/argp.c ++++ b/libstore/argp.c +@@ -350,7 +350,7 @@ parse_opt (int opt, char *arg, struct argp_state *state) + parsed = state->hook = malloc (sizeof (struct store_parsed)); + if (! parsed) + return ENOMEM; +- bzero (parsed, sizeof (struct store_parsed)); ++ memset (parsed, 0, sizeof(struct store_parsed)); + parsed->classes = params->classes; + parsed->default_type = + find_class (params->default_type ?: DEFAULT_STORE_CLASS.name, +diff --git a/libstore/enc.c b/libstore/enc.c +index d5002a0..5838c17 100644 +--- a/libstore/enc.c ++++ b/libstore/enc.c +@@ -33,7 +33,7 @@ store_enc_init (struct store_enc *enc, + off_t *offsets, mach_msg_type_number_t num_offsets, + char *data, mach_msg_type_number_t data_len) + { +- bzero (enc, sizeof (*enc)); ++ memset (enc, 0, sizeof(*enc)); + + enc->ports = enc->init_ports = ports; + enc->num_ports = num_ports; +@@ -75,7 +75,7 @@ store_enc_dealloc (struct store_enc *enc) + munmap (enc->data, enc->data_len); + + /* For good measure... */ +- bzero (enc, sizeof (*enc)); ++ memset (enc, 0, sizeof(*enc)); + } + + /* Copy out the parameters from ENC into the given variables suitably for +diff --git a/libstore/kids.c b/libstore/kids.c +index 901a7f8..5ad9454 100644 +--- a/libstore/kids.c ++++ b/libstore/kids.c +@@ -206,7 +206,7 @@ store_open_children (const char *name, int flags, + if (! *stores) + return ENOMEM; + +- bzero (*stores, count * sizeof (struct store *)); ++ memset (*stores, 0, count * sizeof(struct store *)); + + /* Open each child store. */ + for (p = name, k = 0; !err && p && p[1]; p = end, k++) +diff --git a/libthreads/alpha/thread.c b/libthreads/alpha/thread.c +index db2cb0c..350fd5f 100644 +--- a/libthreads/alpha/thread.c ++++ b/libthreads/alpha/thread.c +@@ -82,7 +82,7 @@ cproc_setup( + * Set up ALPHA call frame and registers. + */ + ts = &state; +- bzero((char *) ts, sizeof(struct alpha_thread_state)); ++ memset ((char *)ts, 0, sizeof(struct alpha_thread_state)); + + top = (integer_t *) (child->stack_base + child->stack_size); + +diff --git a/libtreefs/fsys.c b/libtreefs/fsys.c +index d6565bb..fe1b917 100644 +--- a/libtreefs/fsys.c ++++ b/libtreefs/fsys.c +@@ -81,7 +81,7 @@ treefs_create_fsys (struct port_bucket *port_bucket, + (*fsys)->root = NULL; + + (*fsys)->underlying_port = MACH_PORT_NULL; +- bzero (&(*fsys)->underlying_stat, sizeof (struct stat)); ++ memset (&(*fsys)->underlying_stat, 0, sizeof(struct stat)); + + (*fsys)->flags = treefs_default_flags; + (*fsys)->max_symlinks = treefs_default_max_symlinks; +@@ -109,7 +109,7 @@ void ACKACKACK() + goto barf; + + /* Remember stat info for the node we're mounted on. */ +- bzero (&(*fsys)->underlying_stat, sizeof (struct stat)); ++ memset (&(*fsys)->underlying_stat, 0, sizeof (struct stat)); + file_stat (realnode, &(*fsys)->underlying_stat); + + /* Note that it points to *FSYS, but *FSYS's root doesn't point to it... +diff --git a/libtrivfs/file-statfs.c b/libtrivfs/file-statfs.c +index 348126e..267ac50 100644 +--- a/libtrivfs/file-statfs.c ++++ b/libtrivfs/file-statfs.c +@@ -28,7 +28,7 @@ trivfs_S_file_statfs (struct trivfs_protid *cred, + if (!trivfs_fsid) + trivfs_fsid = getpid(); + +- bzero (stb, sizeof (struct statfs)); ++ memset (stb, 0, sizeof(struct statfs)); + stb->f_type = trivfs_fstype; + stb->f_fsid = trivfs_fsid; + +diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c +index 831ed96..9e4b0e7 100644 +--- a/mach-defpager/default_pager.c ++++ b/mach-defpager/default_pager.c +@@ -192,7 +192,7 @@ new_partition (const char *name, struct file_direct *fdp, + part->going_away= FALSE; + part->file = fdp; + +- bzero((char *)part->bitmap, bmsize); ++ memset ((char *)part->bitmap, 0, bmsize); + + if (check_linux_signature < 0) + { +@@ -428,7 +428,7 @@ create_paging_partition(const char *name, + new_list = (partition_t *) + kalloc( n * sizeof(partition_t) ); + if (new_list == 0) no_paging_space(TRUE); +- bzero(new_list, n*sizeof(partition_t)); ++ memset (new_list, 0, n * sizeof(partition_t)); + if (i) { + old_list = all_partitions.partition_list; + bcopy(old_list, new_list, i*sizeof(partition_t)); +@@ -1640,7 +1640,7 @@ default_read(ds, addr, size, offset, out_addr, deallocate, external) + * An external object is requesting unswapped data, + * zero fill the page and return. + */ +- bzero((char *) addr, vm_page_size); ++ memset ((char *)addr, 0, vm_page_size); + *out_addr = addr; + return (PAGER_SUCCESS); + } +@@ -2118,7 +2118,7 @@ default_pager_t pager_port_alloc(size) + ds = (default_pager_t) kalloc(sizeof *ds); + if (ds == DEFAULT_PAGER_NULL) + panic("%spager_port_alloc",my_name); +- bzero((char *) ds, sizeof *ds); ++ memset ((char *)ds, 0, sizeof *ds); + + dstruct_lock_init(ds); + +diff --git a/pfinet/glue-include/asm/uaccess.h b/pfinet/glue-include/asm/uaccess.h +index 6f6dc41..752c61c 100644 +--- a/pfinet/glue-include/asm/uaccess.h ++++ b/pfinet/glue-include/asm/uaccess.h +@@ -43,7 +43,7 @@ struct __large_struct { unsigned long buf[100]; }; + + #define copy_to_user(to,from,n) (memcpy ((to), (from), (n)), 0) + #define copy_from_user(to,from,n) (memcpy ((to), (from), (n)), 0) +-#define clear_user(mem, len) (bzero ((mem), (len)), 0) ++#define clear_user(mem, len) (memset ((mem), 0, (len)), 0) + + #define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; }) + +diff --git a/pfinet/io-ops.c b/pfinet/io-ops.c +index 96dbec8..cc666cd 100644 +--- a/pfinet/io-ops.c ++++ b/pfinet/io-ops.c +@@ -339,7 +339,7 @@ S_io_stat (struct sock_user *user, + if (!user) + return EOPNOTSUPP; + +- bzero (st, sizeof (struct stat)); ++ memset (st, 0, sizeof(struct stat)); + + st->st_fstype = FSTYPE_SOCKET; + st->st_fsid = getpid (); +diff --git a/pfinet/options.c b/pfinet/options.c +index e9b81a9..4b14356 100644 +--- a/pfinet/options.c ++++ b/pfinet/options.c +@@ -418,8 +418,8 @@ parse_opt (int opt, char *arg, struct argp_state *state) + req.nlh.nlmsg_seq = 0; + req.nlh.nlmsg_len = NLMSG_LENGTH (sizeof req.rtm); + +- bzero (&req.rtm, sizeof req.rtm); +- bzero (&rta, sizeof rta); ++ memset (&req.rtm, 0, sizeof req.rtm); ++ memset (&rta, 0, sizeof rta); + req.rtm.rtm_scope = RT_SCOPE_UNIVERSE; + req.rtm.rtm_type = RTN_UNICAST; + req.rtm.rtm_protocol = RTPROT_STATIC; +diff --git a/pfinet/socket.c b/pfinet/socket.c +index 23a2dd9..06ce2c7 100644 +--- a/pfinet/socket.c ++++ b/pfinet/socket.c +@@ -50,7 +50,7 @@ sock_alloc (void) + return 0; + c = (void *) &sock[1]; + pthread_cond_init (c, NULL); +- bzero (sock, sizeof *sock); ++ memset (sock, 0, sizeof *sock); + sock->state = SS_UNCONNECTED; + sock->identity = MACH_PORT_NULL; + sock->refcnt = 1; +diff --git a/pfinet/timer-emul.c b/pfinet/timer-emul.c +index f6760d7..2053f80 100644 +--- a/pfinet/timer-emul.c ++++ b/pfinet/timer-emul.c +@@ -152,7 +152,7 @@ mod_timer (struct timer_list *timer, unsigned long expires) + void + init_timer (struct timer_list *timer) + { +- bzero (timer, sizeof (struct timer_list)); ++ memset (timer, 0, sizeof(struct timer_list)); + } + + void +diff --git a/pflocal/io.c b/pflocal/io.c +index 00e859a..ee6fb84 100644 +--- a/pflocal/io.c ++++ b/pflocal/io.c +@@ -19,7 +19,7 @@ + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +-#include <string.h> /* For bzero() */ ++#include <string.h> /* For memset() */ + #include <unistd.h> + #include <sys/types.h> + #include <sys/fcntl.h> +@@ -319,7 +319,7 @@ S_io_stat (struct sock_user *user, struct stat *st) + + sock = user->sock; + +- bzero (st, sizeof (struct stat)); ++ memset (st, 0, sizeof (struct stat)); + + st->st_fstype = FSTYPE_SOCKET; + st->st_mode = sock->mode; +diff --git a/startup/startup.c b/startup/startup.c +index e177075..601c894 100644 +--- a/startup/startup.c ++++ b/startup/startup.c +@@ -742,8 +742,8 @@ init_stdarrays () + std_port_array = alloca (sizeof (mach_port_t) * INIT_PORT_MAX); + std_int_array = alloca (sizeof (int) * INIT_INT_MAX); + +- bzero (std_port_array, sizeof (mach_port_t) * INIT_PORT_MAX); +- bzero (std_int_array, sizeof (int) * INIT_INT_MAX); ++ memset (std_port_array, 0, sizeof(mach_port_t) * INIT_PORT_MAX); ++ memset (std_int_array, 0, sizeof(int) * INIT_INT_MAX); + + __USEPORT (AUTH, auth_makeauth (port, 0, MACH_MSG_TYPE_COPY_SEND, 0, + 0, 0, 0, 0, 0, 0, 0, 0, &nullauth)); +diff --git a/storeio/storeio.c b/storeio/storeio.c +index eb38349..fcf2f30 100644 +--- a/storeio/storeio.c ++++ b/storeio/storeio.c +@@ -99,7 +99,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + case ARGP_KEY_INIT: + /* Now store_argp's parser will get to initialize its state. + The default_type member is our input parameter to it. */ +- bzero (¶ms->store_params, sizeof params->store_params); ++ memset (¶ms->store_params, 0, sizeof params->store_params); + params->store_params.default_type = "device"; + params->store_params.store_optional = 1; + state->child_inputs[0] = ¶ms->store_params; +@@ -128,7 +128,7 @@ main (int argc, char *argv[]) + struct dev device; + struct storeio_argp_params params; + +- bzero (&device, sizeof device); ++ memset (&device, 0, sizeof device); + pthread_mutex_init (&device.lock, NULL); + + params.dev = &device; +diff --git a/sutils/fstab.c b/sutils/fstab.c +index e13f15b..24a1a0d 100644 +--- a/sutils/fstab.c ++++ b/sutils/fstab.c +@@ -600,7 +600,7 @@ fstab_add_mntent (struct fstab *const fstab, const struct mntent *mntent, + fs = malloc (sizeof (struct fs)); + if (fs) + { +- bzero (fs, sizeof (struct fs)); ++ memset (fs, 0, sizeof(struct fs)); + fs->mounted = fs->readonly = -1; + fs->fsys = MACH_PORT_NULL; + new = 1; +@@ -783,7 +783,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + /* Initialize our parsing state. */ + if (! params) + return EINVAL; /* Need at least a way to return a result. */ +- bzero (params, sizeof *params); ++ memset (params, 0, sizeof *params); + break; + + case 'A': +diff --git a/usermux/usermux.c b/usermux/usermux.c +index fad923c..e89177b 100644 +--- a/usermux/usermux.c ++++ b/usermux/usermux.c +@@ -84,10 +84,11 @@ main (int argc, char **argv) + case OPT_USER_PAT: mux.user_pat = arg; break; + case OPT_HOME_PAT: mux.home_pat = arg; break; + case OPT_UID_PAT: mux.uid_pat = arg; break; +- case 'C': bzero (&mux, sizeof mux); break; ++ case 'C': memset (&mux, 0, sizeof mux); break; + + case ARGP_KEY_NO_ARGS: +- bzero (&mux, sizeof mux); /* Default doesn't use them; be careful. */ ++ memset (&mux, 0, sizeof mux); /* Default doesn't use them; ++ be careful. */ + return argz_create_sep (_HURD_SYMLINK, 0, + &mux.trans_template, &mux.trans_template_len); + case ARGP_KEY_ARGS: +diff --git a/utils/fakeauth.c b/utils/fakeauth.c +index 590a421..ba6a3ee 100644 +--- a/utils/fakeauth.c ++++ b/utils/fakeauth.c +@@ -50,7 +50,7 @@ create_authhandle (struct authhandle **new) + error_t err = ports_create_port (authhandle_portclass, auth_bucket, + sizeof **new, new); + if (! err) +- bzero (&(*new)->euids, (void *) &(*new)[1] - (void *) &(*new)->euids); ++ memset (&(*new)->euids, 0, (void *)&(*new)[1] - (void *)&(*new)->euids); + return err; + } + +diff --git a/utils/frobauth.c b/utils/frobauth.c +index 44690d8..5de7720 100644 +--- a/utils/frobauth.c ++++ b/utils/frobauth.c +@@ -123,7 +123,7 @@ common_parse_opt (int key, char *arg, struct argp_state *state) + break; + + case ARGP_KEY_INIT: +- bzero (fs, sizeof *fs); ++ memset (fs, 0, sizeof *fs); + fs->frobauth = frobauth; + fs->pids_argp_params.pids = &frobauth->pids; + fs->pids_argp_params.num_pids = &frobauth->num_pids; +diff --git a/utils/login.c b/utils/login.c +index a3e0563..9ee296a 100644 +--- a/utils/login.c ++++ b/utils/login.c +@@ -158,7 +158,7 @@ add_utmp_entry (char *args, unsigned args_len, int inherit_host) + char const *host = 0; + long addr = 0; + +- bzero (&utmp, sizeof (utmp)); ++ memset (&utmp, 0, sizeof(utmp)); + + gettimeofday (&utmp.ut_tv, 0); + strncpy (utmp.ut_name, envz_get (args, args_len, "USER") ?: "", +@@ -683,7 +683,7 @@ main(int argc, char *argv[]) + proc_setowner (proc_server, 0, 1); /* Clear the owner. */ + + /* Now start constructing the exec arguments. */ +- bzero (ints, sizeof (*ints) * INIT_INT_MAX); ++ memset (ints, 0, sizeof (*ints) * INIT_INT_MAX); + arg = envz_get (args, args_len, "UMASK"); + ints[INIT_UMASK] = arg && *arg ? strtoul (arg, 0, 8) : umask (0); + +diff --git a/utils/x.c b/utils/x.c +index 7bbc8ac..518f384 100644 +--- a/utils/x.c ++++ b/utils/x.c +@@ -228,8 +228,8 @@ main(int argc, char *argv[]) + } + struct argp argp = {options, parse_opt, args_doc, doc}; + +- bzero (add, sizeof add); +- bzero (remove, sizeof remove); ++ memset (add, 0, sizeof add); ++ memset (remove, 0, sizeof remove); + + + err = +-- +2.1.3 + diff --git a/debian/patches/0029-xxx-replace-bcopy-with-memcpy-or-memmove-as-appropri.patch b/debian/patches/0029-xxx-replace-bcopy-with-memcpy-or-memmove-as-appropri.patch new file mode 100644 index 00000000..14e294b5 --- /dev/null +++ b/debian/patches/0029-xxx-replace-bcopy-with-memcpy-or-memmove-as-appropri.patch @@ -0,0 +1,135 @@ +From be39b658ebe902b61120bdac98a91b91aa577840 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 2 Dec 2014 00:20:51 +0100 +Subject: [PATCH hurd 29/29] xxx replace bcopy with memcpy or memmove as + appropriate + +* ext2fs/inode.c +* ext2fs/pager.c +* libpager/pagemap.c +* mach-defpager/default_pager.c +* pfinet/ethernet.c +* pfinet/tunnel.c +--- + ext2fs/inode.c | 2 +- + ext2fs/pager.c | 4 ++-- + libpager/pagemap.c | 2 +- + mach-defpager/default_pager.c | 4 ++-- + pfinet/ethernet.c | 10 +++++----- + pfinet/tunnel.c | 2 +- + 6 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/ext2fs/inode.c b/ext2fs/inode.c +index ed78265..c11b5c1 100644 +--- a/ext2fs/inode.c ++++ b/ext2fs/inode.c +@@ -733,7 +733,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen, + + buf[0] = namelen & 0xFF; + buf[1] = (namelen >> 8) & 0xFF; +- bcopy (name, buf + 2, namelen); ++ memcpy (buf + 2, name, namelen); + + blkptr = disk_cache_block_ref (blkno); + memcpy (blkptr, buf, block_size); +diff --git a/ext2fs/pager.c b/ext2fs/pager.c +index ae51530..a6c4fbb 100644 +--- a/ext2fs/pager.c ++++ b/ext2fs/pager.c +@@ -209,7 +209,7 @@ file_pager_read_page (struct node *node, vm_offset_t page, + else + /* We've already got some buffer, so copy into it. */ + { +- bcopy (new_buf, *buf + offs, new_len); ++ memcpy (*buf + offs, new_buf, new_len); + free_page_buf (new_buf); /* Return NEW_BUF to our pool. */ + STAT_INC (file_pagein_freed_bufs); + } +@@ -316,7 +316,7 @@ pending_blocks_write (struct pending_blocks *pb) + /* Put what we're going to write into a page-aligned buffer. */ + { + void *page_buf = get_page_buf (); +- bcopy (pb->buf + pb->offs, (void *)page_buf, length); ++ memcpy ((void *)page_buf, pb->buf + pb->offs, length); + err = store_write (store, dev_block, page_buf, length, &amount); + free_page_buf (page_buf); + } +diff --git a/libpager/pagemap.c b/libpager/pagemap.c +index b8b3362..963f656 100644 +--- a/libpager/pagemap.c ++++ b/libpager/pagemap.c +@@ -36,7 +36,7 @@ _pager_pagemap_resize (struct pager *p, vm_address_t off) + err = (newaddr == (void *) -1) ? errno : 0; + if (! err) + { +- bcopy (p->pagemap, newaddr, p->pagemapsize * sizeof (*p->pagemap)); ++ memcpy (newaddr, p->pagemap, p->pagemapsize * sizeof (*p->pagemap)); + munmap (p->pagemap, p->pagemapsize * sizeof (*p->pagemap)); + p->pagemap = newaddr; + p->pagemapsize = newsize; +diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c +index 9e4b0e7..83382c0 100644 +--- a/mach-defpager/default_pager.c ++++ b/mach-defpager/default_pager.c +@@ -431,7 +431,7 @@ create_paging_partition(const char *name, + memset (new_list, 0, n * sizeof(partition_t)); + if (i) { + old_list = all_partitions.partition_list; +- bcopy(old_list, new_list, i*sizeof(partition_t)); ++ memcpy (new_list, old_list, i*sizeof(partition_t)); + } + all_partitions.partition_list = new_list; + all_partitions.n_partitions = n; +@@ -1678,7 +1678,7 @@ ddprintf ("default_read(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index); + * the next piece. + */ + first_time = FALSE; +- bcopy((char *)raddr, (char *)addr, rsize); ++ memcpy ((char *)addr, (char *)raddr, rsize); + addr += rsize; + offset += rsize; + size -= rsize; +diff --git a/pfinet/ethernet.c b/pfinet/ethernet.c +index 1678243..e6ae53c 100644 +--- a/pfinet/ethernet.c ++++ b/pfinet/ethernet.c +@@ -158,10 +158,10 @@ ethernet_demuxer (mach_msg_header_t *inp, + skb->dev = dev; + + /* Copy the two parts of the frame into the buffer. */ +- bcopy (msg->header, skb->data, ETH_HLEN); +- bcopy (msg->packet + sizeof (struct packet_header), +- skb->data + ETH_HLEN, +- datalen - ETH_HLEN); ++ memcpy (skb->data, msg->header, ETH_HLEN); ++ memcpy (skb->data + ETH_HLEN, ++ msg->packet + sizeof (struct packet_header), ++ datalen - ETH_HLEN); + + /* Drop it on the queue. */ + skb->protocol = eth_type_trans (skb, dev); +@@ -389,7 +389,7 @@ setup_ethernet_device (char *name, struct device **device) + error (2, err, "%s: Cannot get hardware Ethernet address", name); + net_address[0] = ntohl (net_address[0]); + net_address[1] = ntohl (net_address[1]); +- bcopy (net_address, dev->dev_addr, ETH_ALEN); ++ memcpy (dev->dev_addr, net_address, ETH_ALEN); + + /* That should be enough. */ + +diff --git a/pfinet/tunnel.c b/pfinet/tunnel.c +index 6a7f355..02e9ee8 100644 +--- a/pfinet/tunnel.c ++++ b/pfinet/tunnel.c +@@ -395,7 +395,7 @@ trivfs_S_io_write (struct trivfs_protid *cred, + skb->len = datalen; + skb->dev = &tdev->dev; + +- bcopy (data, skb->data, datalen); ++ memcpy (skb->data, data, datalen); + + /* Drop it on the queue. */ + skb->mac.raw = skb->data; +-- +2.1.3 + diff --git a/debian/patches/series b/debian/patches/series index dca91cc0..3512bd32 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -45,3 +45,32 @@ startup-avoid-broken-puts.patch dde-protected-payloads.patch +0001-libports-add-ports_lookup_payload-and-ports_payload_.patch +0002-libports-add-a-payload-aware-intrans-function.patch +0003-libdiskfs-add-payload-aware-intrans-functions.patch +0004-libnetfs-add-a-payload-aware-intrans-function.patch +0005-libtrivfs-add-payload-aware-intrans-functions.patch +0006-libpager-add-a-payload-aware-intrans-function.patch +0007-libcons-add-a-payload-aware-intrans-function.patch +0008-auth-add-a-payload-aware-intrans-function.patch +0009-console-add-a-payload-aware-intrans-function.patch +0010-console-client-make-the-demuxer-payload-aware.patch +0011-exec-add-payload-aware-intrans-functions.patch +0012-pfinet-add-payload-aware-intrans-functions.patch +0013-pfinet-make-the-demuxers-payload-aware.patch +0014-pflocal-add-payload-aware-intrans-functions.patch +0015-proc-add-payload-aware-intrans-functions.patch +0016-startup-disable-default-payload-to-port-mapping.patch +0017-term-add-a-payload-aware-intrans-function.patch +0018-trans-fakeroot-make-the-demuxer-payload-aware.patch +0019-trans-ifsock-add-a-payload-aware-intrans-function.patch +0020-trans-password-add-a-payload-aware-intrans-function.patch +0021-trans-streamio-make-the-translator-payload-aware.patch +0022-trans-symlink-disable-default-payload-to-port-mappin.patch +0023-utils-rpctrace-make-trace_and_forward-payload-aware.patch +0024-hurd-add-intranpayload-functions-to-all-hurd-types.patch +0025-libports-use-protected-payloads-to-optimize-the-obje.patch +0026-libports-Fix-build.patch +0027-mach-defpager-fix-build.patch +0028-Replace-bzero-with-memset.patch +0029-xxx-replace-bcopy-with-memcpy-or-memmove-as-appropri.patch |