Samuel Thibault, le dim. 14 juil. 2024 18:06:22 +0200, a ecrit:
> Samuel Thibault, le dim. 14 juil. 2024 17:42:51 +0200, a ecrit:
> > Flavio Cruz, le dim. 14 juil. 2024 16:40:24 +0100, a ecrit:
> > > On 14.07.2024 16:37, Samuel Thibault wrote:
> > > > For inlined port arrays, WriteExtractArg compacts them from a
> > > > mach_port_name_inlined_t array to a mach_port_t array, reusing the
> > > > memory area. But when the server returns an error, the caller will
> > > > destroy the message, and thus expects the original inlined port arrays
> > > > available.
> > > > 
> > > > Index: mig-1.8+git20231217/server.c
> > > > ===================================================================
> > > > --- mig-1.8+git20231217.orig/server.c
> > > > +++ mig-1.8+git20231217/server.c
> > > > @@ -790,6 +790,27 @@ WriteExtractArg(FILE *file, const argume
> > > > }
> > > > 
> > > > static void
> > > > +WriteRestoreArg(FILE *file, const argument_t *arg)
> > > > +{
> > > > +    if (akCheckAll(arg->argKind, akbSendRcv|akbPointer)) {
> > > > +       if (akCheck(arg->argKind, akbIndefinite)) {
> > > > +           fprintf(file, "\tif (OutP->%s != KERN_SUCCESS && 
> > > > In%dP->%s%s.msgt_inline) {\n",
> > > > +                   arg->argRoutine->rtRetCode->argMsgField,
> > > > +                   arg->argRequestPos, arg->argTTName, 
> > > > arg->argLongForm ? ".msgtl_header" : "");
> > > > +           fprintf(file, "\t\tmach_msg_type_number_t i;\n");
> > > > +           fprintf(file, "\t\t/* Restore the mach_port_name_inlined_t 
> > > > input array for message destruction. */\n");
> > > > +           fprintf(file, "\t\tfor (i = In%dP->%s.msgt%s_number - 1; i 
> > > > > 0; i--) {\n",
> > > > +                   arg->argRequestPos, arg->argTTName, 
> > > > arg->argLongForm ? "l" : "");
> > > > +           fprintf(file, "\t\t\t%s[i].name = %sP[i];\n", 
> > > > InArgMsgField(arg), arg->argVarName);
> > > > +           fprintf(file, "\t\t}\n");
> > > > +           fprintf(file, "\t}\n");
> > > > +       }
> > > > +       else
> > > > +           assert(false);
> > > > +    }
> > > > +}
> > > > +
> > > > +static void
> > > > WriteServerCallArg(FILE *file, const argument_t *arg)
> > > > {
> > > >     const ipc_type_t *it = arg->argType;
> > > > @@ -1436,6 +1457,8 @@ WriteRoutine(FILE *file, const routine_t
> > > >     WriteServerCall(file, rt);
> > > >     WriteGetReturnValue(file, rt);
> > > > 
> > > > +    WriteReverseList(file, rt->rtArgs, WriteRestoreArg, akbNone, "", 
> > > > "");
> > > > +
> > > >     WriteReverseList(file, rt->rtArgs, WriteDestroyArg, akbDestroy, "", 
> > > > "");
> > > > 
> > > >     /*
> > > 
> > > Tested the patch with cross-hurd and the change LGTM. Thanks for catching!
> > 
> > I'm however seeing some issues that makes ext2fs hang when connecting
> > through ssh...
> 
> It's the Restoration of other_handles in auth's authServer.c's
> _Xauth_makeauth stub that poses problem. If I comment it, I'm not
> getting the issue... Any idea out of lucky mind?

Ah, perhaps nauth is 0 and thus In0P->other_handlesType.msgtl_number - 1
gets bogus, let me check.

Samuel

Reply via email to