linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parisc: Add MAP_UNINITIALIZED define
@ 2020-10-10 21:54 Helge Deller
  2020-10-11 11:56 ` Helge Deller
  2020-10-12  6:50 ` PATCH v2] " Helge Deller
  0 siblings, 2 replies; 6+ messages in thread
From: Helge Deller @ 2020-10-10 21:54 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

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

Suggested-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 6fd8871e4081..d828b293b6de 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -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 */
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
index f9fd1325f5bd..c7af0f2292fc 100644
--- a/tools/arch/parisc/include/uapi/asm/mman.h
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -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

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

* Re: [PATCH] parisc: Add MAP_UNINITIALIZED define
  2020-10-10 21:54 [PATCH] parisc: Add MAP_UNINITIALIZED define Helge Deller
@ 2020-10-11 11:56 ` Helge Deller
  2020-10-11 13:21   ` John David Anglin
  2020-10-12  6:50 ` PATCH v2] " Helge Deller
  1 sibling, 1 reply; 6+ messages in thread
From: Helge Deller @ 2020-10-11 11:56 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

On 10/10/20 11:54 PM, Helge Deller wrote:
> 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


> Suggested-by: John David Anglin <dave.anglin@bell.net>
> Signed-off-by: Helge Deller <deller@gmx.de>
>
> diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
> index 6fd8871e4081..d828b293b6de 100644
> --- a/arch/parisc/include/uapi/asm/mman.h
> +++ b/arch/parisc/include/uapi/asm/mman.h
> @@ -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 */
> diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
> index f9fd1325f5bd..c7af0f2292fc 100644
> --- a/tools/arch/parisc/include/uapi/asm/mman.h
> +++ b/tools/arch/parisc/include/uapi/asm/mman.h
> @@ -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
>


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

* Re: [PATCH] parisc: Add MAP_UNINITIALIZED define
  2020-10-11 11:56 ` Helge Deller
@ 2020-10-11 13:21   ` John David Anglin
  0 siblings, 0 replies; 6+ messages in thread
From: John David Anglin @ 2020-10-11 13:21 UTC (permalink / raw)
  To: Helge Deller, linux-parisc, James Bottomley

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

Dave

On 2020-10-11 7:56 a.m., Helge Deller wrote:
> On 10/10/20 11:54 PM, Helge Deller wrote:
>> 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
>
>
>> Suggested-by: John David Anglin <dave.anglin@bell.net>
>> Signed-off-by: Helge Deller <deller@gmx.de>
>>
>> diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
>> index 6fd8871e4081..d828b293b6de 100644
>> --- a/arch/parisc/include/uapi/asm/mman.h
>> +++ b/arch/parisc/include/uapi/asm/mman.h
>> @@ -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 */
>> diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
>> index f9fd1325f5bd..c7af0f2292fc 100644
>> --- a/tools/arch/parisc/include/uapi/asm/mman.h
>> +++ b/tools/arch/parisc/include/uapi/asm/mman.h
>> @@ -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
>>


-- 
John David Anglin  dave.anglin@bell.net


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

* PATCH v2] parisc: Add MAP_UNINITIALIZED define
  2020-10-10 21:54 [PATCH] parisc: Add MAP_UNINITIALIZED define Helge Deller
  2020-10-11 11:56 ` Helge Deller
@ 2020-10-12  6:50 ` Helge Deller
  2020-10-12  8:24   ` Rolf Eike Beer
  1 sibling, 1 reply; 6+ messages in thread
From: Helge Deller @ 2020-10-12  6:50 UTC (permalink / raw)
  To: linux-parisc, James Bottomley, John David Anglin

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

