One-line build-test from busybox statically built segfaults on GNU/Hurd

2014-11-20 Thread Svante Signell
Hi, from the debian-hurd IRC, with inlined comments:

(11:03:58) mjt: hello. it looks like hurd-i386 is the only arch where my
one-line build-test program fails -- see
https://buildd.debian.org/status/package.php?p=busybox

Checking if libc can produce working static binaries
echo 'int main(void) { return getpwnam(root) ? 0 : 1; }'  build/test754813.c
cc -static -o build/test754813 build/test754813.c
/tmp/ccKyLKAT.o: In function `main':
test754813.c:(.text+0x1a): warning: Using 'getpwnam' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
Segmentation fault
E: your libc does not produce working statically linked binaries
E: glibc-2.19 is known to have this bug: http://bugs.debian.org/754813
E: and https://sourceware.org/bugzilla/show_bug.cgi?id=17250
E: please update your libc

(11:04:07) mjt: what should I do with that?
(11:23:09) srs: mjt: I get the same error message on GNU/Linux too
(11:23:32) mjt: gnu_srs: which error message? segmentation fault?
(11:23:44) mjt: it is the sigsegv which is problematic, not the gcc
warning
(11:23:52) srs: test754813.c:(.text+0xf): warning: Using 'getpwnam' in
statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
(11:24:04) mjt: yes, that's expected. now run the binary.
(11:24:13) mjt: on hurd it sigsegvs
(11:25:52) srs: You are right: on Linux: echo $?: 1, on Hurd a segfault
(11:26:13) mjt: heh. your libc on linux is broken too :)

Fixed for Linux in glibc-2.19-12, I have 2.19-11 installed.

(11:26:34) mjt: (the whole thing is a test for #754813)
(11:26:39) zwiebelbot: (notice) Debian#754813: libc6 version 2.19 breaks
NSS loading for static binaries - https://bugs.debian.org/754813
(11:27:13) mjt: but that doesn't matter, the prob is the segfault
(11:28:37) srs: seems to be an infinite loop, the gdb backtrace is
repeating over and over
(11:32:53) srs: youpi: http://paste.debian.net/131738/

Partial gdb output:

(gdb) run
[New Thread 19835.10]
Program received signal SIGSEGV, Segmentation fault.
__mach_port_mod_refs (task=0, name=131212, right=1, delta=-1)
at .../hurd-i386-libc/mach/RPC_mach_port_mod_refs.c:48

(gdb) thread apply all bt
Thread 5 (Thread 19835.10):
#0  0x080a51bc in mach_msg_trap ()
#1  0x0809e323 in mach_msg ()
#2  0x080a530e in mach_msg_server_timeout ()
#3  0x080a53df in mach_msg_server ()
#4  0x0809ef16 in _hurd_msgport_receive ()
#5  0x66688b92 in ?? ()

Thread 4 (Thread 19835.9):
#0  __mach_port_mod_refs (task=0, name=131212, right=1, delta=-1)
.../hurd-i386-libc/mach/RPC_mach_port_mod_refs.c:48
#1  0x0107f57a in __mig_dealloc_reply_port (arg=131212)
at ../sysdeps/mach/hurd/mig-reply.c:46
#2  0x01253714 in __mach_port_mod_refs (task=0, name=131211, right=1,
delta=-1) at .../hurd-i386-libc/mach/RPC_mach_port_mod_refs.c:137
#3  0x0107f57a in __mig_dealloc_reply_port (arg=131211)
at ../sysdeps/mach/hurd/mig-reply.c:46
#4  0x01253714 in __mach_port_mod_refs (task=0, name=131210, right=1,
delta=-1) at .../hurd-i386-libc/mach/RPC_mach_port_mod_refs.c:137
repeating over and over

(13:53:58) srs: youpi: rpctrace ./test754813:
http://paste.debian.net/131758/

Tail of rpctrace:
  114--127(pid-1)- 2400 ( thread109(pid2632)  task107(pid2632) 1 2
4060) ...126
  116--121(pid2632)-proc_dostop_request ( thread112(pid2632)) = 0 
  64--119(pid2632)-dir_lookup (servers/crash 0 0) = 0 1 
110--132(pid2632)
task107(pid2632)-mach_port_mod_refs (pn{  6} 0 1) = 0 
  87--118(pid2632)-dir_mkfile (18 384) = 0136--135(pid2632)
  110--132(pid2632)-crash_dump_task ( task107(pid2632)136--135(pid2632) 
11 2 2 1 2 406094--122(pid2632)) ...111
 126-   71 ();
111... = 0 
Child 2632 Segmentation fault

(14:04:32) mjt: wow
(14:07:30) youpi: gnu_srs: I had noticed it and kept it in my mbox yes
(thus the build-attempted state, not failed)
(14:07:55) youpi: this is probably an issue with symbols
(14:08:13) youpi: for some functions we have actually two versions
(14:08:25) youpi: one which makes an RPC, and one which makes a
systemcall
(14:08:43) youpi: RPC code is supposed to use only the versions that
make a systemcall
(14:08:50) youpi: but apparently that's not the case here
(14:09:08) youpi: and thus RPC code use an RPC, i.e. the RPC code, which
uses an RPC, etc. etc.

Can anybody help with ideas on how to find this bug?

Thanks!




Re: Release process rolling new releases

2014-11-20 Thread Justus Winter
Quoting Samuel Thibault (2014-11-20 00:59:23)
 I'm however wondering: I don't see much reviewing being done apart
 from mine.  It would help if some people could spend time on reviewing
 patches.  I'm not saying taking responsibility for the commit step or
 anything, but just proofreading the source code.  That is what takes
 time before committing, and thus what prevents me from giving an ack on
 something for which I already agree on the principle...

I agree.  Either more people have to review the patches, or we need to
change the commit policy.

Also, let's just merge the startup patch series.  The hairy part of it
has been tested in Debian Hurd for a year now.  We agree on the
principle, and noone took the time or cared enough to disagree with
the patch series.

The glibc change is trivial.  And even if the change is not applied to
the glibc, it only breaks the system shutdown.  Furthermore, I believe
that we, the Hurd developers, should be entitled to make such a change
without the explicit consent of the glibc developers.  If this is not
the case, then I do not believe that developing the Hurd is very
practical, or even possible, given that half of the Hurd system is
implemented in the glibc.

Justus



Re: [PATCH 4/8] init: add a minimalist init program

2014-11-20 Thread Samuel Thibault
Justus Winter, le Wed 03 Sep 2014 14:33:12 +0200, a écrit :
 +# This is necessary to make stat / return the correct device ids.
 +# Work around a race condition (probably in the root translator).
 +for i in `seq 1 10` ; do : ; done

Please at least put XXX here, so it hopefully will get investigated
sometime.

With this little change, please commit this patch series, thanks!

Samuel



Re: [PATCH hurd 1/9] Makeconf: handle the gnumach protocol

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:31:54 +0100, a écrit :
 * Makeconf (mach_defs_names): Add `gnumach'.

