{"thread":{"id":"49644","subject":"[PATCH] compat: make sure git_mmap is not expected to write","startedAt":"2018-10-23T05:12:37Z","lastAt":"2018-10-24T03:23:07Z","messageCount":4,"participants":["carlo","Johannes Schindelin","Carlo Marcelo Arenas Belón","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"361260","messageId":"20181023051216.64266-1-carenas@gmail.com","threadId":"49644","inReplyTo":null,"subject":"[PATCH] compat: make sure git_mmap is not expected to write","fromName":"carlo","fromEmail":"carenas@gmail.com","sentAt":"2018-10-23T05:12:16Z","receivedAt":"2018-10-23T05:12:37Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"in f48000fc (\"Yank writing-back support from gitfakemmap.\", 2005-10-08)\nsupport for writting back changes was removed but the specific prot\nflag that would be used was not checked for)\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n compat/mmap.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/compat/mmap.c b/compat/mmap.c\nindex 7f662fef7b..14d31010df 100644\n--- a/compat/mmap.c\n+++ b/compat/mmap.c\n@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of\n {\n \tsize_t n = 0;\n \n-\tif (start != NULL || !(flags & MAP_PRIVATE))\n+\tif (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)\n \t\tdie(\"Invalid usage of mmap when built with NO_MMAP\");\n \n \tstart = xmalloc(length);\n-- \n2.19.1\n\n"},{"id":"361267","messageId":"nycvar.QRO.7.76.6.1810231212190.4546@tvgsbejvaqbjf.bet","threadId":"49644","inReplyTo":"20181023051216.64266-1-carenas@gmail.com","subject":"Re: [PATCH] compat: make sure git_mmap is not expected to write","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2018-10-23T10:13:14Z","receivedAt":"2018-10-23T10:13:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi carlo,\n\nyour mail's \"From:\" line does not record your full name, but the\nSigned-off-by: line does. Let's use the latter?\n\nOn Mon, 22 Oct 2018, carlo wrote:\n\n> in f48000fc (\"Yank writing-back support from gitfakemmap.\", 2005-10-08)\n> support for writting back changes was removed but the specific prot\n> flag that would be used was not checked for)\n> \n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n\nACK!\n\nThank you,\nJohannes\n\n> ---\n>  compat/mmap.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/compat/mmap.c b/compat/mmap.c\n> index 7f662fef7b..14d31010df 100644\n> --- a/compat/mmap.c\n> +++ b/compat/mmap.c\n> @@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of\n>  {\n>  \tsize_t n = 0;\n>  \n> -\tif (start != NULL || !(flags & MAP_PRIVATE))\n> +\tif (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)\n>  \t\tdie(\"Invalid usage of mmap when built with NO_MMAP\");\n>  \n>  \tstart = xmalloc(length);\n> -- \n> 2.19.1\n> \n> "},{"id":"361284","messageId":"20181023123519.91317-1-carenas@gmail.com","threadId":"49644","inReplyTo":"nycvar.QRO.7.76.6.1810231212190.4546@tvgsbejvaqbjf.bet","subject":"[PATCH v2] compat: make sure git_mmap is not expected to write","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-23T12:35:19Z","receivedAt":"2018-10-23T12:35:38Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"in f48000fc (\"Yank writing-back support from gitfakemmap.\", 2005-10-08)\nsupport for writting back changes was removed but the specific prot\nflag that would be used was not checked for\n\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\nChanges in v2:\n    \n* reset-author to match signature\n* cleanup commit message and add ACK\n\n compat/mmap.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/compat/mmap.c b/compat/mmap.c\nindex 7f662fef7b..14d31010df 100644\n--- a/compat/mmap.c\n+++ b/compat/mmap.c\n@@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of\n {\n \tsize_t n = 0;\n \n-\tif (start != NULL || !(flags & MAP_PRIVATE))\n+\tif (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)\n \t\tdie(\"Invalid usage of mmap when built with NO_MMAP\");\n \n \tstart = xmalloc(length);\n-- \n2.19.1\n\n"},{"id":"361354","messageId":"xmqqr2ggqftu.fsf@gitster-ct.c.googlers.com","threadId":"49644","inReplyTo":"20181023123519.91317-1-carenas@gmail.com","subject":"Re: [PATCH v2] compat: make sure git_mmap is not expected to write","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-24T01:43:57Z","receivedAt":"2018-10-24T03:23:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:\n\n> in f48000fc (\"Yank writing-back support from gitfakemmap.\", 2005-10-08)\n> support for writting back changes was removed but the specific prot\n> flag that would be used was not checked for\n>\n> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n> Changes in v2:\n>     \n> * reset-author to match signature\n> * cleanup commit message and add ACK\n\nThanks.  Looking good.\n\n\n>  compat/mmap.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/compat/mmap.c b/compat/mmap.c\n> index 7f662fef7b..14d31010df 100644\n> --- a/compat/mmap.c\n> +++ b/compat/mmap.c\n> @@ -4,7 +4,7 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of\n>  {\n>  \tsize_t n = 0;\n>  \n> -\tif (start != NULL || !(flags & MAP_PRIVATE))\n> +\tif (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)\n>  \t\tdie(\"Invalid usage of mmap when built with NO_MMAP\");\n>  \n>  \tstart = xmalloc(length);\n"}]}