Skip to contentSkip to conversation

parisc: Add MAP_UNINITIALIZED define

PATCH In review Helge Deller 3 participants 6 messages Oct 10, 2020 – Oct 12, 2020 PA-RISC architecture

lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Add MAP_UNINITIALIZED define

Define MAP_UNINITIALIZED and use same value as other architectures. Fixes build of debian foot package.

arch/parisc/include/uapi/asm/mman.h +2 -0
index 6fd8871e4081..d828b293b6de 100644
@@ -25,6 +25,8 @@
 #define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
 #define MAP_HUGETLB	0x80000		/* create a huge page mapping */
 #define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED which doesn't unmap underlying mapping */
+#define MAP_UNINITIALIZED 0x4000000	/* For anonymous mmap, memory could be
+					 * uninitialized */
 
 #define MS_SYNC		1		/* synchronous memory sync */
 #define MS_ASYNC	2		/* sync memory asynchronously */
tools/arch/parisc/include/uapi/asm/mman.h +1 -2
index f9fd1325f5bd..c7af0f2292fc 100644
@@ -39,6 +39,5 @@
 #define MADV_SOFT_OFFLINE 101
 /* MAP_32BIT is undefined on parisc, fix it for perf */
 #define MAP_32BIT	0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
-#define MAP_UNINITIALIZED	0
+#define MAP_UNINITIALIZED 0x4000000
 #endif
author maintainer
#1 lore raw
Quoted 2 lines · Helge Deller

Define MAP_UNINITIALIZED and use same value as other architectures. Fixes build of debian foot package.

I'm tempted to #define MAP_UNINITIALIZED to zero.
That flag was invented for embedded usage, and becaue of security reasons we probably will never deliver uninitialized pages to userspace on parisc. So, defining it as 0 should be fine, as this fixes build errors and won't have any other (negative) effect.
Thoughts?

Helge

Quoted 29 lines
arch/parisc/include/uapi/asm/mman.h +2 -0
index 6fd8871e4081..d828b293b6de 100644
@@ -25,6 +25,8 @@
 #define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
 #define MAP_HUGETLB	0x80000		/* create a huge page mapping */
 #define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED which doesn't unmap underlying mapping */
+#define MAP_UNINITIALIZED 0x4000000	/* For anonymous mmap, memory could be
+					 * uninitialized */
 
 #define MS_SYNC		1		/* synchronous memory sync */
 #define MS_ASYNC	2		/* sync memory asynchronously */
tools/arch/parisc/include/uapi/asm/mman.h +1 -2
index f9fd1325f5bd..c7af0f2292fc 100644
@@ -39,6 +39,5 @@
 #define MADV_SOFT_OFFLINE 101
 /* MAP_32BIT is undefined on parisc, fix it for perf */
 #define MAP_32BIT	0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
-#define MAP_UNINITIALIZED	0
+#define MAP_UNINITIALIZED 0x4000000
 #endif
#2 lore raw

Yes, I believe it only should be nonzero in nommu case.

Dave

Quoted 42 lines · Helge Deller
Quoted 2 lines · Helge Deller

Define MAP_UNINITIALIZED and use same value as other architectures. Fixes build of debian foot package.

I'm tempted to #define MAP_UNINITIALIZED to zero.
That flag was invented for embedded usage, and becaue of security reasons we probably will never deliver uninitialized pages to userspace on parisc. So, defining it as 0 should be fine, as this fixes build errors and won't have any other (negative) effect.
Thoughts?

Helge

Quoted 29 lines
arch/parisc/include/uapi/asm/mman.h +2 -0
index 6fd8871e4081..d828b293b6de 100644
@@ -25,6 +25,8 @@
 #define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
 #define MAP_HUGETLB	0x80000		/* create a huge page mapping */
 #define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED which doesn't unmap underlying mapping */
+#define MAP_UNINITIALIZED 0x4000000	/* For anonymous mmap, memory could be
+					 * uninitialized */
 
 #define MS_SYNC		1		/* synchronous memory sync */
 #define MS_ASYNC	2		/* sync memory asynchronously */
tools/arch/parisc/include/uapi/asm/mman.h +1 -2
index f9fd1325f5bd..c7af0f2292fc 100644
@@ -39,6 +39,5 @@
 #define MADV_SOFT_OFFLINE 101
 /* MAP_32BIT is undefined on parisc, fix it for perf */
 #define MAP_32BIT	0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
-#define MAP_UNINITIALIZED	0
+#define MAP_UNINITIALIZED 0x4000000
 #endif
Signature · 1 line
John David Anglin  [email protected]
author maintainer
#3 lore raw

