From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 57DC93858C20 for ; Mon, 22 Aug 2022 04:07:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 57DC93858C20 Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-205-UX8mzNVzMv-G1eYMHPHzdw-1; Mon, 22 Aug 2022 00:07:39 -0400 X-MC-Unique: UX8mzNVzMv-G1eYMHPHzdw-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-33352499223so167898027b3.8 for ; Sun, 21 Aug 2022 21:07:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc; bh=MlTGuURjL/9l8vW54EpwFu+WFms8M/sD76qvO6aQXtk=; b=NdHPSTmfdpnu+3i6lpjbAqWHBBL26Tc0hYs5rMBsE09OeeeQ/AuGGOFSWc2+mhFL6U 7oNAW7gvgFp67DIDuWQ+yCmmZevBvqDQ1OOwLjLa5x02MFZx0rYkaJuzjdAd5+s2O2o9 91vhy/Tz+F3DNE0K1HHatMZ8LT1TOZKD27tvGajVfCEBaymzx8NGp97W1axc9eJ8kGsN OA2H7f2FPPFt2n5m1EhJQZoUFclFLJ9zE8gftD9xrOC9XPITWd7mVAyzAPhPJJ8bAtSh sFE7anssL89OUAL2cJxLaIdaA4mYz1cnatb+WdsV3reNE7ys8WMx9c1SReVwEG3SC1Ex mRGw== X-Gm-Message-State: ACgBeo1x25gcFefQJyIaMmFCdwWK2af1MjM2UN07v9NxnJctewmQNTkX TP6yciIJe+dMm68p9v//bl8nF39T42UWbBFTaUioyOuS1WPJvX3KHZt1SdHBpTOZlSbUIw78Iv5 arM5Ryku68Y7uffchy/mCIbnALWnXSQ== X-Received: by 2002:a81:5f09:0:b0:32f:cf67:e1ab with SMTP id t9-20020a815f09000000b0032fcf67e1abmr18754625ywb.79.1661141258959; Sun, 21 Aug 2022 21:07:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR58lSu+45qhfVFOPtrng4kHv98ZwYoXmPptZgh0Up3mZUMbo8NzLpC6PxQ4mN2F3bbdkWT2eveA8+yOlGLFYNM= X-Received: by 2002:a81:5f09:0:b0:32f:cf67:e1ab with SMTP id t9-20020a815f09000000b0032fcf67e1abmr18754620ywb.79.1661141258746; Sun, 21 Aug 2022 21:07:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6918:778c:b0:d6:5452:a393 with HTTP; Sun, 21 Aug 2022 21:07:38 -0700 (PDT) In-Reply-To: <2351f99b1bc5bb8f120e132354b2580b5163916a.camel@xry111.site> References: <2351f99b1bc5bb8f120e132354b2580b5163916a.camel@xry111.site> From: Reid Wahl Date: Sun, 21 Aug 2022 21:07:38 -0700 Message-ID: Subject: Re: -fno-builtin not preventing __builtin___snprintf_chk in gcc 11.2.0-19ubuntu1 To: Xi Ruoyao Cc: "gcc-help@gcc.gnu.org" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2022 04:07:48 -0000 On Sunday, August 21, 2022, Xi Ruoyao wrote: > On Sun, 2022-08-21 at 19:39 -0700, Reid Wahl via Gcc-help wrote: > > For the title: -fno-builtin only prevents gcc to convert foo() to > __builtin_foo(). If you write __builtin_foo() directly built-in will be > used with or without -fno-builtin. Right. I was trying to keep the title short, but the issue was that snprintf() was being essentially replaced by __builtin___snprintf_chk() when I thought -fno-builtin should prevent any automatic replacements by __builtin_ function calls. > > The remaining discussion is not related to GCC anyway. _FORTIFY_SOURCE > is a Glibc (not GCC) feature, and it's just enabled by default because > the distro is *too* smart... I completely agree to add - > D_FORTIFY_SOURCE when they build their .deb packages, but hard wiring > this into GCC is just puzzling new users and causing them to wrongly > believe this was a "feature" of vanilla GCC. To make things worse, many > people use Ubuntu as their first Linux distro... I wasn't aware of _FORTIFY_SOURCE when I sent my first email. I read about __builtin___snprintf_chk() in the GCC documentation: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html And I agree with you. Especially since no other distro is doing that AFAIK, it's just confusing until you figure out what's going on. Even Debian doesn't do it. We have Debian systems in the same testbed and there are no errors there. > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University > > -- Regards, Reid Wahl (He/Him) Senior Software Engineer, Red Hat RHEL High Availability - Pacemaker