diff options
6 files changed, 350 insertions, 0 deletions
diff --git a/debian/patches/fixes0001-Remove-unused-variables.patch b/debian/patches/fixes0001-Remove-unused-variables.patch new file mode 100644 index 00000000..c20786e1 --- /dev/null +++ b/debian/patches/fixes0001-Remove-unused-variables.patch @@ -0,0 +1,69 @@ +From a9eb3e9765a21f9903705e2b9f46694529af8155 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 6 Nov 2015 10:39:53 +0100 +Subject: [PATCH hurd 1/5] Remove unused variables + +* console/pager.c (user_pager_init): Remove unused variables. +* ext2fs/pager.c (create_disk_pager): Likewise. +* fatfs/pager.c (create_fat_pager): Likewise. +* storeio/pager.c (init_dev_paging): Likewise. +--- + console/pager.c | 1 - + ext2fs/pager.c | 2 -- + fatfs/pager.c | 2 -- + storeio/pager.c | 1 - + 4 files changed, 6 deletions(-) + +diff --git a/console/pager.c b/console/pager.c +index 818e49d..05074a7 100644 +--- a/console/pager.c ++++ b/console/pager.c +@@ -125,7 +125,6 @@ pager_dropweak (struct user_pager_info *upi) + void + user_pager_init (void) + { +- pthread_t thread; + error_t err; + + /* Create the pager bucket, and start to serve paging requests. */ +diff --git a/ext2fs/pager.c b/ext2fs/pager.c +index 3e080f8..9df7e0b 100644 +--- a/ext2fs/pager.c ++++ b/ext2fs/pager.c +@@ -1200,8 +1200,6 @@ disk_cache_block_is_ref (block_t block) + void + create_disk_pager (void) + { +- pthread_t thread; +- pthread_attr_t attr; + error_t err; + + /* The disk pager. */ +diff --git a/fatfs/pager.c b/fatfs/pager.c +index d255f29..84376bd 100644 +--- a/fatfs/pager.c ++++ b/fatfs/pager.c +@@ -764,8 +764,6 @@ pager_dropweak (struct user_pager_info *p __attribute__ ((unused))) + void + create_fat_pager (void) + { +- pthread_t thread; +- pthread_attr_t attr; + error_t err; + + /* The disk pager. */ +diff --git a/storeio/pager.c b/storeio/pager.c +index f8f59cd..54b1714 100644 +--- a/storeio/pager.c ++++ b/storeio/pager.c +@@ -155,7 +155,6 @@ init_dev_paging () + pthread_mutex_lock (&pager_global_lock); + if (pager_port_bucket == NULL) + { +- pthread_t thread; + error_t err; + + pager_port_bucket = ports_create_bucket (); +-- +2.1.4 + diff --git a/debian/patches/fixes0002-random-fix-odd-formatting.patch b/debian/patches/fixes0002-random-fix-odd-formatting.patch new file mode 100644 index 00000000..c33b9d4a --- /dev/null +++ b/debian/patches/fixes0002-random-fix-odd-formatting.patch @@ -0,0 +1,46 @@ +From 608ea90065a50b7f8e3a5592c8e8e4cbd0265490 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 6 Nov 2015 11:48:39 +0100 +Subject: [PATCH hurd 2/5] random: fix odd formatting + +* random/random.c (trivfs_append_args): Fix odd formatting. +--- + random/random.c | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/random/random.c b/random/random.c +index 15be383..9ade161 100644 +--- a/random/random.c ++++ b/random/random.c +@@ -486,25 +486,20 @@ trivfs_append_args (struct trivfs_control *fsys, + { + error_t err = 0; + char *opt; +- ++ + pthread_mutex_lock (&global_lock); + switch (level) + { + case 0: +- { + opt = "--weak"; + break; +- } ++ + case 1: +- { + opt = "--fast"; + break; +- } ++ + default: +- { + opt = "--secure"; +- break; +- } + } + if (level != DEFAULT_LEVEL) + err = argz_add (argz, argz_len, opt); +-- +2.1.4 + diff --git a/debian/patches/fixes0003-random-improve-error-handling.patch b/debian/patches/fixes0003-random-improve-error-handling.patch new file mode 100644 index 00000000..6ae93b36 --- /dev/null +++ b/debian/patches/fixes0003-random-improve-error-handling.patch @@ -0,0 +1,73 @@ +From 5f7601f47a3fd8957a52c03f1135534fc2232539 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 6 Nov 2015 12:00:31 +0100 +Subject: [PATCH hurd 3/5] random: improve error handling + +* random/random.c (arrange_shutdown_notification): Improve error +handling. +(main): Display warning if arranging the shutdown notification failed. +--- + random/random.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/random/random.c b/random/random.c +index 9ade161..f483a5d 100644 +--- a/random/random.c ++++ b/random/random.c +@@ -552,7 +552,7 @@ sigterm_handler (int signo) + raise (SIGTERM); + } + +-void ++static error_t + arrange_shutdown_notification () + { + error_t err; +@@ -570,24 +570,26 @@ arrange_shutdown_notification () + err = ports_create_port (shutdown_notify_class, fsys->pi.bucket, + sizeof (struct port_info), &pi); + if (err) +- return; ++ return err; + + procserver = getproc (); +- if (!procserver) +- return; ++ if (! MACH_PORT_VALID (procserver)) ++ return EMIG_SERVER_DIED; + + err = proc_getmsgport (procserver, 1, &initport); + mach_port_deallocate (mach_task_self (), procserver); + if (err) +- return; ++ return err; + + notify = ports_get_send_right (pi); + ports_port_deref (pi); +- startup_request_notification (initport, notify, +- MACH_MSG_TYPE_MAKE_SEND, +- program_invocation_short_name); ++ err = startup_request_notification (initport, notify, ++ MACH_MSG_TYPE_MAKE_SEND, ++ program_invocation_short_name); ++ + mach_port_deallocate (mach_task_self (), notify); + mach_port_deallocate (mach_task_self (), initport); ++ return err; + } + + +@@ -621,7 +623,9 @@ main (int argc, char **argv) + if (err) + error (3, err, "trivfs_startup"); + +- arrange_shutdown_notification (); ++ err = arrange_shutdown_notification (); ++ if (err) ++ error (0, err, "Cannot request shutdown notification"); + + /* Launch. */ + ports_manage_port_operations_multithread (fsys->pi.bucket, random_demuxer, +-- +2.1.4 + diff --git a/debian/patches/fixes0004-random-use-servers-startup-to-register-for-shutdown-.patch b/debian/patches/fixes0004-random-use-servers-startup-to-register-for-shutdown-.patch new file mode 100644 index 00000000..a210c508 --- /dev/null +++ b/debian/patches/fixes0004-random-use-servers-startup-to-register-for-shutdown-.patch @@ -0,0 +1,53 @@ +From 710201a5db7bcd1c13364eccca65d8b13c1d0d65 Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 6 Nov 2015 12:06:32 +0100 +Subject: [PATCH hurd 4/5] random: use /servers/startup to register for + shutdown notifications + +* random/random.c (arrange_shutdown_notification): Use the new way to +contact the startup server. +--- + random/random.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/random/random.c b/random/random.c +index f483a5d..f926b7f 100644 +--- a/random/random.c ++++ b/random/random.c +@@ -17,6 +17,7 @@ + + #define _GNU_SOURCE 1 + ++#include <hurd/paths.h> + #include <hurd/trivfs.h> + #include <hurd/startup.h> + #include <stdio.h> +@@ -557,7 +558,6 @@ arrange_shutdown_notification () + { + error_t err; + mach_port_t initport, notify; +- process_t procserver; + struct port_info *pi; + + shutdown_notify_class = ports_create_class (0, 0); +@@ -572,14 +572,9 @@ arrange_shutdown_notification () + if (err) + return err; + +- procserver = getproc (); +- if (! MACH_PORT_VALID (procserver)) +- return EMIG_SERVER_DIED; +- +- err = proc_getmsgport (procserver, 1, &initport); +- mach_port_deallocate (mach_task_self (), procserver); +- if (err) +- return err; ++ initport = file_name_lookup (_SERVERS_STARTUP, 0, 0); ++ if (! MACH_PORT_VALID (initport)) ++ return errno; + + notify = ports_get_send_right (pi); + ports_port_deref (pi); +-- +2.1.4 + diff --git a/debian/patches/fixes0005-random-satisfy-arbitrarily-sized-reads.patch b/debian/patches/fixes0005-random-satisfy-arbitrarily-sized-reads.patch new file mode 100644 index 00000000..75ed3b9f --- /dev/null +++ b/debian/patches/fixes0005-random-satisfy-arbitrarily-sized-reads.patch @@ -0,0 +1,104 @@ +From df778cd01505e3a8c11f5b13f5ee26a4be290f9a Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Fri, 6 Nov 2015 14:42:04 +0100 +Subject: [PATCH hurd 5/5] random: satisfy arbitrarily-sized reads + +* random/random.c (trivfs_S_io_read): Satisfy arbitrarily-sized reads. +--- + random/random.c | 41 ++++++++++++++++++++++++++++++----------- + 1 file changed, 30 insertions(+), 11 deletions(-) + +diff --git a/random/random.c b/random/random.c +index f926b7f..8f76c5b 100644 +--- a/random/random.c ++++ b/random/random.c +@@ -143,6 +143,11 @@ trivfs_S_io_read (struct trivfs_protid *cred, + data_t *data, mach_msg_type_number_t *data_len, + loff_t offs, mach_msg_type_number_t amount) + { ++ error_t err; ++ mach_msg_type_number_t read_amount = 0; ++ void *buf = NULL; ++ size_t length; ++ + /* Deny access if they have bad credentials. */ + if (! cred) + return EOPNOTSUPP; +@@ -151,21 +156,27 @@ trivfs_S_io_read (struct trivfs_protid *cred, + + pthread_mutex_lock (&global_lock); + +- if (amount > 0) ++ while (amount > 0) + { + mach_msg_type_number_t new_amount; ++ /* XXX: It would be nice to fix readable_pool to work for sizes ++ greater than the POOLSIZE. Otherwise we risk detecting too ++ late that we run out of entropy and all that entropy is ++ wasted. */ + while (readable_pool (amount, level) == 0) + { + if (cred->po->openmodes & O_NONBLOCK) + { + pthread_mutex_unlock (&global_lock); +- return EWOULDBLOCK; ++ err = EWOULDBLOCK; ++ goto errout; + } + read_blocked = 1; + if (pthread_hurd_cond_wait_np (&wait, &global_lock)) + { + pthread_mutex_unlock (&global_lock); +- return EINTR; ++ err = EINTR; ++ goto errout; + } + /* See term/users.c for possible race? */ + } +@@ -175,27 +186,35 @@ trivfs_S_io_read (struct trivfs_protid *cred, + { + *data = mmap (0, amount, PROT_READ|PROT_WRITE, + MAP_ANON, 0, 0); ++ + if (*data == MAP_FAILED) + { + pthread_mutex_unlock (&global_lock); + return errno; + } +- } + +- new_amount = read_pool ((byte *) *data, amount, level); ++ /* Keep track of our map in case of errors. */ ++ buf = *data, length = amount; + +- if (new_amount < amount) +- munmap (*data + round_page (new_amount), +- round_page(amount) - round_page (new_amount)); +- amount = new_amount; ++ /* Update DATA_LEN to reflect the new buffers size. */ ++ *data_len = amount; ++ } ++ ++ new_amount = read_pool (((byte *) *data) + read_amount, amount, level); ++ read_amount += new_amount; ++ amount -= new_amount; + } +- *data_len = amount; + + /* Set atime, see term/users.c */ + + pthread_mutex_unlock (&global_lock); +- ++ *data_len = read_amount; + return 0; ++ ++ errout: ++ if (buf) ++ munmap (buf, length); ++ return err; + } + + /* Write data to an IO object. If offset is -1, write at the object +-- +2.1.4 + diff --git a/debian/patches/series b/debian/patches/series index 0449c3ff..da193267 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -56,3 +56,8 @@ introspection0006-libpager-annotate-objects-managed-by-libports.patch introspection0007-ext2fs-annotate-objects-managed-by-libports.patch introspection0008-utils-rpctrace-support-attaching-to-servers.patch introspection0009-pflocal-annotate-objects-managed-by-libports.patch +fixes0001-Remove-unused-variables.patch +fixes0002-random-fix-odd-formatting.patch +fixes0003-random-improve-error-handling.patch +fixes0004-random-use-servers-startup-to-register-for-shutdown-.patch +fixes0005-random-satisfy-arbitrarily-sized-reads.patch |