Suggested-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
index 6fd8871e4081..ab78cba446ed 100644
--- a/arch/parisc/include/uapi/asm/mman.h
+++ b/arch/parisc/include/uapi/asm/mman.h
@@ -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 */
diff --git a/tools/arch/parisc/include/uapi/asm/mman.h b/tools/arch/parisc/include/uapi/asm/mman.h
index f9fd1325f5bd..506c06a6536f 100644
--- a/tools/arch/parisc/include/uapi/asm/mman.h
+++ b/tools/arch/parisc/include/uapi/asm/mman.h
@@ -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

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

* Re: PATCH v2] parisc: Add MAP_UNINITIALIZED define
  2020-10-12  6:50 ` PATCH v2] " Helge Deller
@ 2020-10-12  8:24   ` Rolf Eike Beer
  2020-10-12  8:51     ` Helge Deller
  0 siblings, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2020-10-12  8:24 UTC (permalink / raw)
  To: Helge Deller; +Cc: linux-parisc, James Bottomley, John David Anglin

Am 2020-10-12 08:50, schrieb Helge Deller:
> We will not allow unitialized anon mmaps, but we need this define
> to prevent build errors, e.g. the debian foot package.
> 
> Suggested-by: John David Anglin <dave.anglin@bell.net>
> Signed-off-by: Helge Deller <deller@gmx.de>
> 
> diff --git a/arch/parisc/include/uapi/asm/mman.h
> b/arch/parisc/include/uapi/asm/mman.h
> index 6fd8871e4081..ab78cba446ed 100644
> --- a/arch/parisc/include/uapi/asm/mman.h
> +++ b/arch/parisc/include/uapi/asm/mman.h
> @@ -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 */
> diff --git a/tools/arch/parisc/include/uapi/asm/mman.h
> b/tools/arch/parisc/include/uapi/asm/mman.h
> index f9fd1325f5bd..506c06a6536f 100644
> --- a/tools/arch/parisc/include/uapi/asm/mman.h
> +++ b/tools/arch/parisc/include/uapi/asm/mman.h
> @@ -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

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

* Re: PATCH v2] parisc: Add MAP_UNINITIALIZED define
  2020-10-12  8:24   ` Rolf Eike Beer
@ 2020-10-12  8:51     ` Helge Deller
  0 siblings, 0 replies; 6+ messages in thread
From: Helge Deller @ 2020-10-12  8:51 UTC (permalink / raw)
  To: Rolf Eike Beer; +Cc: linux-parisc, James Bottomley, John David Anglin

On 10/12/20 10:24 AM, Rolf Eike Beer wrote:
> Am 2020-10-12 08:50, schrieb Helge Deller:
>> We will not allow unitialized anon mmaps, but we need this define
>> to prevent build errors, e.g. the debian foot package.
>>
>> Suggested-by: John David Anglin <dave.anglin@bell.net>
>> Signed-off-by: Helge Deller <deller@gmx.de>
>>
>> diff --git a/arch/parisc/include/uapi/asm/mman.h
>> b/arch/parisc/include/uapi/asm/mman.h
>> index 6fd8871e4081..ab78cba446ed 100644
>> --- a/arch/parisc/include/uapi/asm/mman.h
>> +++ b/arch/parisc/include/uapi/asm/mman.h
>> @@ -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 */
>> diff --git a/tools/arch/parisc/include/uapi/asm/mman.h
>> b/tools/arch/parisc/include/uapi/asm/mman.h
>> index f9fd1325f5bd..506c06a6536f 100644
>> --- a/tools/arch/parisc/include/uapi/asm/mman.h
>> +++ b/tools/arch/parisc/include/uapi/asm/mman.h
>> @@ -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

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

end of thread, other threads:[~2020-10-12  8:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 21:54 [PATCH] parisc: Add MAP_UNINITIALIZED define Helge Deller
2020-10-11 11:56 ` Helge Deller
2020-10-11 13:21   ` John David Anglin
2020-10-12  6:50 ` PATCH v2] " Helge Deller
2020-10-12  8:24   ` Rolf Eike Beer
2020-10-12  8:51     ` Helge Deller

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 NNTP newsgroup(s).