summaryrefslogtreecommitdiff
path: root/debian/patches/exec_filename_fs.patch
blob: b8146f385856a661a9a968604bf14daa97f7c9fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
diff --git a/TODO b/TODO
index de2a199..9fdb86f 100644
--- a/TODO
+++ b/TODO
@@ -131,7 +131,7 @@ See `tasks', the exported task list.
 
 ** libtrivfs
 *** Allow for read/write/exec to be passed down.
-*** Implement file_exec when appropriate. !!
+*** Implement file_exec_file_name when appropriate. !!
 *** Provide for the visible owner, etc., to be held in command-line args
     instead of the underlying node, when it's important. !!
 
diff --git a/configure.ac b/configure.ac
index b03057b..b3abe1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,8 @@ else
   VERSIONING=no
 fi
 AC_SUBST(VERSIONING)
+# Check if libc contains these functions.
+AC_CHECK_FUNCS(file_exec_file_name exec_exec_file_name)
 
 
 # From glibc HEAD, 2007-11-07.
diff --git a/exec/hashexec.c b/exec/hashexec.c
index e53d2ee..36fcfb7 100644
--- a/exec/hashexec.c
+++ b/exec/hashexec.c
@@ -23,6 +23,9 @@
 #include <unistd.h>
 #include <envz.h>
 #include <sys/param.h>
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+#include <hurd/fs_experimental.h>
+#endif
 
 /* This is called to check E for a #! interpreter specification.  E has
    already been prepared (successfully) and checked (unsuccessfully).  If
@@ -415,16 +418,32 @@ check_hashbang (struct execdata *e,
     /* We cannot open the interpreter file to execute it.  Lose!  */
     return;
 
+#ifdef HAVE_FILE_EXEC_FILE_NAME
   /* Execute the interpreter program.  */
-  e->error = file_exec (interp_file,
-			oldtask, flags,
-			new_argv, new_argvlen, envp, envplen,
-			new_dtable ?: dtable, MACH_MSG_TYPE_COPY_SEND,
-			new_dtable ? new_dtablesize : dtablesize,
-			portarray, MACH_MSG_TYPE_COPY_SEND, nports,
-			intarray, nints,
-			deallocnames, ndeallocnames,
-			destroynames, ndestroynames);
+  e->error = file_exec_file_name (interp_file,
+				  oldtask, flags, interp,
+				  new_argv, new_argvlen, envp, envplen,
+				  new_dtable ?: dtable,
+				  MACH_MSG_TYPE_COPY_SEND,
+				  new_dtable ? new_dtablesize : dtablesize,
+				  portarray, MACH_MSG_TYPE_COPY_SEND, nports,
+				  intarray, nints,
+				  deallocnames, ndeallocnames,
+				  destroynames, ndestroynames);
+  /* For backwards compatibility.  Just drop it when we kill file_exec.  */
+  if (e->error == MIG_BAD_ID)
+#endif
+    e->error = file_exec (interp_file,
+			  oldtask, flags,
+			  new_argv, new_argvlen, envp, envplen,
+			  new_dtable ?: dtable, MACH_MSG_TYPE_COPY_SEND,
+			  new_dtable ? new_dtablesize : dtablesize,
+			  portarray, MACH_MSG_TYPE_COPY_SEND, nports,
+			  intarray, nints,
+			  deallocnames, ndeallocnames,
+			  destroynames, ndestroynames);
+
+
   mach_port_deallocate (mach_task_self (), interp_file);
   munmap (new_argv, new_argvlen);
 
diff --git a/hurd/fs.defs b/hurd/fs.defs
index a4a48cc..1322237 100644
--- a/hurd/fs.defs
+++ b/hurd/fs.defs
@@ -1,5 +1,6 @@
 /* Definitions for the filesystem interface.
-   Copyright (C) 1994,95,96,97,98,99,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2010
+   Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -35,7 +36,8 @@ INTR_INTERFACE
 /* Overlay a task with a file.  Necessary initialization, including
    authentication changes associated with set[ug]id execution must be
    handled by the filesystem.  Filesystems normally implement this by
-   using exec_newtask or exec_loadtask as appropriate.  */
+   using exec_newtask or exec_loadtask as appropriate.
+   Deprecated: use file_exec_file_name instead.  */
 routine file_exec (
 	exec_file: file_t;
 	RPT
@@ -129,8 +131,8 @@ routine file_lock_stat (
    (regardless of the current open modes for this port).  ALLOWED is a
    bitwise OR of O_READ, O_WRITE, and O_EXEC.  This is not necessarily the
    same as what an open or exec would allow; O_EXEC is set for root even if
-   no executable bits are on (in which case file_exec should fail) and
-   O_WRITE is set a directory can be modified, even though it can't be
+   no executable bits are on (in which case file_exec_file_name should fail)
+   and O_WRITE is set a directory can be modified, even though it can't be
    written directly.  */
 routine file_check_access (
 	file: file_t;
diff --git a/hurd/hurd_types.h b/hurd/hurd_types.h
index 4341177..83942a7 100644
--- a/hurd/hurd_types.h
+++ b/hurd/hurd_types.h
@@ -1,5 +1,6 @@
 /* C declarations for Hurd server interfaces
-   Copyright (C) 1993,94,95,96,98,99,2001,02 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002,
+   2010 Free Software Foundation, Inc.
 
 This file is part of the GNU Hurd.
 
@@ -81,7 +82,7 @@ typedef struct timespec timespec_t;
 /* Many such parameters and flags are also defined in various libc
    headers. */
 
-/* Bits for flags in fs.defs:file_exec and exec.defs:exec_* calls: */
+/* Bits for flags in fs.defs:file_exec_file_name and exec.defs:exec_* calls: */
 #define EXEC_NEWTASK	0x00000001 /* Create new task; kill old one.  */
 #define EXEC_SECURE	0x00000002 /* Use secure values of portarray, etc. */
 #define EXEC_DEFAULTS	0x00000004 /* Use defaults for unspecified ports.  */
@@ -347,7 +348,7 @@ typedef int *procinfo_t;
 #define FSTYPE_MEMFS   0x00000019 /* In-core filesystem */
 #define FSTYPE_ISO9660 0x0000001a /* ISO9660 */
 
-/* Standard port assignments for file_exec and exec_* */
+/* Standard port assignments for file_exec_file_name and exec_* */
 enum
   {
     INIT_PORT_CWDIR,
@@ -361,7 +362,7 @@ enum
     INIT_PORT_MAX
   };
 
-/* Standard ints for file_exec and exec_* */
+/* Standard ints for file_exec_file_name and exec_* */
 enum
   {
     INIT_UMASK,
diff --git a/libdiskfs/Makefile b/libdiskfs/Makefile
index 47b9339..6646dbe 100644
--- a/libdiskfs/Makefile
+++ b/libdiskfs/Makefile
@@ -56,7 +56,7 @@ OTHERSRCS = conch-fetch.c conch-set.c dir-clear.c dir-init.c dir-renamed.c \
 SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
 installhdrs = diskfs.h diskfs-pager.h
 
-MIGSTUBS = fsServer.o ioServer.o fsysServer.o exec_startupServer.o \
+MIGSTUBS = fsServer.o fs_experimentalServer.o ioServer.o fsysServer.o exec_startupServer.o \
 	fsys_replyUser.o fs_notifyUser.o ifsockServer.o \
 	startup_notifyServer.o
 OBJS = $(sort $(SRCS:.c=.o) $(MIGSTUBS))
@@ -66,6 +66,7 @@ LDLIBS += -lpthread
 
 fsys-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h -DREPLY_PORTS
 fs-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h
+fs_experimental-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h
 io-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h
 ifsock-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h
 exec_startup-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h
diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c
index d10d783..d80a4ca 100644
--- a/libdiskfs/boot-start.c
+++ b/libdiskfs/boot-start.c
@@ -198,7 +198,7 @@ diskfs_start_bootstrap ()
       diskfs_exec_ctl = MACH_PORT_NULL;	/* Not used after this.  */
     }
 
-  /* Cache the exec server port for file_exec to use.  */
+  /* Cache the exec server port for file_exec_file_name to use.  */
   _hurd_port_set (&_diskfs_exec_portcell, diskfs_exec);
 
   if (_diskfs_boot_command)
diff --git a/libdiskfs/demuxer.c b/libdiskfs/demuxer.c
index 4a1c4fb..ff33b1b 100644
--- a/libdiskfs/demuxer.c
+++ b/libdiskfs/demuxer.c
@@ -19,6 +19,7 @@
 
 #include "io_S.h"
 #include "fs_S.h"
+#include "fs_experimental_S.h"
 #include "../libports/notify_S.h"
 #include "fsys_S.h"
 #include "../libports/interrupt_S.h"
@@ -33,6 +34,7 @@ diskfs_demuxer (mach_msg_header_t *inp,
   mig_routine_t routine;
   if ((routine = diskfs_io_server_routine (inp)) ||
       (routine = diskfs_fs_server_routine (inp)) ||
+      (routine = diskfs_fs_experimental_server_routine (inp)) ||
       (routine = ports_notify_server_routine (inp)) ||
       (routine = diskfs_fsys_server_routine (inp)) ||
       (routine = ports_interrupt_server_routine (inp)) ||
diff --git a/libdiskfs/file-exec.c b/libdiskfs/file-exec.c
index e544b14..a491720 100644
--- a/libdiskfs/file-exec.c
+++ b/libdiskfs/file-exec.c
@@ -1,5 +1,6 @@
-/* File execution (file_exec RPC) for diskfs servers, using exec server.
-   Copyright (C) 1993,94,95,96,97,98,2000,02 Free Software Foundation, Inc.
+/* File execution (file_exec_file_name RPC) for diskfs servers, using exec server.
+   Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
+   2010 Free Software Foundation, Inc.
 
    This file is part of the GNU Hurd.
 
@@ -21,10 +22,14 @@
 
 #include "priv.h"
 #include "fs_S.h"
+#include "fs_experimental_S.h"
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <hurd/exec.h>
 #include <hurd/paths.h>
+#ifdef HAVE_EXEC_EXEC_FILE_NAME
+#include <hurd/exec_experimental.h>
+#endif
 #include <string.h>
 #include <idvec.h>
 
@@ -47,6 +52,39 @@ diskfs_S_file_exec (struct protid *cred,
 		    mach_port_t *destroynames,
 		    size_t destroynameslen)
 {
+  return diskfs_S_file_exec_file_name (cred,
+				       task,
+				       flags,
+				       "",
+				       argv, argvlen,
+				       envp, envplen,
+				       fds, fdslen,
+				       portarray, portarraylen,
+				       intarray, intarraylen,
+				       deallocnames, deallocnameslen,
+				       destroynames, destroynameslen);
+}
+
+kern_return_t
+diskfs_S_file_exec_file_name (struct protid *cred,
+			      task_t task,
+			      int flags,
+			      char *filename,
+			      char *argv,
+			      size_t argvlen,
+			      char *envp,
+			      size_t envplen,
+			      mach_port_t *fds,
+			      size_t fdslen,
+			      mach_port_t *portarray,
+			      size_t portarraylen,
+			      int *intarray,
+			      size_t intarraylen,
+			      mach_port_t *deallocnames,
+			      size_t deallocnameslen,
+			      mach_port_t *destroynames,
+			      size_t destroynameslen)
+{
   struct node *np;
   uid_t uid;
   gid_t gid;
@@ -136,9 +174,9 @@ diskfs_S_file_exec (struct protid *cred,
 
   if (! err)
     /* Make a new peropen for the exec server to access the file, since any
-       seeking the exec server might want to do should not affect the
-       original peropen on which file_exec was called.  (The new protid for
-       this peropen clones the caller's iouser to preserve the caller's
+       seeking the exec server might want to do should not affect the original
+       peropen on which file_exec_file_name was called.  (The new protid
+       for this peropen clones the caller's iouser to preserve the caller's
        authentication credentials.)  The new peropen's openmodes must have
        O_READ even if the caller had only O_EXEC privilege, so the exec
        server can read the executable file.  We also include O_EXEC so that
@@ -159,14 +197,31 @@ diskfs_S_file_exec (struct protid *cred,
       do
 	{
 	  right = ports_get_send_right (newpi);
-	  err = exec_exec (execserver,
-			   right, MACH_MSG_TYPE_COPY_SEND,
-			   task, flags, argv, argvlen, envp, envplen,
-			   fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
-			   portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
-			   intarray, intarraylen,
-			   deallocnames, deallocnameslen,
-			   destroynames, destroynameslen);
+#ifdef HAVE_EXEC_EXEC_FILE_NAME
+	  err = exec_exec_file_name (execserver,
+				     right, MACH_MSG_TYPE_COPY_SEND,
+				     task, flags, filename,
+				     argv, argvlen, envp, envplen,
+				     fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+				     portarray, MACH_MSG_TYPE_COPY_SEND,
+				     portarraylen,
+				     intarray, intarraylen,
+				     deallocnames, deallocnameslen,
+				     destroynames, destroynameslen);
+	  /* For backwards compatibility.  Just drop it when we kill
+	     exec_exec.  */
+	  if (err == MIG_BAD_ID)
+#endif
+	    err = exec_exec (execserver,
+			     right, MACH_MSG_TYPE_COPY_SEND,
+			     task, flags, argv, argvlen, envp, envplen,
+			     fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+			     portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
+			     intarray, intarraylen,
+			     deallocnames, deallocnameslen,
+			     destroynames, destroynameslen);
+
+
 	  mach_port_deallocate (mach_task_self (), right);
 	  if (err == MACH_SEND_INVALID_DEST)
 	    {
diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c
index 8b00e08..f0966aa 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -1,5 +1,6 @@
 /*
-   Copyright (C) 1995,96,99,2000,02, 04 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1999, 2000, 2002, 2004, 2010
+   Free Software Foundation, Inc.
    Written by Miles Bader and Michael I. Bushnell.
 
    This file is part of the GNU Hurd.
@@ -27,6 +28,9 @@
 #include <string.h>
 #include <assert.h>
 #include "fshelp.h"
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+#include <hurd/fs_experimental.h>
+#endif
 
 
 /* The data passed in the various messages we're interested in.  */
@@ -272,12 +276,22 @@ fshelp_start_translator_long (fshelp_open_fn_t underlying_open_fn,
   saveport = ports[INIT_PORT_BOOTSTRAP];
   ports[INIT_PORT_BOOTSTRAP] = bootstrap;
 
+#ifdef HAVE_FILE_EXEC_FILE_NAME
   /* Try and exec the translator in TASK...  */
-  err = file_exec (executable, task, EXEC_DEFAULTS,
-		   argz, argz_len, 0, 0,
-		   fds, fds_type, fds_len,
-		   ports, ports_type, ports_len,
-		   ints, ints_len, 0, 0, 0, 0);
+  err = file_exec_file_name (executable, task, EXEC_DEFAULTS, name,
+			     argz, argz_len, 0, 0,
+			     fds, fds_type, fds_len,
+			     ports, ports_type, ports_len,
+			     ints, ints_len, 0, 0, 0, 0);
+  /* For backwards compatibility.  Just drop it when we kill file_exec.  */
+  if (err == MIG_BAD_ID)
+#endif
+    err = file_exec (executable, task, EXEC_DEFAULTS,
+		     argz, argz_len, 0, 0,
+		     fds, fds_type, fds_len,
+		     ports, ports_type, ports_len,
+		     ints, ints_len, 0, 0, 0, 0);
+
   ports_moved = 1;
 
   if (ports_type == MACH_MSG_TYPE_COPY_SEND)
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index c3830c0..4aade5a 100644
--- a/libnetfs/Makefile
+++ b/libnetfs/Makefile
@@ -59,12 +59,13 @@ SRCS= $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS)
 
 installhdrs=netfs.h
 
-MIGSTUBS= ioServer.o fsServer.o fsysServer.o fsys_replyUser.o ifsockServer.o
+MIGSTUBS= ioServer.o fsServer.o fs_experimentalServer.o fsysServer.o fsys_replyUser.o ifsockServer.o
 
 OBJS=$(sort $(SRCS:.c=.o) $(MIGSTUBS))
 
 fsys-MIGSFLAGS = -imacros $(srcdir)/mutations.h -DREPLY_PORTS
 fs-MIGSFLAGS = -imacros $(srcdir)/mutations.h
+fs_experimental-MIGSFLAGS = -imacros $(srcdir)/mutations.h
 io-MIGSFLAGS = -imacros $(srcdir)/mutations.h
 ifsock-MIGSFLAGS = -imacros $(srcdir)/mutations.h
 MIGCOMSFLAGS = -prefix netfs_
diff --git a/libnetfs/demuxer.c b/libnetfs/demuxer.c
index 4c20ab6..bf78812 100644
--- a/libnetfs/demuxer.c
+++ b/libnetfs/demuxer.c
@@ -22,6 +22,7 @@
 
 #include "io_S.h"
 #include "fs_S.h"
+#include "fs_experimental_S.h"
 #include "../libports/notify_S.h"
 #include "fsys_S.h"
 #include "../libports/interrupt_S.h"
@@ -34,6 +35,7 @@ netfs_demuxer (mach_msg_header_t *inp,
   mig_routine_t routine;
   if ((routine = netfs_io_server_routine (inp)) ||
       (routine = netfs_fs_server_routine (inp)) ||
+      (routine = netfs_fs_experimental_server_routine (inp)) ||
       (routine = ports_notify_server_routine (inp)) ||
       (routine = netfs_fsys_server_routine (inp)) ||
       (routine = ports_interrupt_server_routine (inp)) ||
diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index 638f0ae..ffaf598 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -1,5 +1,6 @@
 /*
-   Copyright (C) 1996,97,2000,01,02 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 2000, 2001, 2002, 2010
+   Free Software Foundation, Inc.
    Written by Michael I. Bushnell, p/BSG.
 
    This file is part of the GNU Hurd.
@@ -23,10 +24,14 @@
 #include "netfs.h"
 #include "execserver.h"
 #include "fs_S.h"
+#include "fs_experimental_S.h"
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <hurd/exec.h>
 #include <hurd/paths.h>
+#ifdef HAVE_EXEC_EXEC_FILE_NAME
+#include <hurd/exec_experimental.h>
+#endif
 #include <string.h>
 #include <idvec.h>
 
@@ -49,6 +54,39 @@ netfs_S_file_exec (struct protid *cred,
 		   mach_port_t *destroynames,
 		   size_t destroynameslen)
 {
+  return netfs_S_file_exec_file_name (cred,
+				      task,
+				      flags,
+				      "",
+				      argv, argvlen,
+				      envp, envplen,
+				      fds, fdslen,
+				      portarray, portarraylen,
+				      intarray, intarraylen,
+				      deallocnames, deallocnameslen,
+				      destroynames, destroynameslen);
+}
+
+kern_return_t
+netfs_S_file_exec_file_name (struct protid *cred,
+			     task_t task,
+			     int flags,
+			     char *filename,
+			     char *argv,
+			     size_t argvlen,
+			     char *envp,
+			     size_t envplen,
+			     mach_port_t *fds,
+			     size_t fdslen,
+			     mach_port_t *portarray,
+			     size_t portarraylen,
+			     int *intarray,
+			     size_t intarraylen,
+			     mach_port_t *deallocnames,
+			     size_t deallocnameslen,
+			     mach_port_t *destroynames,
+			     size_t destroynameslen)
+{
   struct node *np;
   error_t err;
   uid_t uid;
@@ -133,14 +171,31 @@ netfs_S_file_exec (struct protid *cred,
 	  if (newpi)
 	    {
 	      right = ports_get_send_right (newpi);
-	      err = exec_exec (_netfs_exec,
-			       right, MACH_MSG_TYPE_COPY_SEND,
-			       task, flags, argv, argvlen, envp, envplen,
-			       fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
-			       portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
-			       intarray, intarraylen,
-			       deallocnames, deallocnameslen,
-			       destroynames, destroynameslen);
+#ifdef HAVE_EXEC_EXEC_FILE_NAME
+	      err = exec_exec_file_name (_netfs_exec,
+					 right, MACH_MSG_TYPE_COPY_SEND,
+					 task, flags, filename,
+					 argv, argvlen, envp, envplen,
+					 fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+					 portarray, MACH_MSG_TYPE_COPY_SEND,
+					 portarraylen,
+					 intarray, intarraylen,
+					 deallocnames, deallocnameslen,
+					 destroynames, destroynameslen);
+	      /* For backwards compatibility.  Just drop it when we kill
+		 exec_exec.  */
+	      if (err == MIG_BAD_ID)
+#endif
+		err = exec_exec (_netfs_exec,
+				 right, MACH_MSG_TYPE_COPY_SEND,
+				 task, flags, argv, argvlen, envp, envplen,
+				 fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+				 portarray, MACH_MSG_TYPE_COPY_SEND,
+				 portarraylen,
+				 intarray, intarraylen,
+				 deallocnames, deallocnameslen,
+				 destroynames, destroynameslen);
+
 	      mach_port_deallocate (mach_task_self (), right);
 	      ports_port_deref (newpi);
 	    }
diff --git a/libtrivfs/Makefile b/libtrivfs/Makefile
index 48a53d7..c440101 100644
--- a/libtrivfs/Makefile
+++ b/libtrivfs/Makefile
@@ -44,7 +44,7 @@ OTHERSRCS=demuxer.c protid-clean.c protid-dup.c cntl-create.c \
 
 SRCS=$(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(OTHERSRCS)
 
-MIGSTUBS=fsServer.o ioServer.o fsysServer.o fsys_replyUser.o
+MIGSTUBS=fsServer.o fs_experimentalServer.o ioServer.o fsysServer.o fsys_replyUser.o
 
 libname = libtrivfs
 HURDLIBS = fshelp iohelp ports shouldbeinlibc
@@ -54,6 +54,10 @@ MIGCOMSFLAGS = -prefix trivfs_
 installhdrs := trivfs.h
 mig-sheader-prefix = trivfs_
 
+ifndef no_deps
+installhdrs += $(patsubst %,trivfs_%_S.h,fs fs_experimental io fsys)
+endif
+
 include ../Makeconf
 
 $(MIGSTUBS:%Server.o=%.sdefsi): $(srcdir)/mig-mutate.h
diff --git a/libtrivfs/demuxer.c b/libtrivfs/demuxer.c
index 8c1afe6..55229da 100644
--- a/libtrivfs/demuxer.c
+++ b/libtrivfs/demuxer.c
@@ -23,6 +23,7 @@
 
 #include "trivfs_io_S.h"
 #include "trivfs_fs_S.h"
+#include "trivfs_fs_experimental_S.h"
 #include "../libports/notify_S.h"
 #include "trivfs_fsys_S.h"
 #include "../libports/interrupt_S.h"
@@ -34,6 +35,7 @@ trivfs_demuxer (mach_msg_header_t *inp,
   mig_routine_t routine;
   if ((routine = trivfs_io_server_routine (inp)) ||
       (routine = trivfs_fs_server_routine (inp)) ||
+      (routine = trivfs_fs_experimental_server_routine (inp)) ||
       (routine = ports_notify_server_routine (inp)) ||
       (routine = trivfs_fsys_server_routine (inp)) ||
       (routine = ports_interrupt_server_routine (inp)))
diff --git a/libtrivfs/file-exec.c b/libtrivfs/file-exec.c
index b353d8a..5f873c7 100644
--- a/libtrivfs/file-exec.c
+++ b/libtrivfs/file-exec.c
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1994,2002 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2002, 2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -41,3 +41,28 @@ trivfs_S_file_exec (trivfs_protid_t exec_file,
 {
   return EOPNOTSUPP;
 }
+
+kern_return_t
+trivfs_S_file_exec_file_name (trivfs_protid_t exec_file,
+			      mach_port_t reply,
+			      mach_msg_type_name_t replyPoly,
+			      mach_port_t exec_task,
+			      int flags,
+			      string_t filename,
+			      data_t argv,
+			      mach_msg_type_number_t argvCnt,
+			      data_t envp,
+			      mach_msg_type_number_t envpCnt,
+			      portarray_t fdarray,
+			      mach_msg_type_number_t fdarrayCnt,
+			      portarray_t portarray,
+			      mach_msg_type_number_t portarrayCnt,
+			      intarray_t intarray,
+			      mach_msg_type_number_t intarrayCnt,
+			      mach_port_array_t deallocnames,
+			      mach_msg_type_number_t deallocnamesCnt,
+			      mach_port_array_t destroynames,
+			      mach_msg_type_number_t destroynamesCnt)
+{
+  return EOPNOTSUPP;
+}
diff --git a/startup/startup.c b/startup/startup.c
index e916768..db30b65 100644
--- a/startup/startup.c
+++ b/startup/startup.c
@@ -1,7 +1,7 @@
 /* Start and maintain hurd core servers and system run state
 
    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-     2005, 2008, 2013 Free Software Foundation, Inc.
+     2005, 2008, 2010, 2013 Free Software Foundation, Inc.
    This file is part of the GNU Hurd.
 
    The GNU Hurd is free software; you can redistribute it and/or modify
@@ -24,6 +24,9 @@
    one file. */
 #include <hurd.h>
 #include <hurd/fs.h>
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+#include <hurd/fs_experimental.h>
+#endif
 #include <hurd/fsys.h>
 #include <device/device.h>
 #include <stdio.h>
@@ -377,13 +380,28 @@ run (const char *server, mach_port_t *ports, task_t *task)
 	      printf ("Pausing for %s\n", prog);
 	      getchar ();
 	    }
-	  err = file_exec (file, *task, 0,
-			   (char *)prog, strlen (prog) + 1, /* Args.  */
-			   startup_envz, startup_envz_len,
-			   default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
-			   ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
-			   default_ints, INIT_INT_MAX,
-			   NULL, 0, NULL, 0);
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+	  err = file_exec_file_name (file, *task, 0, (char *)prog,
+				     (char *)prog,
+				     strlen (prog) + 1, /* Args.  */
+				     startup_envz, startup_envz_len,
+				     default_dtable,
+				     MACH_MSG_TYPE_COPY_SEND, 3,
+				     ports, MACH_MSG_TYPE_COPY_SEND,
+				     INIT_PORT_MAX,
+				     default_ints, INIT_INT_MAX,
+				     NULL, 0, NULL, 0);
+	  /* For backwards compatibility.  Just drop it when we kill
+	     file_exec.  */
+	  if (err == MIG_BAD_ID)
+#endif
+	    err = file_exec (file, *task, 0,
+			     (char *)prog, strlen (prog) + 1, /* Args.  */
+			     startup_envz, startup_envz_len,
+			     default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
+			     ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+			     default_ints, INIT_INT_MAX,
+			     NULL, 0, NULL, 0);
 	  if (!err)
 	    break;
 
@@ -470,14 +488,27 @@ run_for_real (char *filename, char *args, int arglen, mach_port_t ctty,
     ++progname;
   else
     progname = filename;
-  err = file_exec (file, task, 0,
-		   args, arglen,
-		   startup_envz, startup_envz_len,
-		   default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
-		   default_ports, MACH_MSG_TYPE_COPY_SEND,
-		   INIT_PORT_MAX,
-		   default_ints, INIT_INT_MAX,
-		   NULL, 0, NULL, 0);
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+  err = file_exec_file_name (file, task, 0, filename,
+			     args, arglen,
+			     startup_envz, startup_envz_len,
+			     default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
+			     default_ports, MACH_MSG_TYPE_COPY_SEND,
+			     INIT_PORT_MAX,
+			     default_ints, INIT_INT_MAX,
+			     NULL, 0, NULL, 0);
+  /* For backwards compatibility.  Just drop it when we kill file_exec.  */
+  if (err == MIG_BAD_ID)
+#endif
+    err = file_exec (file, task, 0,
+		     args, arglen,
+		     startup_envz, startup_envz_len,
+		     default_dtable, MACH_MSG_TYPE_COPY_SEND, 3,
+		     default_ports, MACH_MSG_TYPE_COPY_SEND,
+		     INIT_PORT_MAX,
+		     default_ints, INIT_INT_MAX,
+		     NULL, 0, NULL, 0);
+
   mach_port_deallocate (mach_task_self (), default_ports[INIT_PORT_PROC]);
   mach_port_deallocate (mach_task_self (), task);
   if (ctty != MACH_PORT_NULL)
@@ -1075,13 +1106,26 @@ start_child (const char *prog, char **progargs)
       getchar ();
     }
 
-  err = file_exec (file, child_task, 0,
-		   args, arglen,
-		   startup_envz, startup_envz_len,
-		   NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds.  */
-		   default_ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
-		   default_ints, INIT_INT_MAX,
-		   NULL, 0, NULL, 0);
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+  err = file_exec_file_name (file, child_task, 0, args,
+			     args, arglen,
+			     startup_envz, startup_envz_len,
+			     NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds.  */
+			     default_ports, MACH_MSG_TYPE_COPY_SEND,
+			     INIT_PORT_MAX,
+			     default_ints, INIT_INT_MAX,
+			     NULL, 0, NULL, 0);
+  /* For backwards compatibility.  Just drop it when we kill file_exec.  */
+  if (err == MIG_BAD_ID)
+#endif
+    err = file_exec (file, child_task, 0,
+		     args, arglen,
+		     startup_envz, startup_envz_len,
+		     NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds.  */
+		     default_ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+		     default_ints, INIT_INT_MAX,
+		     NULL, 0, NULL, 0);
+
   proc_mark_important (default_ports[INIT_PORT_PROC]);
   mach_port_deallocate (mach_task_self (), default_ports[INIT_PORT_PROC]);
   mach_port_deallocate (mach_task_self (), file);
diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 76fc901..adbd07d 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -28,10 +28,14 @@
 #include <pthread.h>
 #include <hurd/ihash.h>
 #include <hurd/paths.h>
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+#include <hurd/fs_experimental.h>
+#endif
 
 #include <version.h>
 
 #include "libnetfs/fs_S.h"
+#include "libnetfs/fs_experimental_S.h"
 #include "libnetfs/io_S.h"
 #include "libnetfs/fsys_S.h"
 #include "libports/notify_S.h"
@@ -820,23 +824,24 @@ netfs_file_get_storage_info (struct iouser *cred,
 }
 
 kern_return_t
-netfs_S_file_exec (struct protid *user,
-                   task_t task,
-                   int flags,
-                   char *argv,
-                   size_t argvlen,
-                   char *envp,
-                   size_t envplen,
-                   mach_port_t *fds,
-                   size_t fdslen,
-                   mach_port_t *portarray,
-                   size_t portarraylen,
-                   int *intarray,
-                   size_t intarraylen,
-                   mach_port_t *deallocnames,
-                   size_t deallocnameslen,
-                   mach_port_t *destroynames,
-                   size_t destroynameslen)
+netfs_S_file_exec_file_name (struct protid *user,
+			     task_t task,
+			     int flags,
+			     char *filename,
+			     char *argv,
+			     size_t argvlen,
+			     char *envp,
+			     size_t envplen,
+			     mach_port_t *fds,
+			     size_t fdslen,
+			     mach_port_t *portarray,
+			     size_t portarraylen,
+			     int *intarray,
+			     size_t intarraylen,
+			     mach_port_t *deallocnames,
+			     size_t deallocnameslen,
+			     mach_port_t *destroynames,
+			     size_t destroynameslen)
 {
   error_t err;
   file_t file;
@@ -855,14 +860,30 @@ netfs_S_file_exec (struct protid *user,
 
   if (!err)
     {
+#ifdef HAVE_FILE_EXEC_FILE_NAME
       /* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to
 	 retry an interrupted call that would have consumed the rights.  */
-      err = file_exec (netfs_node_netnode (user->po->np)->file,
-		       task, flags, argv, argvlen,
-		       envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
-		       portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
-		       intarray, intarraylen, deallocnames, deallocnameslen,
-		       destroynames, destroynameslen);
+      err = file_exec_file_name (netfs_node_netnode (user->po->np)->file,
+				 task, flags,
+				 filename,
+				 argv, argvlen,
+				 envp, envplen,
+				 fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+				 portarray, MACH_MSG_TYPE_COPY_SEND,
+				 portarraylen,
+				 intarray, intarraylen,
+				 deallocnames, deallocnameslen,
+				 destroynames, destroynameslen);
+      /* For backwards compatibility.  Just drop it when we kill
+	 file_exec.  */
+      if (err == MIG_BAD_ID)
+#endif
+	err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen,
+			 envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen,
+			 portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen,
+			 intarray, intarraylen, deallocnames, deallocnameslen,
+			 destroynames, destroynameslen);
+
       mach_port_deallocate (mach_task_self (), file);
     }
 
@@ -878,6 +899,38 @@ netfs_S_file_exec (struct protid *user,
   return err;
 }
 
+kern_return_t
+netfs_S_file_exec (struct protid *user,
+                   task_t task,
+                   int flags,
+                   char *argv,
+                   size_t argvlen,
+                   char *envp,
+                   size_t envplen,
+                   mach_port_t *fds,
+                   size_t fdslen,
+                   mach_port_t *portarray,
+                   size_t portarraylen,
+                   int *intarray,
+                   size_t intarraylen,
+                   mach_port_t *deallocnames,
+                   size_t deallocnameslen,
+                   mach_port_t *destroynames,
+                   size_t destroynameslen)
+{
+  return netfs_S_file_exec_file_name (user,
+				      task,
+				      flags,
+				      "",
+				      argv, argvlen,
+				      envp, envplen,
+				      fds, fdslen,
+				      portarray, portarraylen,
+				      intarray, intarraylen,
+				      deallocnames, deallocnameslen,
+				      destroynames, destroynameslen);
+}
+
 error_t
 netfs_S_io_map (struct protid *user,
 		mach_port_t *rdobj, mach_msg_type_name_t *rdobjtype,
@@ -994,6 +1047,7 @@ netfs_demuxer (mach_msg_header_t *inp,
   mig_routine_t routine;
   if ((routine = netfs_io_server_routine (inp)) ||
       (routine = netfs_fs_server_routine (inp)) ||
+      (routine = netfs_fs_experimental_server_routine (inp)) ||
       (routine = ports_notify_server_routine (inp)) ||
       (routine = netfs_fsys_server_routine (inp)) ||
       /* XXX we should intercept interrupt_operation and do
diff --git a/utils/login.c b/utils/login.c
index 9ee296a..cc04715 100644
--- a/utils/login.c
+++ b/utils/login.c
@@ -1,6 +1,7 @@
 /* Hurdish login
 
-   Copyright (C) 1995,96,97,98,99,2002 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2010
+   Free Software Foundation, Inc.
 
    Written by Miles Bader <miles@gnu.org>
 
@@ -46,6 +47,9 @@
 #include <error.h>
 #include <timefmt.h>
 #include <hurd/lookup.h>
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+#include <hurd/fs_experimental.h>
+#endif
 #include <ugids.h>
 
 const char *argp_program_version = STANDARD_HURD_VERSION (login);
@@ -882,12 +886,22 @@ main(int argc, char *argv[])
 	}
     }
 
-  err = file_exec (exec, mach_task_self (), EXEC_DEFAULTS,
-		   sh_args, sh_args_len, env, env_len,
-		   fds, MACH_MSG_TYPE_COPY_SEND, 3,
-		   ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
-		   ints, INIT_INT_MAX,
-		   0, 0, 0, 0);
+#ifdef HAVE_FILE_EXEC_FILE_NAME
+  err = file_exec_file_name (exec, mach_task_self (), EXEC_DEFAULTS, shell,
+			     sh_args, sh_args_len, env, env_len,
+			     fds, MACH_MSG_TYPE_COPY_SEND, 3,
+			     ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+			     ints, INIT_INT_MAX,
+			     0, 0, 0, 0);
+  /* Fallback in case the file server hasn't been restarted.  */
+  if (err == MIG_BAD_ID)
+#endif
+    err = file_exec (exec, mach_task_self (), EXEC_DEFAULTS,
+		     sh_args, sh_args_len, env, env_len,
+		     fds, MACH_MSG_TYPE_COPY_SEND, 3,
+		     ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX,
+		     ints, INIT_INT_MAX,
+		     0, 0, 0, 0);
   if (err)
     error(5, err, "%s", shell);