From patchwork Wed Dec 22 20:49:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Azat Khuzhin X-Patchwork-Id: 49202 Return-Path: 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 AAAA43858424 for ; Wed, 22 Dec 2021 20:50:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAAA43858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1640206226; bh=SbtrW0gCjTcxOjmvAzGpu1dEIEhxRdwz/f7ILmGe1Yw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=r1pMjeHOxjTdtW9MelTEAfzDUiOBhtPCUz8lU25OKEPlJyRIJmjwSfLTM7GMym7DR dsXf18omQb5TXvSrmdqX7auKe1XYkCslhIDjb4TC9M1Oe/EL9CXCV0mLasBMcmUvRb bzkpWsOXJeb9Q7a/mraAGQWUIGRxVIbUJePCacm8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 3D1B83858D35 for ; Wed, 22 Dec 2021 20:49:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3D1B83858D35 Received: by mail-lf1-x135.google.com with SMTP id bp20so7937248lfb.6 for ; Wed, 22 Dec 2021 12:49:56 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=SbtrW0gCjTcxOjmvAzGpu1dEIEhxRdwz/f7ILmGe1Yw=; b=0A9aU8PY7JjAFt9su1UqgKmHJgIqTOtKZz1kkaAI6nNLshooTbC1vk0HH8mAYZpJ9T dm+ghFZ8bBFnKPuLFK0+TthutafVBOua/44onmAkIZVIECfhCRLoSapwPlvKJwgwulzE nmLJYfVbhof+YmNEn0BAVWNWHiu7hwyBfFtyiiGw2V+kPDGwNxSN9hvrMjbvuRjuP/uU puJHkvuWYkvboY19P+ILCyMNVA3FvDCR4zMigfP9Or3M2JMy2nenAffVJBW/Kjd5bC8I RaBB1JyiSIUQ5ByLLnsAW8Uj8RNMftvzA6R5l0LBve33Lh2cgcxl3A++Cyevx5IHYSUL t1jA== X-Gm-Message-State: AOAM530LnENGRPBluh/cCF5SsSoly66DtJOyTklmR/oHDi8FVJQko2je fOp0oAh6GB4KWesM0M9uDm4P+V9AteM= X-Google-Smtp-Source: ABdhPJyR37VVSqws+NQQU1GPJPp4qCTfMuWKRbK7W3UZvU56kFkc0RMSG3/xhWTSbm2NxoVlHyVV7Q== X-Received: by 2002:ac2:528a:: with SMTP id q10mr3429998lfm.28.1640206194662; Wed, 22 Dec 2021 12:49:54 -0800 (PST) Received: from localhost ([146.66.199.134]) by smtp.gmail.com with ESMTPSA id p8sm282564ljh.21.2021.12.22.12.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 12:49:54 -0800 (PST) To: gcc-patches@gcc.gnu.org Subject: [PATCH v2] libsanitizer: Fix setbuffer() interceptor (accept size not mode) Date: Wed, 22 Dec 2021 23:49:42 +0300 Message-Id: <20211222204942.18582-1-a3at.mail@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: References: MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Azat Khuzhin via Gcc-patches From: Azat Khuzhin Reply-To: Azat Khuzhin Cc: Azat Khuzhin Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Fixes: b667dd7017a ("Libsanitizer merge from trunk r368656.") Refs: https://reviews.llvm.org/D116176 --- .../sanitizer_common/sanitizer_common_interceptors.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc index abb38ccfa15..86784768fe5 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); - REAL(setbuffer)(stream, buf, mode); + COMMON_INTERCEPTOR_ENTER(ctx, setbuffer, stream, buf, size); + REAL(setbuffer)(stream, buf, size); if (buf) { - COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, __sanitizer_bufsiz); + COMMON_INTERCEPTOR_WRITE_RANGE(ctx, buf, size); } if (stream) unpoison_file(stream);