git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] compat: make sure git_mmap is not expected to write
@ 2018-10-23  5:12 carlo
  2018-10-23 10:13 ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: carlo @ 2018-10-23  5:12 UTC (permalink / raw)
  To: git; +Cc: Johannes.Schindelin, carlo

in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08)
support for writting back changes was removed but the specific prot
flag that would be used was not checked for)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 compat/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mmap.c b/compat/mmap.c
index 7f662fef7b..14d31010df 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
 {
 	size_t n = 0;
 
-	if (start != NULL || !(flags & MAP_PRIVATE))
+	if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
 		die("Invalid usage of mmap when built with NO_MMAP");
 
 	start = xmalloc(length);
-- 
2.19.1


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

* Re: [PATCH] compat: make sure git_mmap is not expected to write
  2018-10-23  5:12 [PATCH] compat: make sure git_mmap is not expected to write carlo
@ 2018-10-23 10:13 ` Johannes Schindelin
  2018-10-23 12:35   ` [PATCH v2] " Carlo Marcelo Arenas Belón
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2018-10-23 10:13 UTC (permalink / raw)
  To: carlo; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

Hi carlo,

your mail's "From:" line does not record your full name, but the
Signed-off-by: line does. Let's use the latter?

On Mon, 22 Oct 2018, carlo wrote:

> in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08)
> support for writting back changes was removed but the specific prot
> flag that would be used was not checked for)
> 
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>

ACK!

Thank you,
Johannes

> ---
>  compat/mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/compat/mmap.c b/compat/mmap.c
> index 7f662fef7b..14d31010df 100644
> --- a/compat/mmap.c
> +++ b/compat/mmap.c
> @@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
>  {
>  	size_t n = 0;
>  
> -	if (start != NULL || !(flags & MAP_PRIVATE))
> +	if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
>  		die("Invalid usage of mmap when built with NO_MMAP");
>  
>  	start = xmalloc(length);
> -- 
> 2.19.1
> 
> 

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

* [PATCH v2] compat: make sure git_mmap is not expected to write
  2018-10-23 10:13 ` Johannes Schindelin
@ 2018-10-23 12:35   ` Carlo Marcelo Arenas Belón
  2018-10-24  1:43     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2018-10-23 12:35 UTC (permalink / raw)
  To: gitster; +Cc: git, Johannes.Schindelin, Carlo Marcelo Arenas Belón

in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08)
support for writting back changes was removed but the specific prot
flag that would be used was not checked for

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
Changes in v2:
    
* reset-author to match signature
* cleanup commit message and add ACK

 compat/mmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/mmap.c b/compat/mmap.c
index 7f662fef7b..14d31010df 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
 {
 	size_t n = 0;
 
-	if (start != NULL || !(flags & MAP_PRIVATE))
+	if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
 		die("Invalid usage of mmap when built with NO_MMAP");
 
 	start = xmalloc(length);
-- 
2.19.1


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

* Re: [PATCH v2] compat: make sure git_mmap is not expected to write
  2018-10-23 12:35   ` [PATCH v2] " Carlo Marcelo Arenas Belón
@ 2018-10-24  1:43     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2018-10-24  1:43 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón; +Cc: git, Johannes.Schindelin

Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:

> in f48000fc ("Yank writing-back support from gitfakemmap.", 2005-10-08)
> support for writting back changes was removed but the specific prot
> flag that would be used was not checked for
>
> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> Changes in v2:
>     
> * reset-author to match signature
> * cleanup commit message and add ACK

Thanks.  Looking good.


>  compat/mmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/compat/mmap.c b/compat/mmap.c
> index 7f662fef7b..14d31010df 100644
> --- a/compat/mmap.c
> +++ b/compat/mmap.c
> @@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
>  {
>  	size_t n = 0;
>  
> -	if (start != NULL || !(flags & MAP_PRIVATE))
> +	if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
>  		die("Invalid usage of mmap when built with NO_MMAP");
>  
>  	start = xmalloc(length);

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

end of thread, other threads:[~2018-10-24  3:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  5:12 [PATCH] compat: make sure git_mmap is not expected to write carlo
2018-10-23 10:13 ` Johannes Schindelin
2018-10-23 12:35   ` [PATCH v2] " Carlo Marcelo Arenas Belón
2018-10-24  1:43     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).