When handling DT_TEXTREL only set the mapping to READ+WRITE, ignore
authorderaadt <deraadt@openbsd.org>
Tue, 21 Jun 2016 15:25:36 +0000 (15:25 +0000)
committerderaadt <deraadt@openbsd.org>
Tue, 21 Jun 2016 15:25:36 +0000 (15:25 +0000)
possible EXEC permission for the section, because the proper permission
is set late, and there are no thread concerns here.  Avoids W^X issues
in oddball cases.
ok guenther kettenis

libexec/ld.so/alpha/rtld_machine.c
libexec/ld.so/amd64/rtld_machine.c
libexec/ld.so/arm/rtld_machine.c
libexec/ld.so/m88k/rtld_machine.c
libexec/ld.so/powerpc/rtld_machine.c
libexec/ld.so/sh/rtld_machine.c
libexec/ld.so/sparc/rtld_machine.c
libexec/ld.so/sparc64/rtld_machine.c

index b1fb74e..4a3fc30 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.58 2016/03/20 02:29:51 guenther Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.59 2016/06/21 15:25:36 deraadt Exp $ */
 
 /*
  * Copyright (c) 1999 Dale Rahn
@@ -83,7 +83,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
                for (llist = object->load_list; llist != NULL; llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE)) {
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                        }
                }
        }
index cea350a..fb8a8bc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.25 2015/11/02 07:02:53 guenther Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.26 2016/06/21 15:25:37 deraadt Exp $ */
 
 /*
  * Copyright (c) 2002,2004 Dale Rahn
@@ -200,7 +200,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
                for (llist = object->load_list; llist != NULL; llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE))
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                }
        }
 
index e3f8722..4bc65bb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.22 2015/11/02 07:02:53 guenther Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.23 2016/06/21 15:25:37 deraadt Exp $ */
 
 /*
  * Copyright (c) 2004 Dale Rahn
@@ -194,7 +194,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relsz)
                    llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE))
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                }
        }
 
index ed65c88..0e83ccd 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.14 2016/03/20 02:29:51 guenther Exp $      */
+/*     $OpenBSD: rtld_machine.c,v 1.15 2016/06/21 15:25:37 deraadt Exp $       */
 
 /*
  * Copyright (c) 2013 Miodrag Vallat.
@@ -94,7 +94,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
                    llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE)) {
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                        }
                }
        }
index 0d71977..5588773 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.58 2016/06/13 04:59:56 guenther Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.59 2016/06/21 15:25:37 deraadt Exp $ */
 
 /*
  * Copyright (c) 1999 Dale Rahn
@@ -181,7 +181,7 @@ _dl_printf("object relocation size %x, numrela %x\n",
                for (llist = object->load_list; llist != NULL; llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE)) {
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                        }
                }
        }
index 850eec2..9a334f2 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.23 2015/11/02 07:02:53 guenther Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.24 2016/06/21 15:25:38 deraadt Exp $ */
 
 /*
  * Copyright (c) 2004 Dale Rahn
@@ -632,7 +632,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
                    llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE))
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                }
        }
 
index 8ac4796..7bbc67f 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.43 2016/05/21 22:07:34 deraadt Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.44 2016/06/21 15:25:38 deraadt Exp $ */
 
 /*
  * Copyright (c) 1999 Dale Rahn
@@ -208,7 +208,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
                for (llist = object->load_list; llist != NULL; llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE))
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                }
        }
 
index 915737b..fc1b49c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtld_machine.c,v 1.57 2016/05/21 21:58:52 kettenis Exp $ */
+/*     $OpenBSD: rtld_machine.c,v 1.58 2016/06/21 15:25:38 deraadt Exp $ */
 
 /*
  * Copyright (c) 1999 Dale Rahn
@@ -237,7 +237,7 @@ _dl_md_reloc(elf_object_t *object, int rel, int relasz)
                for (llist = object->load_list; llist != NULL; llist = llist->next) {
                        if (!(llist->prot & PROT_WRITE))
                                _dl_mprotect(llist->start, llist->size,
-                                   llist->prot|PROT_WRITE);
+                                   PROT_READ | PROT_WRITE);
                }
        }