public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
@ 2017-03-31  8:34 Martin Liška
  2017-04-06 12:53 ` Martin Liška
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Liška @ 2017-03-31  8:34 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jakub Jelinek

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

Hello.

Cherry-picking the commit to fix PR reported originally to the GCC.
Ready to install after it finishes regression tests?

Thanks,
Martin

[-- Attachment #2: 0001-Cherry-pick-upstream-r299036-from-libsanitizer-PR-sa.patch --]
[-- Type: text/x-patch, Size: 2146 bytes --]

From 36cc9827dd47f213bb17dd7e37b3b19b740a0928 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Fri, 31 Mar 2017 10:28:25 +0200
Subject: [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR
 sanitizer/80166).

libsanitizer/ChangeLog:

2017-03-31  Martin Liska  <mliska@suse.cz>

	* sanitizer_common/sanitizer_common_interceptors.inc (INTERCEPTOR):
	Cherry-pick upstream r299036.

gcc/testsuite/ChangeLog:

2017-03-31  Martin Liska  <mliska@suse.cz>

	* gcc.dg/asan/pr80166.c: New test.
---
 gcc/testsuite/gcc.dg/asan/pr80166.c                | 24 ++++++++++++++++++++++
 .../sanitizer_common_interceptors.inc              |  3 ++-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.dg/asan/pr80166.c

diff --git a/gcc/testsuite/gcc.dg/asan/pr80166.c b/gcc/testsuite/gcc.dg/asan/pr80166.c
new file mode 100644
index 00000000000..629dd23a31c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr80166.c
@@ -0,0 +1,24 @@
+/* PR sanitizer/80166 */
+/* { dg-do run } */
+
+#include <sys/types.h>
+#include <unistd.h>
+
+int
+main (int argc, char **argv)
+{
+  gid_t groups;
+  int r = getgroups (0, &groups);
+  if (r < 0)
+    __builtin_abort ();
+
+  r = getgroups (-1, &groups);
+  if (r != -1)
+    __builtin_abort ();
+
+  r = getgroups (-1, NULL);
+  if (r != -1)
+    __builtin_abort ();
+
+  return 0;
+}
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
index 0970eda5ee6..195014022a0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -3350,7 +3350,8 @@ INTERCEPTOR(int, getgroups, int size, u32 *lst) {
   // its metadata. See
   // https://github.com/google/sanitizers/issues/321.
   int res = REAL(getgroups)(size, lst);
-  if (res && lst) COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
+  if (res >= 0 && lst && size > 0)
+    COMMON_INTERCEPTOR_WRITE_RANGE(ctx, lst, res * sizeof(*lst));
   return res;
 }
 #define INIT_GETGROUPS COMMON_INTERCEPT_FUNCTION(getgroups);
-- 
2.12.0


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

* Re: [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
  2017-03-31  8:34 [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166) Martin Liška
@ 2017-04-06 12:53 ` Martin Liška
  2017-04-06 12:57   ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Liška @ 2017-04-06 12:53 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jakub Jelinek

PING^1

On 03/31/2017 10:34 AM, Martin Liška wrote:
> Hello.
> 
> Cherry-picking the commit to fix PR reported originally to the GCC.
> Ready to install after it finishes regression tests?
> 
> Thanks,
> Martin
> 

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

* Re: [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
  2017-04-06 12:53 ` Martin Liška
@ 2017-04-06 12:57   ` Jakub Jelinek
  2017-04-06 13:05     ` Martin Liška
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2017-04-06 12:57 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

On Thu, Apr 06, 2017 at 02:53:06PM +0200, Martin Liška wrote:
> PING^1

I've acked that on IRC, with:
marxin: please use PR sanitizer/80166 in the ChangeLog, ok with that

> On 03/31/2017 10:34 AM, Martin Liška wrote:
> > Hello.
> > 
> > Cherry-picking the commit to fix PR reported originally to the GCC.
> > Ready to install after it finishes regression tests?

	Jakub

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

* Re: [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166).
  2017-04-06 12:57   ` Jakub Jelinek
@ 2017-04-06 13:05     ` Martin Liška
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Liška @ 2017-04-06 13:05 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GCC Patches

On 04/06/2017 02:57 PM, Jakub Jelinek wrote:
> On Thu, Apr 06, 2017 at 02:53:06PM +0200, Martin Liška wrote:
>> PING^1
> 
> I've acked that on IRC, with:
> marxin: please use PR sanitizer/80166 in the ChangeLog, ok with that

Sorry, I must miss that due to connection troubles.

Anyway, thanks,
Martin

> 
>> On 03/31/2017 10:34 AM, Martin Liška wrote:
>>> Hello.
>>>
>>> Cherry-picking the commit to fix PR reported originally to the GCC.
>>> Ready to install after it finishes regression tests?
> 
> 	Jakub
> 

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

end of thread, other threads:[~2017-04-06 13:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31  8:34 [PATCH] Cherry-pick upstream r299036 from libsanitizer (PR sanitizer/80166) Martin Liška
2017-04-06 12:53 ` Martin Liška
2017-04-06 12:57   ` Jakub Jelinek
2017-04-06 13:05     ` Martin Liška

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