Ack.

 ---
  Makeconf | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/Makeconf b/Makeconf
 index 32eec13..f0d3fe3 100644
 --- a/Makeconf
 +++ b/Makeconf
 @@ -575,7 +575,9 @@ vpath %.defs $(top_srcdir)/hurd
  # These we want to find in the libc include directory...
  mach_defs_names = bootstrap exc mach mach4 \
   mach_host mach_port mach_timer_reply memory_object \
 - memory_object_default notify
 + memory_object_default notify \
 + gnumach \
 +
  mach_debug_defs_names = mach_debug
  device_defs_names = dev_forward device device_reply device_request
  
 -- 
 2.1.1
 

-- 
Samuel
s cool, j'ai un rapport a rendre pour le 31 decembre a minuit...
 -+- #ens-mim - bonne année ! -+-



Re: [PATCH hurd 2/9] proc: gracefully handle failure to increase priority

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:31:55 +0100, a écrit :
 * proc/main.c (increase_priority): New function.
 (main): Move code increasing the proc servers priority to a new
 function and handle errors gracefully.

Ack.

 ---
  proc/main.c | 44 
  1 file changed, 32 insertions(+), 12 deletions(-)
 
 diff --git a/proc/main.c b/proc/main.c
 index f1f4e1b..3419d44 100644
 --- a/proc/main.c
 +++ b/proc/main.c
 @@ -60,12 +60,40 @@ message_demuxer (mach_msg_header_t *inp,
  
  pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
  
 +error_t
 +increase_priority (void)
 +{
 +  mach_port_t pset = MACH_PORT_NULL, psetcntl = MACH_PORT_NULL;
 +  error_t err;
 +
 +  err = thread_get_assignment (mach_thread_self (), pset);
 +  if (err)
 +goto out;
 +
 +  err = host_processor_set_priv (_hurd_host_priv, pset, psetcntl);
 +  if (err)
 +goto out;
 +
 +  err = thread_max_priority (mach_thread_self (), psetcntl, 0);
 +  if (err)
 +goto out;
 +
 +  err = task_priority (mach_task_self (), 2, 1);
 +
 + out:
 +  if (MACH_PORT_VALID (pset))
 +mach_port_deallocate (mach_task_self (), pset);
 +  if (MACH_PORT_VALID (psetcntl))
 +mach_port_deallocate (mach_task_self (), psetcntl);
 +
 +  return err;
 +}
 +
  int
  main (int argc, char **argv, char **envp)
  {
mach_port_t boot;
error_t err;
 -  mach_port_t pset, psetcntl;
void *genport;
process_t startup_port;
struct argp argp = { 0, 0, 0, Hurd process server };
 @@ -120,17 +148,9 @@ main (int argc, char **argv, char **envp)
  
/* Give ourselves good scheduling performance, because we are so
   important. */
 -  err = thread_get_assignment (mach_thread_self (), pset);
 -  assert_perror (err);
 -  err = host_processor_set_priv (_hurd_host_priv, pset, psetcntl);
 -  assert_perror (err);
 -  thread_max_priority (mach_thread_self (), psetcntl, 0);
 -  assert_perror (err);
 -  err = task_priority (mach_task_self (), 2, 1);
 -  assert_perror (err);
 -
 -  mach_port_deallocate (mach_task_self (), pset);
 -  mach_port_deallocate (mach_task_self (), psetcntl);
 +  err = increase_priority ();
 +  if (err)
 +error (0, err, Increasing priority failed);
  
{
  /* Get our stderr set up to print on the console, in case we have
 -- 
 2.1.1
 

-- 
Samuel
«Le monochrome, c'est pour ceux qui s'intéressent (encore) au contenu. 
 Usenet dans ces conditions, c'est comme le web avec lynx, on prend 
 trop conscience du vide, c'est déprimant.»
-+- JLC in Guide du linuxien pervers : Coup de cafard... -+-



Re: [PATCH hurd 3/9] startup: also open `console' for reading

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:31:56 +0100, a écrit :
 * startup/startup.c (main): Also open `console' for reading.

Ack.

 ---
  startup/startup.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/startup/startup.c b/startup/startup.c
 index ff58270..e177075 100644
 --- a/startup/startup.c
 +++ b/startup/startup.c
 @@ -557,7 +557,7 @@ main (int argc, char **argv, char **envp)
   master device ports, and the console.  */
if (task_get_bootstrap_port (mach_task_self (), bootport)
|| fsys_getpriv (bootport, host_priv, device_master, fstask)
 -  || device_open (device_master, D_WRITE, console, consdev))
 +  || device_open (device_master, D_READ|D_WRITE, console, consdev))
  crash_mach ();
  
wire_task_self ();
 -- 
 2.1.1
 

-- 
Samuel
 Les roots ne sont plus ce qu'ils étaient...Maintenant il sont dioxinés,
 c'est de la m... ! Avant on les élevaient avec du bon unix mais ça été
 remplacé par des farines industrielles nouvelles technologies (NT).
 -+- JdK in NPC : Exigez un root élevé sous la mère ! -+-



Re: [PATCH hurd 5/9] boot: remove unused function `boot_script_read_file'

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:31:58 +0100, a écrit :
 The unused function `boot_script_read_file' requires access to the
 default pager, which is privileged.

Ack.

 * boot/boot.c (defpager): Remove now unused variable.
 (boot_script_read_file): Remove unused function.
 (main): Do not acquire port to the default pager.
 * boot/boot_script.h (boot_script_read_file): Remove declaration.
 ---
  boot/boot.c| 46 +-
  boot/boot_script.h |  4 
  2 files changed, 1 insertion(+), 49 deletions(-)
 
 diff --git a/boot/boot.c b/boot/boot.c
 index d5b8096..250018e 100644
 --- a/boot/boot.c
 +++ b/boot/boot.c
 @@ -109,7 +109,7 @@ typedef struct stat host_stat_t;
  
  #endif /* UX */
  
 -mach_port_t privileged_host_port, master_device_port, defpager;
 +mach_port_t privileged_host_port, master_device_port;
  mach_port_t pseudo_master_device_port;
  mach_port_t receive_set;
  mach_port_t pseudo_console, pseudo_root;
 @@ -281,47 +281,6 @@ void read_reply ();
  void * msg_thread (void *);
  
  /* Callbacks for boot_script.c; see boot_script.h.  */
 -
 -mach_port_t
 -boot_script_read_file (const char *filename)
 -{
 -  static const char msg[] = : cannot open\n;
 -  int fd = useropen (filename, O_RDONLY, 0);
 -  host_stat_t st;
 -  error_t err;
 -  mach_port_t memobj;
 -  vm_address_t region;
 -
 -  write (2, filename, strlen (filename));
 -  if (fd  0)
 -{
 -  write (2, msg, sizeof msg - 1);
 -  host_exit (1);
 -}
 -  else
 -write (2, msg + sizeof msg - 2, 1);
 -
 -  host_fstat (fd, st);
 -
 -  err = default_pager_object_create (defpager, memobj,
 -  round_page (st.st_size));
 -  if (err)
 -{
 -  static const char msg[] = cannot create default-pager object\n;
 -  write (2, msg, sizeof msg - 1);
 -  host_exit (1);
 -}
 -
 -  region = 0;
 -  vm_map (mach_task_self (), region, round_page (st.st_size),
 -   0, 1, memobj, 0, 0, VM_PROT_ALL, VM_PROT_ALL, VM_INHERIT_NONE);
 -  read (fd, (char *) region, st.st_size);
 -  munmap ((caddr_t) region, round_page (st.st_size));
 -
 -  close (fd);
 -  return memobj;
 -}
 -
  int
  boot_script_exec_cmd (void *hook,
 mach_port_t task, char *path, int argc,
 @@ -532,9 +491,6 @@ main (int argc, char **argv, char **envp)
  
get_privileged_ports (privileged_host_port, master_device_port);
  
 -  defpager = MACH_PORT_NULL;
 -  vm_set_default_memory_manager (privileged_host_port, defpager);
 -
strcat (bootstrap_args, f);
  
mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_PORT_SET,
 diff --git a/boot/boot_script.h b/boot/boot_script.h
 index 6245869..da52e6f 100644
 --- a/boot/boot_script.h
 +++ b/boot/boot_script.h
 @@ -69,10 +69,6 @@ int boot_script_exec_cmd (void *hook,
 task_t task, char *path, int argc,
 char **argv, char *strings, int stringlen);
  
 -/* The user must define this function.  Load the contents of FILE
 -   into a fresh anonymous memory object and return the memory object port.  
 */
 -mach_port_t boot_script_read_file (const char *file);
 -
  /* The user must define this functions to perform the corresponding
 Mach task manipulations.  */
  int boot_script_task_create (struct cmd *); /* task_create + task_suspend */
 -- 
 2.1.1
 

-- 
Samuel
 X..., c'est un millefeuille avec une couche de crème patissière, une
 de sauce tomate et une de crème d'anchois... Mais c'est vrai que
 c'est un système ouvert: tu peux y rajouter des pépites de chocolat...
-+- Ol in Guide du linuxien pervers - Remettez m'en une couche ! -+-



Re: [PATCH hurd 7/9] boot: support ds_device_get_status with flavor DEV_GET_RECORDS

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:32:00 +0100, a écrit :
 * boot/boot.c (ds_device_get_status): Support flavor DEV_GET_RECORDS.

Ack.

 ---
  boot/boot.c | 33 +
  1 file changed, 21 insertions(+), 12 deletions(-)
 
 diff --git a/boot/boot.c b/boot/boot.c
 index a655107..d35ce50 100644
 --- a/boot/boot.c
 +++ b/boot/boot.c
 @@ -1150,18 +1150,27 @@ ds_device_get_status (device_t device,
if (device == pseudo_console)
  return D_INVALID_OPERATION;
else if (device == pseudo_root)
 -if (flavor == DEV_GET_SIZE)
 -  if (*statuslen  DEV_GET_SIZE_COUNT)
 - return D_INVALID_SIZE;
 -  else
 - {
 -   status[DEV_GET_SIZE_DEVICE_SIZE] = root_store-size;
 -   status[DEV_GET_SIZE_RECORD_SIZE] = root_store-block_size;
 -   *statuslen = DEV_GET_SIZE_COUNT;
 -   return D_SUCCESS;
 - }
 -else
 -  return D_INVALID_OPERATION;
 +switch (flavor)
 +  {
 +  case DEV_GET_SIZE:
 +if (*statuslen  DEV_GET_SIZE_COUNT)
 +  return D_INVALID_SIZE;
 +status[DEV_GET_SIZE_DEVICE_SIZE] = root_store-size;
 +status[DEV_GET_SIZE_RECORD_SIZE] = root_store-block_size;
 +*statuslen = DEV_GET_SIZE_COUNT;
 +return D_SUCCESS;
 +
 +  case DEV_GET_RECORDS:
 +if (*statuslen  DEV_GET_RECORDS_COUNT)
 +  return D_INVALID_SIZE;
 +status[DEV_GET_RECORDS_DEVICE_RECORDS] = root_store-blocks;
 +status[DEV_GET_RECORDS_RECORD_SIZE] = root_store-block_size;
 +*statuslen = DEV_GET_RECORDS_COUNT;
 +return D_SUCCESS;
 +
 +  default:
 +return D_INVALID_OPERATION;
 +  }
else
  return D_NO_SUCH_DEVICE;
  }
 -- 
 2.1.1
 

-- 
Samuel
  Subject: pb fvwm95-2 comment l'installer le compiler???
  Merci d'avance
 je te conseille d'être un peu plus précis dans l'exposé de ton pb...
 -+- EJ in guide du linuxien pervers :Les modéros sont sympas ! -+-



Re: [PATCH hurd 8/9] boot: implement pseudo-time device

2014-11-20 Thread Samuel Thibault
Justus Winter, le Fri 07 Nov 2014 17:32:01 +0100, a écrit :
 * boot/boot.c (pseudo_time): New variable.
 (main): Allocate port `pseudo_time'.
 (ds_device_open): Give out `pseudo_time'.
 (ds_device_map): Emulate Mach-style `Mapped Time'.

Ack.

 ---
  boot/boot.c | 38 +++---
  1 file changed, 35 insertions(+), 3 deletions(-)
 
 diff --git a/boot/boot.c b/boot/boot.c
 index d35ce50..747ab73 100644
 --- a/boot/boot.c
 +++ b/boot/boot.c
 @@ -112,7 +112,7 @@ typedef struct stat host_stat_t;
  mach_port_t privileged_host_port, master_device_port;
  mach_port_t pseudo_master_device_port;
  mach_port_t receive_set;
 -mach_port_t pseudo_console, pseudo_root;
 +mach_port_t pseudo_console, pseudo_root, pseudo_time;
  auth_t authserver;
  
  struct store *root_store;
 @@ -534,6 +534,15 @@ main (int argc, char **argv, char **envp)
if (foo != MACH_PORT_NULL)
  mach_port_deallocate (mach_task_self (), foo);
  
 +  mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
 +   pseudo_time);
 +  mach_port_move_member (mach_task_self (), pseudo_time, receive_set);
 +  mach_port_request_notification (mach_task_self (), pseudo_time,
 +   MACH_NOTIFY_NO_SENDERS, 1, pseudo_time,
 +   MACH_MSG_TYPE_MAKE_SEND_ONCE, foo);
 +  if (foo != MACH_PORT_NULL)
 +mach_port_deallocate (mach_task_self (), foo);
 +
if (kernel_command_line == 0)
  asprintf (kernel_command_line, %s %s root=%s,
 argv[0], bootstrap_args, bootdevice);
 @@ -894,6 +903,12 @@ ds_device_open (mach_port_t master_port,
*devicetype = MACH_MSG_TYPE_MAKE_SEND;
return 0;
  }
 +  else if (!strcmp (name, time))
 +{
 +  *device = pseudo_time;
 +  *devicetype = MACH_MSG_TYPE_MAKE_SEND;
 +  return 0;
 +}
else if (strcmp (name, pseudo-root) == 0)
  /* Magic root device.  */
  {
 @@ -1125,9 +1140,26 @@ ds_device_map (device_t device,
  memory_object_t *pager,
  int unmap)
  {
 -  if (device != pseudo_console  device != pseudo_root)
 +  if (device == pseudo_console || device == pseudo_root)
 +return D_INVALID_OPERATION;
 +  else if (device == pseudo_time)
 +{
 +  error_t err;
 +  mach_port_t wr_memobj;
 +  file_t node = file_name_lookup (/dev/time, O_RDONLY, 0);
 +
 +  if (node == MACH_PORT_NULL)
 + return D_IO_ERROR;
 +
 +  err = io_map (node, pager, wr_memobj);
 +  if (!err  MACH_PORT_VALID (wr_memobj))
 + mach_port_deallocate (mach_task_self (), wr_memobj);
 +
 +  mach_port_deallocate (mach_task_self (), node);
 +  return D_SUCCESS;
 +}
 +  else
  return D_NO_SUCH_DEVICE;
 -  return D_INVALID_OPERATION;
  }
  
  kern_return_t
 -- 
 2.1.1
 

-- 
Samuel
* x remarque qu'avec un peu de volonté, on peut faire du code de porc
dans d'importe quel langage Turing-complet
 -+- x sur #ens-mim - codons porc -+-



Re: [PATCH gnumach 1/2] kern: provide notifications about new tasks

2014-11-20 Thread Samuel Thibault
Justus Winter, le Wed 12 Nov 2014 16:49:08 +0100, a écrit :
 +kern_return_t
 +register_new_task_notification(
 + const host_t host,
 + ipc_port_t notification)
 +{
 + if (host == HOST_NULL)
 + return KERN_INVALID_HOST;
 +
 + if (new_task_notification != NULL)
 + return KERN_NO_ACCESS;
 +
 + new_task_notification = notification;
 + return KERN_SUCCESS;
 +}

Mmm, doesn't this need some additional reference on the notification
port?  Of course, proc is not supposed to die, but better be safe than
sorry :)

Samuel



Re: [PATCH gnumach 2/2] include: add X_IMPORTS to ipc definitions

2014-11-20 Thread Samuel Thibault
Justus Winter, le Wed 12 Nov 2014 16:49:09 +0100, a écrit :
 This makes it possible to inject imports.

Ack.

 * include/mach/gnumach.defs: Make it possible to inject imports.
 * include/mach/mach.defs: Likewise.
 * include/mach/mach_host.defs: Likewise.
 ---
  include/mach/gnumach.defs   | 4 
  include/mach/mach.defs  | 4 
  include/mach/mach_host.defs | 4 
  3 files changed, 12 insertions(+)
 
 diff --git a/include/mach/gnumach.defs b/include/mach/gnumach.defs
 index bac3b09..dd4da87 100644
 --- a/include/mach/gnumach.defs
 +++ b/include/mach/gnumach.defs
 @@ -29,6 +29,10 @@ subsystem
  #include mach/mach_types.defs
  #include mach_debug/mach_debug_types.defs
  
 +#ifdef   GNUMACH_IMPORTS
 +GNUMACH_IMPORTS
 +#endif
 +
  type vm_cache_statistics_data_t = struct[11] of integer_t;
  
  /*
 diff --git a/include/mach/mach.defs b/include/mach/mach.defs
 index 5851080..3786f65 100644
 --- a/include/mach/mach.defs
 +++ b/include/mach/mach.defs
 @@ -46,6 +46,10 @@ userprefix r_;
  #include mach/std_types.defs
  #include mach/mach_types.defs
  
 +#ifdef   MACH_IMPORTS
 +MACH_IMPORTS
 +#endif
 +
  skip;/* old port_allocate */
  skip;/* old port_deallocate */
  skip;/* old port_enable */
 diff --git a/include/mach/mach_host.defs b/include/mach/mach_host.defs
 index 2644146..6699a50 100644
 --- a/include/mach/mach_host.defs
 +++ b/include/mach/mach_host.defs
 @@ -47,6 +47,10 @@ subsystem
  #include mach/std_types.defs
  #include mach/mach_types.defs
  
 +#ifdef   MACH_HOST_IMPORTS
 +MACH_HOST_IMPORTS
 +#endif
 +
  /*
   *   Get list of processors on this host.
   */
 -- 
 2.1.1
 

-- 
Samuel
Running Windows on a Pentium is like having a brand new Porsche but only
be able to drive backwards with the handbrake on.
(Unknown source)



Re: [PATCH gnumach] Correct GCC's -Wformat-security issues

2014-11-20 Thread Samuel Thibault
Applied, thanks!



Re: [PATCH] trans/mtab: avoid firmlink loops

2014-11-20 Thread Samuel Thibault
Justus Winter, le Sun 05 Oct 2014 13:26:42 +0200, a écrit :
 * trans/mtab.c (struct mtab): Add a hash table to keep track of seen
 ports.
 (mtab_mark_as_seen): New function that records the identity port of a
 given node in the hash table and reports whether it has been there
 before.
 (mtab_populate): Use the new function to avoid running in circles.
 (main, open_hook): Initialize hash table.
 (close_hook): Free ports and destroy hash table.

Yes, it does avoid loops, please commit, thanks!

 ---
  trans/mtab.c | 46 +-
  1 file changed, 45 insertions(+), 1 deletion(-)
 
 diff --git a/trans/mtab.c b/trans/mtab.c
 index 5207c1e..a9928b3 100644
 --- a/trans/mtab.c
 +++ b/trans/mtab.c
 @@ -24,6 +24,7 @@
  #include error.h
  #include fcntl.h
  #include hurd.h
 +#include hurd/ihash.h
  #include hurd/trivfs.h
  #include inttypes.h
  #include mntent.h
 @@ -55,6 +56,7 @@ struct mtab
char *contents;
size_t contents_len;
off_t offs;
 +  struct hurd_ihash ports_seen;
  };
  
  const char *argp_program_version = STANDARD_HURD_VERSION (mtab);
 @@ -244,7 +246,11 @@ main (int argc, char *argv[])
else
  {
/* One-shot mode.   */
 -  struct mtab mtab = { .lock = PTHREAD_MUTEX_INITIALIZER };
 +  struct mtab mtab =
 +{
 +  .lock = PTHREAD_MUTEX_INITIALIZER,
 +  .ports_seen = HURD_IHASH_INITIALIZER (HURD_IHASH_NO_LOCP),
 +};
err = mtab_populate (mtab, target_path, insecure);
if (err)
   error (5, err, %s, target_path);
 @@ -301,6 +307,33 @@ is_filesystem_translator (file_t node)
  }
  }
  
 +/* Records NODE's idport in ports_seen, returns true if we have
 +   already seen this node or there was an error getting the id
 +   port.  */
 +boolean_t
 +mtab_mark_as_seen (struct mtab *mtab, mach_port_t node)
 +{
 +  error_t err;
 +  mach_port_t idport, fsidport;
 +  ino_t fileno;
 +
 +  err = io_identity (node, idport, fsidport, fileno);
 +  if (err)
 +return TRUE;
 +
 +  mach_port_deallocate (mach_task_self (), fsidport);
 +
 +  if (hurd_ihash_find (mtab-ports_seen, idport))
 +{
 +  /* Already seen.  Get rid of the extra reference.  */
 +  mach_port_deallocate (mach_task_self (), idport);
 +  return TRUE;
 +}
 +
 +  hurd_ihash_add (mtab-ports_seen, idport, idport);
 +  return FALSE;
 +}
 +
  /* Populates the given MTAB object with the information for PATH.  If
 INSECURE is given, also follow translators bound to nodes not owned
 by root or the current user.  */
 @@ -363,6 +396,13 @@ mtab_populate (struct mtab *mtab, const char *path, int 
 insecure)
goto errout;
  }
  
 +  /* Avoid running in circles.  */
 +  if (mtab_mark_as_seen (mtab, node))
 +{
 +  err = 0;
 +  goto errout;
 +}
 +
/* Query its options.   */
err = file_get_fs_options (node, argz, argz_len);
if (err)
 @@ -602,6 +642,7 @@ open_hook (struct trivfs_peropen *peropen)
mtab-offs = 0;
mtab-contents = NULL;
mtab-contents_len = 0;
 +  hurd_ihash_init (mtab-ports_seen, HURD_IHASH_NO_LOCP);
  
/* The mtab object is initialized, but not yet populated.  We delay
   that until that data is really needed.  This avoids the following
 @@ -635,6 +676,9 @@ close_hook (struct trivfs_peropen *peropen)
struct mtab *op = peropen-hook;
pthread_mutex_destroy (op-lock);
free (op-contents);
 +  HURD_IHASH_ITERATE (op-ports_seen, p)
 +mach_port_deallocate (mach_task_self (), (mach_port_t) p);
 +  hurd_ihash_destroy (op-ports_seen);
free (op);
  }
  
 -- 
 2.1.1
 

-- 
Samuel
* D a decide de peter un cable dans son rapport de pfp
c et il a bien raison ;-)
c tu vas dire quoi ?
D j'ai mis les paroles de le coq est mort en en-tete
 -+- #ens-mim et la peufeupeu -+-



Re: [PATCH] utils/mount: canonicalize mountpoints

2014-11-20 Thread Samuel Thibault
Hello,

Could you try the patch I have just pushed?  I believe it should be
doing the right thing.

Samuel