From patchwork Wed Nov 29 00:21:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 119911 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2395898qgn; Tue, 28 Nov 2017 16:22:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMbdcApUU1vax3Ge+tLUWRT0+faCSuK7Lg8X9ZrjOf3ip7ns2jmcdfyr22qtKoLI2rCWciH9 X-Received: by 10.98.152.147 with SMTP id d19mr973586pfk.95.1511914947738; Tue, 28 Nov 2017 16:22:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511914947; cv=none; d=google.com; s=arc-20160816; b=NkWfMIbOwFeyzME4ayhjPZVoTHH/OakZZaUlHVyZ1bawXLJMHBsVIyLe5+/cHMVXrV XF6ZSbl+W9VzfG58Dj8nMeJgvKRkJGWgx76w7qOLeXQSV4U9K2O2mkfbNFFNLQ5yN7Oi V6J1Ii1J72Ksw+pByVErY82bAeAXrV5wE8LrVeUc4MmJvnShooRRn2c5oJbf29oOAZ9P BhABm+cDxjqLyupgLRtjEH1pKPwsC51aTCX1Aut+QATAzqU0+3JaQHmbf6ZU7HJLcY3p 9gH1BvCKKX5OD540U/4gX1v0RnJTturPxJKLI1KShqdHX8ClyVIiW7rwXHpZ40/IWIyV rrng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=LtnP41XGf1zbF+H8EW7Aip1JntKJpxJj3Di3UEn8Vog=; b=JkAztoFhMz9cluut0ySo10XTNe30/GIXaVL+z4cOqRTMl0rUqMuc87mrm8zLvUkVVl fxNfO2nWmvUOkD935j2N4/rMcz8caF7ylYIqeY2GR0zpFBSzPEZtfXKdLZ5Uk0GS0iNH yfkElDcCdbm/6gh5SDLUEA4PZ0A74HxiyjssVJcfkXPqjZBv4ssZ0H+F3pNan3URlgDe ic8XAlgnAiSbYUxCVjFeZUyRE3JeglRDtlJ7a7G1v6aAiGv68x5v+FRHInURsvQselBZ XNwqrRhfSRe9WhygC9/+XoegfM2frYMHNyftj7Z+iaRKzbefZVMdHcEFHIlV2+Tg2Kl+ 5BeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=b64Zc5D4; spf=pass (google.com: domain of newlib-return-15389-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-15389-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t18si295308plo.347.2017.11.28.16.22.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 16:22:27 -0800 (PST) Received-SPF: pass (google.com: domain of newlib-return-15389-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=b64Zc5D4; spf=pass (google.com: domain of newlib-return-15389-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-15389-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=uXsbCmmo1hHz+XM0dLnlVeSRL5YP1dq zd65LMylbOVkXL7zfLHkcxzFxznjogWjRjvEV4kGndQsVmjOfiEen6tWW5V1DUVH jHmLULziMRinzr8qDoZdV+UuiH28sizWO1HN8r2ajYdiOfvZUdwSLCQIA8hfWdng GsG7O2BSBalw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=5MSVUgbxyytHbXWnBb3N8DiEXlE=; b=b64Zc 5D4lcFDOTW6/6kbTgC/JZ8M6cpDfcajAVTr07CpmWegNYPR0VNPbba27MdL7lD96 8cpgPpdwqL8qEj1FZauGVlC0Xqx5Dp1sgvdW6DouMYgoZ5XDQoy8BqJeeZ5mDhx2 mZm7REW2BXenMXKkLz3B2Hr7BPw+uQ4fSKQiDI= Received: (qmail 66016 invoked by alias); 29 Nov 2017 00:21:59 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Delivered-To: mailing list newlib@sourceware.org Received: (qmail 65852 invoked by uid 89); 29 Nov 2017 00:21:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Nov 2017 00:21:58 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE59F85550 for ; Wed, 29 Nov 2017 00:21:56 +0000 (UTC) Received: from localhost.localdomain (ovpn-120-11.rdu2.redhat.com [10.10.120.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89442600D1 for ; Wed, 29 Nov 2017 00:21:56 +0000 (UTC) From: Yaakov Selkowitz To: newlib@sourceware.org Subject: [PATCH v4 07/10] ssp: add documentation Date: Tue, 28 Nov 2017 18:21:40 -0600 Message-Id: <20171129002143.12500-8-yselkowi@redhat.com> In-Reply-To: <20171129002143.12500-1-yselkowi@redhat.com> References: <20171129002143.12500-1-yselkowi@redhat.com> Signed-off-by: Yaakov Selkowitz --- newlib/libc/libc.in.xml | 1 + newlib/libc/libc.texinfo | 1 + newlib/libc/ssp/ssp.tex | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 newlib/libc/ssp/ssp.tex -- 2.15.0 diff --git a/newlib/libc/libc.in.xml b/newlib/libc/libc.in.xml index 972696189..bf5f8a05f 100644 --- a/newlib/libc/libc.in.xml +++ b/newlib/libc/libc.in.xml @@ -35,6 +35,7 @@ + diff --git a/newlib/libc/libc.texinfo b/newlib/libc/libc.texinfo index 995e95e5c..f8c820baf 100644 --- a/newlib/libc/libc.texinfo +++ b/newlib/libc/libc.texinfo @@ -171,6 +171,7 @@ into another language, under the above conditions for modified versions. @ifset ICONV * Iconv:: @end ifset +* Overflow Protection:: * Document Index:: @end menu diff --git a/newlib/libc/ssp/ssp.tex b/newlib/libc/ssp/ssp.tex new file mode 100644 index 000000000..f8440bdf9 --- /dev/null +++ b/newlib/libc/ssp/ssp.tex @@ -0,0 +1,44 @@ +@node Overflow Protection +@chapter Overflow Protection + +@menu +* Stack Smashing Protection:: Checks enabled with -fstack-protector* +* Object Size Checking:: Checks enabled with _FORTIFY_SOURCE +@end menu + +@node Stack Smashing Protection +@section Stack Smashing Protection +Stack Smashing Protection is a compiler feature which emits extra code +to check for stack smashing attacks. It depends on a canary, which is +initialized with the process, and functions for process termination when +an overflow is detected. These are private entry points intended solely +for use by the compiler, and are used when any of the @code{-fstack-protector}, +@code{-fstack-protector-all}, @code{-fstack-protector-explicit}, or +@code{-fstack-protector-strong} compiler flags are enabled. + +@node Object Size Checking +@section Object Size Checking +Object Size Checking is a feature which wraps certain functions with checks +to prevent buffer overflows. These are enabled when compiling with +optimization (@code{-O1} and higher) and @code{_FORTIFY_SOURCE} defined +to 1, or for stricter checks, to 2. + +@cindex list of overflow protected functions +The following functions use object size checking to detect buffer overflows +when enabled: + +@example +@exdent @emph{String functions:} +bcopy memmove strcpy +bzero mempcpy strcat +explicit_bzero memset strncat +memcpy stpcpy strncpy + +@exdent @emph{Stdio functions:} +fgets fread_unlocked sprintf +fgets_unlocked gets vsnprintf +fread snprintf vsprintf + +@exdent @emph{System functions:} +getcwd read readlink +@end example