commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 01/04: New upstream snapshot


From: Samuel Thibault
Subject: [hurd] 01/04: New upstream snapshot
Date: Fri, 26 Aug 2016 07:55:10 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch master
in repository hurd.

commit 776f16d737e3c1e7f1567d43d28171630e59f3a0
Author: Samuel Thibault <address@hidden>
Date:   Fri Aug 26 01:04:13 2016 +0000

    New upstream snapshot
---
 exec/exec.c                   | 57 +++++++++++++++++++++++++++++++------------
 mach-defpager/default_pager.c | 33 +++++++++++++------------
 term/munge.c                  |  7 ------
 term/term.h                   |  1 -
 term/users.c                  |  3 ---
 utils/rpctrace.c              |  3 ++-
 6 files changed, 61 insertions(+), 43 deletions(-)

diff --git a/exec/exec.c b/exec/exec.c
index 3b63b7f..ea352fa 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -47,11 +47,12 @@ pthread_rwlock_t std_lock = PTHREAD_RWLOCK_INITIALIZER;
 
 #include <hurd/sigpreempt.h>
 
-/* Load or allocate a section.  */
-static void
+/* Load or allocate a section.
+   Returns the address of the end of the section.  */
+static vm_address_t
 load_section (void *section, struct execdata *u)
 {
-  vm_address_t addr = 0;
+  vm_address_t addr = 0, end = 0;
   vm_offset_t filepos = 0;
   vm_size_t filesz = 0, memsz = 0;
   vm_prot_t vm_prot;
@@ -60,7 +61,7 @@ load_section (void *section, struct execdata *u)
   const ElfW(Phdr) *const ph = section;
 
   if (u->error)
-    return;
+    return 0;
 
   vm_prot = VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE;
 
@@ -97,9 +98,11 @@ load_section (void *section, struct execdata *u)
   if (anywhere && addr < vm_page_size)
     addr = vm_page_size;
 
+  end = addr + memsz;
+
   if (memsz == 0)
     /* This section is empty; ignore it.  */
-    return;
+    return 0;
 
   if (filesz != 0)
     {
@@ -173,7 +176,7 @@ load_section (void *section, struct execdata *u)
                write_to_task (mapstart, size, vm_prot, (vm_address_t) buf);
            }
          if (u->error)
-           return;
+           return 0;
 
          if (anywhere)
            {
@@ -230,7 +233,7 @@ load_section (void *section, struct execdata *u)
                {
                maplose:
                  vm_deallocate (u->task, mapstart, filesz);
-                 return;
+                 return 0;
                }
            }
 
@@ -294,7 +297,7 @@ load_section (void *section, struct execdata *u)
                             mask, anywhere, MACH_PORT_NULL, 0, 1,
                             vm_prot, VM_PROT_ALL, VM_INHERIT_COPY);
          if (u->error)
-           return;
+           return 0;
        }
 
       if (anywhere)
@@ -319,7 +322,7 @@ load_section (void *section, struct execdata *u)
          if (u->error)
            {
              vm_deallocate (u->task, mapstart, memsz);
-             return;
+             return 0;
            }
          u->error = hurd_safe_memset (
                                 (void *) (ourpage + (addr - overlap_page)),
@@ -335,6 +338,7 @@ load_section (void *section, struct execdata *u)
          munmap ((caddr_t) ourpage, size);
        }
     }
