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 E2CBE3858D1E for ; Thu, 22 Dec 2022 13:35:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E2CBE3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671716128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5JDCNMsdX/EAe1VdZ5MaP/KjCKWOsDzNOhN/Q8qQiYc=; b=WXolY+naI+agikk1ggHGrvCWqnAx088reIV7lUXBzK6PbiT1Ea/g1ELVrcuRIfPkX81n8j hl0//42xF8NLZcA0m/k85GAcF9JM8CsMlb5MnkzB1mSoUvODlhXiqk6T/iTcKC9G5w3qLG I9CWOKaJ56p+5ZidsPb7sN+XmYqEaEQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-fU4ZQVN7MDOV4eJXptwi8A-1; Thu, 22 Dec 2022 08:35:25 -0500 X-MC-Unique: fU4ZQVN7MDOV4eJXptwi8A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 29CE72801E4C; Thu, 22 Dec 2022 13:35:25 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D279C16028; Thu, 22 Dec 2022 13:35:24 +0000 (UTC) From: Florian Weimer To: Siddhesh Poyarekar Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Add _FORTIFY_SOURCE implementation documentation [BZ #28998] References: <20221215162506.1802077-1-siddhesh@sourceware.org> Date: Thu, 22 Dec 2022 14:35:23 +0100 In-Reply-To: <20221215162506.1802077-1-siddhesh@sourceware.org> (Siddhesh Poyarekar's message of "Thu, 15 Dec 2022 11:25:06 -0500") Message-ID: <873597o92c.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Siddhesh Poyarekar: > +The @code{_FORTIFY_SOURCE} macro may be defined by users to control > +hardening of calls into some functions in @theglibc{}. This feature > +needs a compiler that supports either the @code{__builtin_object_size} > +or the @code{__builtin_dynamic_object_size} builtin functions. When the > +macro is defined, it enables code that validates access to buffers that > +are passed to some functions in @theglibc to determine if they > +are safe. If the compiler is able to deduce the size of the buffer > +passed to the function call but the call cannot be determined as safe, > +it is replaced by a call to its hardened variant that does the access > +validation at runtime. At runtime, if the access validation check for > +the buffer fails, the program will terminate with a @code{SIGABRT} > +signal. This doesn't really cover %n checks and the open checks, so it's slightly misleading. > +The following functions are fortified in @theglibc{}: > + > +@itemize @bullet > +@item @code{asprintf}: Replaced with @code{__asprintf_chk}. > + > +@item @code{confstr}: Replaced with @code{__confstr_chk}. Can we auto-generate this? It is incomplete. __open_2, __open64_2 and the *at variants are missing. FD_SET, FD_CLR, FD_ISSET, too. Thanks, Florian