PATCH v2] parisc: Add MAP_UNINITIALIZED define

In reply to Helge Deller

We will not allow unitialized anon mmaps, but we need this define to prevent build errors, e.g. the debian foot package.

arch/parisc/include/uapi/asm/mman.h +1 -0
index 6fd8871e4081..ab78cba446ed 100644
@@ -25,6 +25,7 @@
 #define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
 #define MAP_HUGETLB	0x80000		/* create a huge page mapping */
 #define MAP_FIXED_NOREPLACE 0x100000	/* MAP_FIXED which doesn't unmap underlying mapping */
+#define MAP_UNINITIALIZED 0		/* uninitialized anonymous mmap */
 
 #define MS_SYNC		1		/* synchronous memory sync */
 #define MS_ASYNC	2		/* sync memory asynchronously */
tools/arch/parisc/include/uapi/asm/mman.h +0 -1
index f9fd1325f5bd..506c06a6536f 100644
@@ -39,6 +39,5 @@
 #define MADV_SOFT_OFFLINE 101
 /* MAP_32BIT is undefined on parisc, fix it for perf */
 #define MAP_32BIT	0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
 #define MAP_UNINITIALIZED	0
 #endif
#4 lore raw

Re: PATCH v2] parisc: Add MAP_UNINITIALIZED define

Am 2020-10-12 08:50, schrieb Helge Deller:

Quoted 27 lines

We will not allow unitialized anon mmaps, but we need this define to prevent build errors, e.g. the debian foot package.

arch/parisc/include/uapi/asm/mman.h +0 -0
index 6fd8871e4081..ab78cba446ed 100644
@@ -25,6 +25,7 @@
 #define MAP_STACK	0x40000		/* give out an address that is best suited

for process/thread stacks */
#define MAP_HUGETLB 0x80000 /* create a huge page mapping */
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED which doesn't unmap
underlying mapping */

arch/parisc/include/uapi/asm/mman.h +1 -0
+#define MAP_UNINITIALIZED 0		/* uninitialized anonymous mmap */
 
 #define MS_SYNC		1		/* synchronous memory sync */
 #define MS_ASYNC	2		/* sync memory asynchronously */
tools/arch/parisc/include/uapi/asm/mman.h +0 -0
index f9fd1325f5bd..506c06a6536f 100644

tools/arch/parisc/include/uapi/asm/mman.h line 43

Quoted 6 lines
tools/arch/parisc/include/uapi/asm/mman.h +0 -1
@@ -39,6 +39,5 @@
 #define MADV_SOFT_OFFLINE 101
 /* MAP_32BIT is undefined on parisc, fix it for perf */
 #define MAP_32BIT	0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
 #define MAP_UNINITIALIZED	0
 #endif

Shouldn't the define itself be deleted here, too?

Eike

author maintainer
#5 lore raw

Re: PATCH v2] parisc: Add MAP_UNINITIALIZED define

Quoted 20 lines · Rolf Eike Beer

Am 2020-10-12 08:50, schrieb Helge Deller:

Quoted 19 lines

We will not allow unitialized anon mmaps, but we need this define to prevent build errors, e.g. the debian foot package.

arch/parisc/include/uapi/asm/mman.h +0 -0
index 6fd8871e4081..ab78cba446ed 100644
@@ -25,6 +25,7 @@
  #define MAP_STACK    0x40000        /* give out an address that is best suited

for process/thread stacks */
 #define MAP_HUGETLB    0x80000        /* create a huge page mapping */ #define MAP_FIXED_NOREPLACE 0x100000    /* MAP_FIXED which doesn't unmap underlying mapping */
+#define MAP_UNINITIALIZED 0        /* uninitialized anonymous mmap */

Quoted 16 lines
Quoted 8 lines

 #define MS_SYNC        1        /* synchronous memory sync */ #define MS_ASYNC    2        /* sync memory asynchronously */

tools/arch/parisc/include/uapi/asm/mman.h +0 -0
index f9fd1325f5bd..506c06a6536f 100644

tools/arch/parisc/include/uapi/asm/mman.h line 43

Quoted 6 lines
tools/arch/parisc/include/uapi/asm/mman.h +0 -1
@@ -39,6 +39,5 @@
  #define MADV_SOFT_OFFLINE 101
  /* MAP_32BIT is undefined on parisc, fix it for perf */
  #define MAP_32BIT    0
-/* MAP_UNINITIALIZED is undefined on parisc, fix it for perf */
  #define MAP_UNINITIALIZED    0
  #endif

Shouldn't the define itself be deleted here, too?

No, because it doesn't include arch/parisc/include/uapi/asm/mman.h

Helge