Hi, shouldn't be on libc-alpha, I guess. It's just noise for most of the people there.
On Sun, Nov 03, 2002 at 11:29:33AM -0500, James A Morrison wrote: > I was looking at why gpg fails to build on the Hurd. I discovered mlock > is what is broken. Without really going into your patch, here is some background noise from the past. Here is what Roland wrote a long time ago: "This might be a known kernel problem, I'm just a bit sketchy on the details. That is, the Hurd code that does wiring (libshouldbeinlibc/wire.c) makes the pages writable and pokes them before doing vm_wire. It seems like a breach of the supposed kernel interface of vm_wire that you should have to do this (vm_wire should just force all the copies it needs to), but that is the way the kernel is. At least I think so, but I am not entirely sure I am right about the situation in the kernel." He also suggested: "It would be cool if you could step through vm_wire using gdb on oskit-mach and figure out where specifically it fails." Thomas replied to the above first paragaph: "This is because there were kernel bugs if you get a pagein on wired memory. That is, the kernel assumes that wired memory is *already* in core. The little poking routine is to do our best to make sure we don't have that problem." > The problem arises when the actual protection on the > memory is less relaxed than the protection passed to vm_wire. What does work > is using VM_PROT_DEFAULT, because memory allocated with malloc seems to use > VM_PROT_DEFAULT. However, I think the best solution is to call vm_region > and actually get the proper permissions for the pages. > > Here are a couple of patches that checks vm_region and acts more like > wire_segment_internal in [hurd]/libshouldbeinlibc. The first patch relaxes > the permissions on the memory region to max_protection so that the wired > region can have its protections relaxed to that level at any time. The > second does not because perhaps something could write to a read-only part > of memory between the calls to vm_protect. > > 2002-11-03 James Morrison <[EMAIL PROTECTED]> > > * sysdeps/mach/hurd/mlock.c (mlock): Get the actual protections on a > region of memory before wiring it. > > Index: mlock.c > =================================================================== > RCS file: /cvs/glibc/libc/sysdeps/mach/hurd/mlock.c,v > retrieving revision 1.2 > diff -u -r1.2 mlock.c > --- mlock.c 6 Jul 2001 04:55:57 -0000 1.2 > +++ mlock.c 3 Nov 2002 16:18:09 -0000 > @@ -39,8 +39,19 @@ > > page = trunc_page ((vm_address_t) addr); > len = round_page ((vm_address_t) addr + len) - page; > - err = __vm_wire (hostpriv, __mach_task_self (), page, len, > - VM_PROT_ALL); /* XXX ? */ > + { > + vm_prot_t cur, max; > + vm_inherit_t inher; > + boolean_t shared; > + mach_port_t obj; > + vm_offset_t offs; > + > + __vm_region (mach_task_self (), &page, &len, &cur, &max, &inher, &shared, > + &obj, &offs); > + __vm_protect (mach_task_self (), page, len, 0, max); > + err = __vm_wire (hostpriv, __mach_task_self (), page, len, max); > + __vm_protect (mach_task_self (), page, len, 0, cur); > + } > __mach_port_deallocate (__mach_task_self (), hostpriv); > > return err ? __hurd_fail (err) : 0; > > Index: mlock.c > =================================================================== > RCS file: /cvs/glibc/libc/sysdeps/mach/hurd/mlock.c,v > retrieving revision 1.2 > diff -u -r1.2 mlock.c > --- mlock.c 6 Jul 2001 04:55:57 -0000 1.2 > +++ mlock.c 3 Nov 2002 16:25:44 -0000 > @@ -39,8 +39,18 @@ > > page = trunc_page ((vm_address_t) addr); > len = round_page ((vm_address_t) addr + len) - page; > - err = __vm_wire (hostpriv, __mach_task_self (), page, len, > - VM_PROT_ALL); /* XXX ? */ > + { > + vm_prot_t cur, max; > + vm_inherit_t inher; > + boolean_t shared; > + mach_port_t obj; > + vm_offset_t offs; > + > + __vm_region (mach_task_self (), &page, &len, &cur, &max, &inher, &shared, > + &obj, &offs); > + err = __vm_wire (hostpriv, __mach_task_self (), page, len, max); > + __mach_port_deallocate (mach_task_self (), obj); > + } > __mach_port_deallocate (__mach_task_self (), hostpriv); > > return err ? __hurd_fail (err) : 0; > -- `Rhubarb is no Egyptian god.' GNU http://www.gnu.org [EMAIL PROTECTED] Marcus Brinkmann The Hurd http://www.gnu.org/software/hurd/ [EMAIL PROTECTED] http://www.marcus-brinkmann.de/ _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd