public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] cheri: Fix capability permissions of PROT_NONE map in locarchive
@ 2022-11-23 14:46 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-11-23 14:46 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8e860da0db41471ac5a4c68b4838308c13ba5f41

commit 8e860da0db41471ac5a4c68b4838308c13ba5f41
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 25 11:20:48 2022 +0100

    cheri: Fix capability permissions of PROT_NONE map in locarchive

Diff:
---
 locale/programs/locarchive.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index eeb2fa6ffe..81a980b60b 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -84,6 +84,13 @@ static const char *locnames[] =
 /* Size of the reserved address space area.  */
 #define RESERVE_MMAP_SIZE	512 * 1024 * 1024
 
+/* On CHERI targets ensure the mmap returned capability has RW permissions.  */
+#ifdef PROT_MAX
+# define PROT_MAX_RW PROT_MAX (PROT_READ | PROT_WRITE)
+#else
+# define PROT_MAX_RW 0
+#endif
+
 /* To prepare for enlargements of the mmaped area reserve some address
    space.  On some machines, being a file mapping rather than an anonymous
    mapping affects the address selection.  So do this mapping from the
@@ -94,7 +101,8 @@ prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
 {
   if (total < RESERVE_MMAP_SIZE)
     {
-      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
+      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE,
+			PROT_NONE | PROT_MAX_RW, MAP_SHARED, fd, 0);
       if (p != MAP_FAILED)
 	{
 	  void *aligned_p = PTR_ALIGN_UP (p, MAP_FIXED_ALIGNMENT);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] cheri: Fix capability permissions of PROT_NONE map in locarchive
@ 2022-10-27 13:56 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8f1e7b94ef72a91d5eeef8d002e9a5239c0c9f24

commit 8f1e7b94ef72a91d5eeef8d002e9a5239c0c9f24
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 25 11:20:48 2022 +0100

    cheri: Fix capability permissions of PROT_NONE map in locarchive

Diff:
---
 locale/programs/locarchive.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index eeb2fa6ffe..81a980b60b 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -84,6 +84,13 @@ static const char *locnames[] =
 /* Size of the reserved address space area.  */
 #define RESERVE_MMAP_SIZE	512 * 1024 * 1024
 
+/* On CHERI targets ensure the mmap returned capability has RW permissions.  */
+#ifdef PROT_MAX
+# define PROT_MAX_RW PROT_MAX (PROT_READ | PROT_WRITE)
+#else
+# define PROT_MAX_RW 0
+#endif
+
 /* To prepare for enlargements of the mmaped area reserve some address
    space.  On some machines, being a file mapping rather than an anonymous
    mapping affects the address selection.  So do this mapping from the
@@ -94,7 +101,8 @@ prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
 {
   if (total < RESERVE_MMAP_SIZE)
     {
-      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
+      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE,
+			PROT_NONE | PROT_MAX_RW, MAP_SHARED, fd, 0);
       if (p != MAP_FAILED)
 	{
 	  void *aligned_p = PTR_ALIGN_UP (p, MAP_FIXED_ALIGNMENT);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] cheri: Fix capability permissions of PROT_NONE map in locarchive
@ 2022-10-26 15:17 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 15:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=76bb30167b4e28a44e61e94e9b2474dc939c8ab5

commit 76bb30167b4e28a44e61e94e9b2474dc939c8ab5
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 25 11:20:48 2022 +0100

    cheri: Fix capability permissions of PROT_NONE map in locarchive

Diff:
---
 locale/programs/locarchive.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index eeb2fa6ffe..81a980b60b 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -84,6 +84,13 @@ static const char *locnames[] =
 /* Size of the reserved address space area.  */
 #define RESERVE_MMAP_SIZE	512 * 1024 * 1024
 
+/* On CHERI targets ensure the mmap returned capability has RW permissions.  */
+#ifdef PROT_MAX
+# define PROT_MAX_RW PROT_MAX (PROT_READ | PROT_WRITE)
+#else
+# define PROT_MAX_RW 0
+#endif
+
 /* To prepare for enlargements of the mmaped area reserve some address
    space.  On some machines, being a file mapping rather than an anonymous
    mapping affects the address selection.  So do this mapping from the
@@ -94,7 +101,8 @@ prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
 {
   if (total < RESERVE_MMAP_SIZE)
     {
-      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
+      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE,
+			PROT_NONE | PROT_MAX_RW, MAP_SHARED, fd, 0);
       if (p != MAP_FAILED)
 	{
 	  void *aligned_p = PTR_ALIGN_UP (p, MAP_FIXED_ALIGNMENT);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [glibc/arm/morello/main] cheri: Fix capability permissions of PROT_NONE map in locarchive
@ 2022-10-26 14:49 Szabolcs Nagy
  0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 14:49 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cef9089a6894ed882a403a64c9949d7e08eedca8

commit cef9089a6894ed882a403a64c9949d7e08eedca8
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Oct 25 11:20:48 2022 +0100

    cheri: Fix capability permissions of PROT_NONE map in locarchive

Diff:
---
 locale/programs/locarchive.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index eeb2fa6ffe..81a980b60b 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -84,6 +84,13 @@ static const char *locnames[] =
 /* Size of the reserved address space area.  */
 #define RESERVE_MMAP_SIZE	512 * 1024 * 1024
 
+/* On CHERI targets ensure the mmap returned capability has RW permissions.  */
+#ifdef PROT_MAX
+# define PROT_MAX_RW PROT_MAX (PROT_READ | PROT_WRITE)
+#else
+# define PROT_MAX_RW 0
+#endif
+
 /* To prepare for enlargements of the mmaped area reserve some address
    space.  On some machines, being a file mapping rather than an anonymous
    mapping affects the address selection.  So do this mapping from the
@@ -94,7 +101,8 @@ prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags,
 {
   if (total < RESERVE_MMAP_SIZE)
     {
-      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
+      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE,
+			PROT_NONE | PROT_MAX_RW, MAP_SHARED, fd, 0);
       if (p != MAP_FAILED)
 	{
 	  void *aligned_p = PTR_ALIGN_UP (p, MAP_FIXED_ALIGNMENT);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-23 14:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 14:46 [glibc/arm/morello/main] cheri: Fix capability permissions of PROT_NONE map in locarchive Szabolcs Nagy
  -- strict thread matches above, loose matches on Subject: below --
2022-10-27 13:56 Szabolcs Nagy
2022-10-26 15:17 Szabolcs Nagy
2022-10-26 14:49 Szabolcs Nagy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).