Re: new hurd gnumach packages

2015-07-15 Thread Richard Braun
On Tue, Jul 07, 2015 at 04:57:27PM +0200, Richard Braun wrote:
 Even with a clean trace, I have a hard time understanding how it could
 happen.

Unfortunately, rdxtrees are currently unsafe to use without general
(sleep) locks, since they can allocate memory in the middle of an
operation. So yes, a tree can be in an inconsistent state and trigger
assertions.

-- 
Richard Braun



Re: Problem with natively built binaries on Hurd from Guix

2015-07-15 Thread Ludovic Courtès
Hi Manolis,

I just remembered how I addressed it when I cross-built the Hurd with
Nix: Given that libc.so is an ld script on GNU/Hurd, simply add
libhurduser.so and libmachuser.so in there, next to libc.so.0.3 (see
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/glibc/builder.sh#L34.)

I think it can be a relative file name (so literally “libhurduser.so”
would do.)

HTH!

Ludo’.



Re: VirtualBox Hangs Pre-Init Due To Ext2FS Fault

2015-07-15 Thread James Clarke
As discussed in IRC, this successfully stopped the disk pager from 
dereferencing sblock. However, it was still hanging at boot a lot of the time 
(seemingly if and only if I booted in normal mode ie not recovery mode, but 
that's probably just a timing thing).

I had a look today at what's happening, and it's that the *file* pager is 
trying to read from disk. Any thoughts?

James

 On 14 Jul 2015, at 20:54, Justus Winter 4win...@informatik.uni-hamburg.de 
 wrote:
 
 Hi James :)
 
 you found a long-standing bug in ext2fs.  Fixing it allows us to get
 rid of the ugly workaround in daemons/runsystem.sh (look for `XXX').
 
 Quoting Richard Braun (2015-07-13 10:16:14)
 On Sun, Jul 12, 2015 at 12:56:31PM +0100, James Clarke wrote:
 That doesn’t seem to boot at all. I had tried changing it to inhibiting all 
 RPCs (it looks like you’ve inhibited an extra class?), but it seems that 
 paging is needed? Perhaps part of ext2fs gets paged out, and it needs to be 
 paged in when remounting?
 
 Remounting can require paging out, yes.
 
 See diskfs_reload_global_state in ext2fs :
 
 diskfs_reload_global_state ()
 {
  pokel_flush (global_pokel);
  pager_flush (diskfs_disk_pager, 1);
 
 So I guess we need to inhibit the RPCs here, not before calling
 diskfs_reload_global_state, then do:
 
  get_hypermetadata ();
  map_hypermetadata ();
 
 And reenable them here.
 
  return 0;
 }
 
 I guess that means changing the diskfs API.  James, do you want to
 give it a shot?
 
 In the mean time, enjoy my hacky workaround:
 http://nonmonolithic.org/ext2fs.static
 
 Cheers,
 Justus



[PATCH gnumach 1/2] ipc: fix the locking of the IPC entry allocation functions

2015-07-15 Thread Justus Winter
* ipc/ipc_entry.c (ipc_entry_alloc): Assume the space is write-locked.
(ipc_entry_alloc_name): Likewise.
* ipc/ipc_object.c: Fix the locking around all call sites to the two
functions where the space was not locked before.
---
 ipc/ipc_entry.c  | 21 ++---
 ipc/ipc_object.c | 32 
 2 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c
index a5fe319..0414ba5 100644
--- a/ipc/ipc_entry.c
+++ b/ipc/ipc_entry.c
@@ -56,8 +56,7 @@ struct kmem_cache ipc_entry_cache;
  * Purpose:
  * Allocate an entry out of the space.
  * Conditions:
- * The space is not locked before, but it is write-locked after
- * if the call is successful.  May allocate memory.
+ * The space must be write-locked.  May allocate memory.
  * Returns:
  * KERN_SUCCESSAn entry was allocated.
  * KERN_INVALID_TASK   The space is dead.
@@ -75,27 +74,21 @@ ipc_entry_alloc(
ipc_entry_t entry;
rdxtree_key_t key;
 
-   is_write_lock(space);
-
if (!space-is_active) {
-   is_write_unlock(space);
return KERN_INVALID_TASK;
}
 
kr = ipc_entry_get(space, namep, entryp);
if (kr == KERN_SUCCESS)
-   /* Success.  Space is write-locked.  */
return kr;
 
entry = ie_alloc();
if (entry == IE_NULL) {
-   is_write_unlock(space);
return KERN_RESOURCE_SHORTAGE;
}
 
kr = rdxtree_insert_alloc(space-is_map, entry, key);
if (kr) {
-   is_write_unlock(space);
ie_free(entry);
return kr;
}
@@ -108,7 +101,6 @@ ipc_entry_alloc(
 
*entryp = entry;
*namep = (mach_port_t) key;
-   /* Success.  Space is write-locked.  */
return KERN_SUCCESS;
 }
 
@@ -118,8 +110,7 @@ ipc_entry_alloc(
  * Allocates/finds an entry with a specific name.
  * If an existing entry is returned, its type will be nonzero.
  * Conditions:
- * The space is not locked before, but it is write-locked after
- * if the call is successful.  May allocate memory.
+ * The space must be write-locked.  May allocate memory.
  * Returns:
  * KERN_SUCCESSFound existing entry with same name.
  * KERN_SUCCESSAllocated a new entry.
@@ -138,10 +129,7 @@ ipc_entry_alloc_name(
void **slot;
assert(MACH_PORT_VALID(name));
 
-   is_write_lock(space);
-
if (!space-is_active) {
-   is_write_unlock(space);
return KERN_INVALID_TASK;
}
 
@@ -152,7 +140,6 @@ ipc_entry_alloc_name(
if (slot == NULL || entry == IE_NULL) {
entry = ie_alloc();
if (entry == IE_NULL) {
-   is_write_unlock(space);
return KERN_RESOURCE_SHORTAGE;
}
 
@@ -167,7 +154,6 @@ ipc_entry_alloc_name(
kr = rdxtree_insert(space-is_map,
(rdxtree_key_t) name, entry);
if (kr != KERN_SUCCESS) {
-   is_write_unlock(space);
ie_free(entry);
return kr;
}
@@ -175,14 +161,12 @@ ipc_entry_alloc_name(
space-is_size += 1;
 
*entryp = entry;
-   /* Success.  Space is write-locked.  */
return KERN_SUCCESS;
}
 
if (IE_BITS_TYPE(entry-ie_bits)) {
/* Used entry.  */
*entryp = entry;
-   /* Success.  Space is write-locked.  */
return KERN_SUCCESS;
}
 
@@ -202,7 +186,6 @@ ipc_entry_alloc_name(
 
space-is_size += 1;
*entryp = entry;
-   /* Success.  Space is write-locked.  */
return KERN_SUCCESS;
 }
 
diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c
index 2d84cf5..320fbcb 100644
--- a/ipc/ipc_object.c
+++ b/ipc/ipc_object.c
@@ -155,11 +155,12 @@ ipc_object_alloc_dead(
ipc_entry_t entry;
kern_return_t kr;
 
-
+   is_write_lock(space);
kr = ipc_entry_alloc(space, namep, entry);
-   if (kr != KERN_SUCCESS)
+   if (kr != KERN_SUCCESS) {
+   is_write_unlock(space);
return kr;
-   /* space is write-locked */
+   }
 
/* null object, MACH_PORT_TYPE_DEAD_NAME, 1 uref */
 
@@ -191,11 +192,12 @@ ipc_object_alloc_dead_name(
ipc_entry_t entry;
kern_return_t kr;
 
-
+   is_write_lock(space);
kr = ipc_entry_alloc_name(space, name, entry);
-   if (kr != KERN_SUCCESS)
+   if (kr != KERN_SUCCESS) {
+   is_write_unlock(space);
return kr;
-   /* space is write-locked */
+   }