Message ID | 20211222181912.29879-1-a3at.mail@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3EF0E3858402 for <patchwork@sourceware.org>; Wed, 22 Dec 2021 18:19:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EF0E3858402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1640197193; bh=9PjbdW4Q9JFT58yEV4o5ZOkuC6zCvlwx3oJI2u+r9So=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=enUj1FGZXyLJ5LdbxdwnpvA29m+ktACZVpKWtEfZK2XmsqNnP0yFKKJ1jtAFKZJR5 SH6LwemHiKIUpvPNcJlwJeDXgEh0/p5d0mApAEbh6WBqA6Swx9Jkapg3VMv4GDiFel 8gexjd5fEBcUgNV0Gz/jJWoUcv3uw/1qho90V89s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id B24073858D35 for <gcc-patches@gcc.gnu.org>; Wed, 22 Dec 2021 18:19:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B24073858D35 Received: by mail-lj1-x236.google.com with SMTP id by39so5162493ljb.2 for <gcc-patches@gcc.gnu.org>; Wed, 22 Dec 2021 10:19:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9PjbdW4Q9JFT58yEV4o5ZOkuC6zCvlwx3oJI2u+r9So=; b=Yfyov+XGirV8FFgCmi+1NDIAKC2OfyFSqyGaFgsmI8rHGD0kjDsR0X1rcdDuGoS1u4 8TyKGkvPyGn9ZaRY2pp+cAnYgPP/+0IVaoWM2lwXjg8C0o0TDU+Fo6tWJ0tvqyQoBe+4 +sB1g7EYnw8+4n4E157efNhXsYzCvB3g4dtyGxNT4DR/5ZZRvex9UyF+trjKfEyawNPg E2ioy/EFTzS9MMFI3q/MrtGJdFcu97FvVDlteVoMgxSrvYHVgGAV5N+M0SHrpeqTx/8K c7TE2uA2QKra+uytR4R14psPES0tqOhXj2W2fOddFXmPPRk5Q/iWKpZsJ+gPvKUHExHc 6RaQ== X-Gm-Message-State: AOAM532U7AjEyNse0yIt9UiB2cCg8LWyFXQGq2YsvEIFQzf0D4YAjua6 3544R0c6k7ZYp4dpLV2DCYGrtBji2G0= X-Google-Smtp-Source: ABdhPJzKhLVlgoiR+sWI+l+sGQX2QBlIzPYNxap+XXzpZET8swV3pcnJcCcH7LYTRZ8QW4vsDMgOQQ== X-Received: by 2002:a2e:a792:: with SMTP id c18mr2899356ljf.443.1640197162162; Wed, 22 Dec 2021 10:19:22 -0800 (PST) Received: from localhost ([146.66.199.134]) by smtp.gmail.com with ESMTPSA id z6sm83740lfq.219.2021.12.22.10.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 10:19:21 -0800 (PST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] libsanitizer: Fix setbuffer() interceptor (accept size not mode) Date: Wed, 22 Dec 2021 21:19:12 +0300 Message-Id: <20211222181912.29879-1-a3at.mail@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Azat Khuzhin via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Azat Khuzhin <a3at.mail@gmail.com> Cc: Azat Khuzhin <a3at.mail@gmail.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
libsanitizer: Fix setbuffer() interceptor (accept size not mode)
|
|
Commit Message
Azat Khuzhin
Dec. 22, 2021, 6:19 p.m. UTC
Fixes: b667dd7017a ("Libsanitizer merge from trunk r368656.") Refs: https://reviews.llvm.org/D116176 --- .../sanitizer_common/sanitizer_common_interceptors.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Comments
On 22 December 2021 19:19:12 CET, Azat Khuzhin via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: >Fixes: b667dd7017a ("Libsanitizer merge from trunk r368656.") >Refs: https://reviews.llvm.org/D116176 >--- > .../sanitizer_common/sanitizer_common_interceptors.inc | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc >index abb38ccfa15..60b0545a943 100644 >--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc >+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc >@@ -7858,12 +7858,13 @@ INTERCEPTOR(void, setbuf, __sanitizer_FILE *stream, char *buf) { > unpoison_file(stream); > } > >-INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, int mode) { >+INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, >+ SIZE_T size) { > void *ctx; >- COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, mode); >+ COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, size); > REAL(setbuffer)(stream, buf, mode); Where does mode come from after this patch? thanks, > if (buf) { >- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, __sanitizer_bufsiz); >+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, size); > } > if (stream) > unpoison_file(stream);
On Wed, Dec 22, 2021 at 09:41:06PM +0100, Bernhard Reutner-Fischer wrote: > On 22 December 2021 19:19:12 CET, Azat Khuzhin via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > >Fixes: b667dd7017a ("Libsanitizer merge from trunk r368656.") > >Refs: https://reviews.llvm.org/D116176 > >--- > > .../sanitizer_common/sanitizer_common_interceptors.inc | 7 ++++--- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > >diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc > >index abb38ccfa15..60b0545a943 100644 > >--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc > >+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc > >@@ -7858,12 +7858,13 @@ INTERCEPTOR(void, setbuf, __sanitizer_FILE *stream, char *buf) { > > unpoison_file(stream); > > } > > > >-INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, int mode) { > >+INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, > >+ SIZE_T size) { > > void *ctx; > >- COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, mode); > >+ COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, size); > > REAL(setbuffer)(stream, buf, mode); > > Where does mode come from after this patch? setbuffer() does not accept mode, it simply do not change it. Only setvbuf() can change the mode. > thanks, > > > if (buf) { > >- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, __sanitizer_bufsiz); > >+ COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, size); > > } > > if (stream) > > unpoison_file(stream); >
On Wed, Dec 22, 2021 at 09:41:06PM +0100, Bernhard Reutner-Fischer wrote: > On 22 December 2021 19:19:12 CET, Azat Khuzhin via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > >- COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, mode); > >+ COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, size); > > REAL(setbuffer)(stream, buf, mode); > > Where does mode come from after this patch? Sorry, missed that. Fixed and send v2 patch. Thanks!
On Wed, 22 Dec 2021 23:50:39 +0300
Azat Khuzhin <a3at.mail@gmail.com> wrote:
> Thanks!
you're welcome.
You should state how you tested the patch. Please refer to
https://gcc.gnu.org/contribute.html#testing
thanks,
On Wed, Dec 22, 2021 at 10:02:02PM +0100, Bernhard Reutner-Fischer wrote: > You should state how you tested the patch. Please refer to > https://gcc.gnu.org/contribute.html#testing I though about this, but when gcc syncs changes with upstream [1], it does not syncs tests, even though they were there [2]. [1]: https://github.com/gcc-mirror/gcc/commit/b667dd7017a8 [2]: https://github.com/llvm/llvm-project/commit/0c81a62d9d76 That's why I though that test can be ommitted in this case (I've added a test for llvm in [3]). [3]: https://reviews.llvm.org/D116176 So what is the right way here? - migrate all tests - write test only for setbuffer() - do not add any tests, since they are covered in llvm repo
On 12/22/21 22:09, Azat Khuzhin via Gcc-patches wrote: > So what is the right way here? > - migrate all tests > - write test only for setbuffer() > - do not add any tests, since they are covered in llvm repo Hello. Yes, we don't automatically sync sanitizer tests when we merge from master. Historically, we have taken some upstream tests, but not all. Problem is that one needs to migrate (port) LIT markup to DejaGNU format so that it can be supported in the GCC test-suite. Cheers, Martin
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc index abb38ccfa15..60b0545a943 100644 --- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc +++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc @@ -7858,12 +7858,13 @@ INTERCEPTOR(void, setbuf, __sanitizer_FILE *stream, char *buf) { unpoison_file(stream); } -INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, int mode) { +INTERCEPTOR(void, setbuffer, __sanitizer_FILE *stream, char *buf, + SIZE_T size) { void *ctx; - COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, mode); + COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, size); REAL(setbuffer)(stream, buf, mode); if (buf) { - COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, __sanitizer_bufsiz); + COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, size); } if (stream) unpoison_file(stream);