From patchwork Wed Nov 29 09:42:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yaakov Selkowitz X-Patchwork-Id: 119938 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2831804qgn; Wed, 29 Nov 2017 01:43:50 -0800 (PST) X-Google-Smtp-Source: AGs4zMbiqril/Z7FK3zZazh+SIoYD/HxiiVC44c26YTWHd5ERuM5xJj1fdzPdhGHZjttg/0SsF5b X-Received: by 10.98.29.83 with SMTP id d80mr2345284pfd.156.1511948629788; Wed, 29 Nov 2017 01:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511948629; cv=none; d=google.com; s=arc-20160816; b=JWxHhiALkbP+CZy5txls1JSy2LmNBdb4GxD76Ftstv1LTdqqB7z1DF0kD8uPZXmCaI VV3gXyFCWg6gDycnUOr04NdrnAL9YUW163KdULU7L19KeHNONxmautuTh0KZWRGnS7RE xoVV0zdAFghwrig5E5MVhkLaRjGG1JkBnfmxJUDuJh6JOg3X8/P/C6kk/wFrPv0TTB+f H+Eyf91BpX+UkZQGed9A13z3xI9IrW8ZqD/+4Eym87e5K6a9BOgSosgisxl3mAbadcIN VNuzfEX6zVJv4ktGHopRie4jYr0tKO0TsPbiPCE012wUiu82aUAqK8LkxxO3IqZged6W rfWA== 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=zG4DGCkC0UhP0ath9EGk5uHPb6+PO0GtUsCxlsf7zC/nDfL1mREpC5Z3MvbjW8/aWo V3KosZ+BoJEFpCt2uhpmkUS3+T9GRYjhql7DyZngQoGokmFKzYVmz6gPHg45Kb4E1HjW LDfhB5V6qkcef+qDhHUkwynOEex8Qx3Sc1M+yobFAeKXoWdVunoor0DkjFshIWx8xjWN +FnZtmghH1EburFNejO/Zp392Saa5B38xDOzdEJVF56LZynZZDrJ5wFfMhGhqmv9mypf 1tHp9OsSl7PXtAUNQBUZ9wp4FV2/6RrwuM6algTaHWNiXqwj7WmZwB5I5vwoYPJzV7AE Lngw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=jq9DY+AQ; spf=pass (google.com: domain of newlib-return-15399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-15399-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 3si1007551plq.608.2017.11.29.01.43.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Nov 2017 01:43:49 -0800 (PST) Received-SPF: pass (google.com: domain of newlib-return-15399-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=jq9DY+AQ; spf=pass (google.com: domain of newlib-return-15399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-15399-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=mcMfXzjPEHo5kFavja4SjhOOYypOrNR EtBitMBCSHGacyZhniYk0EqAmhz+u3KB9vQcx5WlqhgX/mctzs8BjvjvgOTj8pbw m4zy+2lOigfhNLoX6MC8AkIKOgpMx6Kd2mMqwP3IYQ3WQGX3pqhtbAIiIdNAppfG Tu6Cvy9Tiah8= 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=jq9DY +AQjECjXl8l57dsrfbsFGX4vcIk88c/lhGlIX7sAylfoTAHyZVR9ZxUP0iVVFTM7 An0C+7AblefWPxhspvJ8Oi85099A5fmAcSONlfOdo9posyWbPJwTeQm8uDYYonDq SmD8hPq3SD26kA8hnp0bZB1BzmFa+saMZFX0bo= Received: (qmail 66873 invoked by alias); 29 Nov 2017 09:43:22 -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 66596 invoked by uid 89); 29 Nov 2017 09:43:20 -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 09:43:18 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 626FE780CD for ; Wed, 29 Nov 2017 09:43:17 +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 E588860C91 for ; Wed, 29 Nov 2017 09:43:16 +0000 (UTC) From: Yaakov Selkowitz To: newlib@sourceware.org Subject: [PATCH v5 07/10] ssp: add documentation Date: Wed, 29 Nov 2017 03:42:57 -0600 Message-Id: <20171129094300.20296-8-yselkowi@redhat.com> In-Reply-To: <20171129094300.20296-1-yselkowi@redhat.com> References: <20171129094300.20296-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