+  return end;
 }
 
 /* XXX all accesses of the mapped data need to use fault handling
@@ -717,18 +721,37 @@ set_name (task_t task, const char *exec_name, pid_t pid)
   free (name);
 }
 
-/* Load the file.  */
-static void
-load (task_t usertask, struct execdata *e)
+/* Load the file.  Returns the address of the end of the load.  */
+static vm_offset_t
+load (task_t usertask, struct execdata *e, vm_offset_t anywhere_start)
 {
+  int anywhere = e->info.elf.anywhere;
+  vm_offset_t end;
   e->task = usertask;
 
   if (! e->error)
     {
       ElfW(Word) i;
+
+      if (anywhere && anywhere_start)
+       {
+         /* Make sure this anywhere-load will go at the end of the previous
+            anywhere-load.  */
+         /* TODO: Rather compute how much contiguous room is needed, allocate
+            the area from the kernel, and then map memory sections.  */
+         /* TODO: Possibly implement Adresse Space Layout Randomization.  */
+         e->info.elf.loadbase = anywhere_start;
+         e->info.elf.anywhere = 0;
+       }
+
       for (i = 0; i < e->info.elf.phnum; ++i)
        if (e->info.elf.phdr[i].p_type == PT_LOAD)
-         load_section (&e->info.elf.phdr[i], e);
+         {
+           end = load_section (&e->info.elf.phdr[i], e);
+           if (anywhere && end > anywhere_start)
+             /* This section pushes the next anywhere-load further */
+             anywhere_start = end;
+         }
 
       /* The entry point address is relative to wherever we loaded the
         program text.  */
@@ -737,6 +760,9 @@ load (task_t usertask, struct execdata *e)
 
   /* Release the conch for the file.  */
   finish_mapping (e);
+
+  /* Return potentially-new start for anywhere-loads.  */
+  return round_page (anywhere_start);
 }
 
 
@@ -783,6 +809,7 @@ do_exec (file_t file,
   mach_msg_type_number_t i;
   int intarray_dealloc = 0;    /* Dealloc INTARRAY before returning?  */
   int oldtask_trashed = 0;     /* Have we trashed the old task?  */
+  vm_address_t anywhere_start = 0;
 
   /* Prime E for executing FILE and check its validity.  This must be an
      inline function because it stores pointers into alloca'd storage in E
@@ -1156,7 +1183,7 @@ do_exec (file_t file,
   if (interp.file != MACH_PORT_NULL)
     {
       /* Load the interpreter file.  */
-      load (newtask, &interp);
+      anywhere_start = load (newtask, &interp, anywhere_start);
       if (interp.error)
        {
          e.error = interp.error;
@@ -1167,7 +1194,7 @@ do_exec (file_t file,
 
 
   /* Load the file into the task.  */
-  load (newtask, &e);
+  anywhere_start = load (newtask, &e, anywhere_start);
   if (e.error)
     goto out;
 
diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c
index 4293e2a..d7bc75b 100644
--- a/mach-defpager/default_pager.c
+++ b/mach-defpager/default_pager.c
@@ -581,7 +581,7 @@ pager_dealloc_page(pindex, page, lock_it)
        /* be paranoid */
        if (no_partition(pindex))
            panic("%sdealloc_page",my_name);
-ddprintf ("pager_dealloc_page(%d,%x,%d)\n",pindex,page,lock_it);
+ddprintf ("pager_dealloc_page(%d,%lx,%d)\n",pindex,page,lock_it);
        part = partition_of(pindex);
 
        if (page >= part->total_size)
@@ -1092,7 +1092,7 @@ pager_read_offset(pager, offset)
 #endif
        if (f_page >= pager->size)
          {
-           ddprintf ("%spager_read_offset pager %x: bad page %d >= size %d",
+           ddprintf ("%spager_read_offset pager %p: bad page %ld >= size %d",
                    my_name, pager, f_page, pager->size);
            pthread_mutex_unlock(&pager->lock);
            return (union dp_map) (union dp_map *) NO_BLOCK;
@@ -1360,7 +1360,7 @@ pager_write_offset(pager, offset)
        }
 
        while (f_page >= pager->size) {
-         ddprintf ("pager_write_offset: extending: %x %x\n", f_page, 
pager->size);
+         ddprintf ("pager_write_offset: extending: %lx %x\n", f_page, 
pager->size);
 
            /*
             * Paging object must be extended.
@@ -1380,7 +1380,7 @@ pager_write_offset(pager, offset)
 #if    DEBUG_READER_CONFLICTS
            pager->readers++;
 #endif
-           ddprintf ("pager_write_offset: done extending: %x %x\n", f_page, 
pager->size);
+           ddprintf ("pager_write_offset: done extending: %lx %x\n", f_page, 
pager->size);
        }
 
        if (INDIRECT_PAGEMAP(pager->size)) {
@@ -1429,7 +1429,7 @@ pager_write_offset(pager, offset)
        }
 
        block = mapptr[f_page];
-       ddprintf ("pager_write_offset: block starts as %x[%x] %x\n", mapptr, 
f_page, block);
+       ddprintf ("pager_write_offset: block starts as %p[%lx] %p\n", mapptr, 
f_page, block.indirect);
        if (no_block(block)) {
            vm_offset_t off;
 
@@ -1656,7 +1656,7 @@ default_read(ds, addr, size, offset, out_addr, 
deallocate, external)
         * Read it, trying for the entire page.
         */
        offset = ptoa(block.block.p_offset);
-ddprintf ("default_read(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index);
+ddprintf 
("default_read(%lx,%x,%lx,%d)\n",addr,size,offset,block.block.p_index);
        part   = partition_of(block.block.p_index);
        first_time = TRUE;
        *out_addr = addr;
@@ -1723,7 +1723,7 @@ default_write(ds, addr, size, offset)
        vm_size_t               wsize;
        int             rc;
 
-       ddprintf ("default_write: pager offset %x\n", offset);
+       ddprintf ("default_write: pager offset %lx\n", offset);
 
        /*
         * Find block in paging partition
@@ -1744,7 +1744,7 @@ default_write(ds, addr, size, offset)
        }
 #endif  /* CHECKSUM */
        offset = ptoa(block.block.p_offset);
-ddprintf ("default_write(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index);
+ddprintf 
("default_write(%lx,%x,%lx,%d)\n",addr,size,offset,block.block.p_index);
        part   = partition_of(block.block.p_index);
 
        /*
@@ -1760,7 +1760,7 @@ ddprintf 
("default_write(%x,%x,%x,%d)\n",addr,size,offset,block.block.p_index);
                                        &wsize);
            if (rc != 0) {
                dprintf("*** PAGER ERROR: default_write: ");
-               dprintf("ds=0x%x addr=0x%x size=0x%x offset=0x%x resid=0x%x\n",
+               dprintf("ds=0x%p addr=0x%lx size=0x%x offset=0x%lx 
resid=0x%x\n",
                        ds, addr, size, offset, wsize);
                return (PAGER_ERROR);
            }
@@ -1865,7 +1865,7 @@ destroy_paging_partition(name, pp_private)
         */
 all_over_again:
 #if debug
-dprintf("Partition x%x (id x%x) for %s, all_ok %d\n", part, id, name, all_ok);
+dprintf("Partition x%p (id x%x) for %s, all_ok %d\n", part, id, name, all_ok);
 #endif
        all_ok = TRUE;
        pthread_mutex_lock(&part->p_lock);
@@ -1920,6 +1920,7 @@ dprintf("Partition x%x (id x%x) for %s, all_ok %d\n", 
part, id, name, all_ok);
         * Put partition back in.
         */
        part->going_away = FALSE;
+       pthread_mutex_unlock(&part->p_lock);
 
        return KERN_FAILURE;
 }
@@ -2343,7 +2344,7 @@ seqnos_memory_object_terminate(ds, seqno, pager_request, 
pager_name)
        if (ds == DEFAULT_PAGER_NULL)
                panic(here, my_name);
 ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_lock: 
<%p>[s:%d,r:%d,w:%d,l:%d], %d\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held, seqno);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held, seqno);
        pager_port_lock(ds, seqno);
 
        /*
@@ -2374,7 +2375,7 @@ ddprintf ("seqnos_memory_object_terminate <%p>: 
pager_port_lock: <%p>[s:%d,r:%d,
        ds->pager_name = MACH_PORT_NULL;
        ds->name_refs = 0;
 ddprintf ("seqnos_memory_object_terminate <%p>: pager_port_unlock: 
<%p>[s:%d,r:%d,w:%d,l:%d]\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held);
        pager_port_unlock(ds);
 
        /*
@@ -2486,7 +2487,7 @@ seqnos_memory_object_data_request(ds, seqno, reply_to, 
offset,
        if (ds == DEFAULT_PAGER_NULL)
            panic(here,my_name);
 ddprintf ("seqnos_memory_object_data_request <%p>: pager_port_lock: 
<%p>[s:%d,r:%d,w:%d,l:%d], %d\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held, seqno);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held, seqno);
        pager_port_lock(ds, seqno);
        pager_port_check_request(ds, reply_to);
        pager_port_wait_for_writers(ds);
@@ -2498,7 +2499,7 @@ ddprintf ("seqnos_memory_object_data_request <%p>: 
pager_port_lock: <%p>[s:%d,r:
        errors = ds->errors;
 
 ddprintf ("seqnos_memory_object_data_request <%p>: pager_port_unlock: 
<%p>[s:%d,r:%d,w:%d,l:%d]\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held);
        pager_port_unlock(ds);
 
        if (errors) {
@@ -2588,12 +2589,12 @@ seqnos_memory_object_data_initialize(ds, seqno, 
pager_request,
        if (ds == DEFAULT_PAGER_NULL)
            panic(here,my_name);
 ddprintf ("seqnos_memory_object_data_initialize <%p>: pager_port_lock: 
<%p>[s:%d,r:%d,w:%d,l:%d], %d\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held, seqno);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held, seqno);
        pager_port_lock(ds, seqno);
        pager_port_check_request(ds, pager_request);
        pager_port_start_write(ds);
 ddprintf ("seqnos_memory_object_data_initialize <%p>: pager_port_unlock: 
<%p>[s:%d,r:%d,w:%d,l:%d]\n",
-       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.held);
+       &ds, ds, ds->seqno, ds->readers, ds->writers, ds->lock.__held);
        pager_port_unlock(ds);
 
        for (amount_sent = 0;
diff --git a/term/munge.c b/term/munge.c
index 7e08e2d..96b0df3 100644
--- a/term/munge.c
+++ b/term/munge.c
@@ -87,11 +87,6 @@ output_character (int c)
        }
       else if ((oflag & ONOEOT) && c == CHAR_EOT)
        ;
-      else if ((oflag & OTILDE) && c == '~')
-       {
-         poutput ('\\');
-         poutput ('`');
-       }
       else if ((oflag & OLCASE) && isalpha (c))
        {
          if (isupper (c))
@@ -125,8 +120,6 @@ output_width (int c, int loc)
 
   if (oflag & OPOST)
     {
-      if ((oflag & OTILDE) && c == '~')
-       return 2;
       if ((oflag & OLCASE) && isalpha (c) && isupper (c))
        return 2;
     }
diff --git a/term/term.h b/term/term.h
index 3067425..0a42869 100644
--- a/term/term.h
+++ b/term/term.h
@@ -65,7 +65,6 @@
 #else
 #define OLCASE (1 << 9)
 #endif
-#define OTILDE (1 << 10)
 
 /* used in mdmctl device call */
 #define MDMCTL_BIS 0
diff --git a/term/users.c b/term/users.c
index 8151dc7..193b358 100644
--- a/term/users.c
+++ b/term/users.c
@@ -183,9 +183,6 @@ open_hook (struct trivfs_control *cntl,
 
   open_count++;                        /* XXX debugging */
 
-  /* XXX debugging */
-  assert (! (termstate.c_oflag & OTILDE));
-
   /* Assert DTR if necessary. */
   if (termflags & NO_CARRIER)
     {
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 276377c..25d9bc6 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1524,7 +1524,8 @@ print_data (mach_msg_type_name_t type,
         the first character that has not yet been printed.  */
       const char *p, *q;
       p = q = (const char *) data;
-      while (q && *q && q - (const char *) data < (int) (nelt * eltsize))
+      while (q && q - (const char *) data < (int) (nelt * eltsize)
+            && (*q || type == MACH_MSG_TYPE_CHAR))
        {
          if (isgraph (*q) || *q == ' ')
            {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]