[gcc12-changes] Add a new item about the support for automatic static variable initialization
Message ID | BFF3F4BB-1FAB-4FDD-B160-380044158175@oracle.com |
---|---|
State | New |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> 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 F1F9A3858406 for <patchwork@sourceware.org>; Tue, 28 Sep 2021 20:31:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F1F9A3858406 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632861115; bh=mJusd+Z1zOgKeWb9qmpvTzm0I/mwIp2NV1gA8/0rkjo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Ts0bl89rtILy4npxhCn5e6WBLLoBcny+Yt+vVGUggTbqBQJNBR7bbe1LZY5ISei/S p4pnFxWIeNWBJPz81oiVXFg5LAAL+3iW0/bKy9iI1gQoAIg/GqxoW0EHF0qyr2nCp2 rdALIBsKuyxq+9DiB1SucMHyegMfYe2NiaGkOtEU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 166303858406 for <gcc-patches@gcc.gnu.org>; Tue, 28 Sep 2021 20:31:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 166303858406 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18SJxdSB027581; Tue, 28 Sep 2021 20:31:21 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3bbhvc2gan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Sep 2021 20:31:19 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 18SKEuA5051887; Tue, 28 Sep 2021 20:31:15 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2043.outbound.protection.outlook.com [104.47.74.43]) by aserp3030.oracle.com with ESMTP id 3bc4k89a19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Sep 2021 20:31:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DUA8W2vvSyBxfEeBZpaZCG3Rk6/FoNyGo31MgEizMzurJuPxygVOVJD7uHbEgq/f8Y0rlAgQ5vLH3utAsUJC60pMBkDazIb7Yr2ToBuo70b2ixRvNeMYFm1ZSJaqfDdBgehywEifnRFDX9wCGZwW+uPlB6wRMFQ0EIB/VQkaL6vE+VtFH8/lEaUiwdXloKmncW4Lfy7NWkBDjuLID3zIziKjAwDK0+3gfIt4rnpimhM8O38DOPw6pgb8BmT9VpyKci9IVCqthmYMzbTksEWCClIgehqkcvsvXX1YwZeQ7pMVDsQ4563NIthU1viwuymgwxmksGo8tTOxhQMOkgkkkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mJusd+Z1zOgKeWb9qmpvTzm0I/mwIp2NV1gA8/0rkjo=; b=Mp9YUGAQKyAlOssmbkrsVpGDcnrhnXp3FHGFlK9q34VCTVuq/tFp0xRj2/PrrQIEy2w60Ygfj5lRM3HtahuDiwznlaCvfgf0FRlOEAxrr8co/+sOpq3mxeOVd/THUwpL2AtzjpTyi16OVZvO8hLIC5Qb0g1kuf1WK6AJS+4z8WL3lCZOvaLaiukKweE7fwkZHwn0BAM99gprXqL34GkqGWpzscvFsSOCxbZrnAYfWeyqjir4sbtEyypwAAFb81UUS2Jij+ZocJktP7UyaKiZ/eOn4MVSQDXo5huwM58vTntbms8jj30rDHn+lm7oPU/GxE805NXOiqlVoCw74qFTyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from CH2PR10MB4344.namprd10.prod.outlook.com (2603:10b6:610:af::19) by CH0PR10MB4826.namprd10.prod.outlook.com (2603:10b6:610:c4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Tue, 28 Sep 2021 20:31:13 +0000 Received: from CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::25f8:eaf:a3b9:fe86]) by CH2PR10MB4344.namprd10.prod.outlook.com ([fe80::25f8:eaf:a3b9:fe86%3]) with mapi id 15.20.4544.022; Tue, 28 Sep 2021 20:31:13 +0000 To: richard Biener <rguenther@suse.de> Subject: [patch][gcc12-changes] Add a new item about the support for automatic static variable initialization Thread-Topic: [patch][gcc12-changes] Add a new item about the support for automatic static variable initialization Thread-Index: AQHXtKfH5t6XkXoR4UyxxdgZ+1/rUw== Date: Tue, 28 Sep 2021 20:31:13 +0000 Message-ID: <BFF3F4BB-1FAB-4FDD-B160-380044158175@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3608.120.23.2.7) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 269e9363-dda2-4d1f-e94e-08d982beea2c x-ms-traffictypediagnostic: CH0PR10MB4826: x-microsoft-antispam-prvs: <CH0PR10MB4826EEB1FB65CC7D00CBD4D880A89@CH0PR10MB4826.namprd10.prod.outlook.com> x-ms-oob-tlc-oobclassifiers: OLM:669; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rXQkfuj0sx/g5HdPxlphAV4zvga9M7khuwbxrjYLLvdvc6sVt3mzM5RNQtUSJV8ws4fKKd/N2e+k2gwVw6Ztpl5CaOrm53g5BR+SnpPijAiMGYb6F1VCAdkDDGvktKAd1/Jy5VNjcgKEQChP7rVVF30Y09JQyk2uZRjgOp7A6qDpJ3EV+HorahDhrYF9a4eVuXlrfSS3pAGyooIESpVF4ZGtXxfpxfLmYz4+JjvFycti0nMz2eAXozJYel50HukwJUD0UufV33RLjSqNNp2hSTlEj5mBlpwcZ6yoioaMfUKvgmYMHhE9RoRJgDlTQRce8gSPBY5B66FJ/YcQZrSQe9lAzv9SNCJcwfwwGcMzs8gpH20IJVsTb2aybKhAX9EfOaWTJr25boYeR7UqJ8+0xdDt2sJ/qzlQSlBW3mxXz4cK24tUxCv2I6NkIdMr/Ehp5bwJ3Vz1cYZTwON2TFnSK/FJQG4bp+ydNz0AF8CNp1OaVhNp7R/L49fkvSVNvE6UjcKrXxVgYApU4pgTJGYZnu2UBJ5ZQ5vicc3V41EmobyaDOCOsAzF7UL/7VEmi7SjWHcw4b+2tWsuhEKKhday1tZOdP2bC9vDZRegtNFAm/E03S779yroDVrIQZdu7LZBu8/cK6YGu7WZTpct0SEcLSn9koIsc3Xu5gYP7KJa3O+chgSDkr18qgRGCGIhxrePrCiZvfkp8HbdOf+wdzF+d8IHbWH9FMyvq/Uk8ugGiCw= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR10MB4344.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(5660300002)(38100700002)(122000001)(2616005)(2906002)(6506007)(316002)(6916009)(38070700005)(71200400001)(44832011)(54906003)(36756003)(53546011)(8936002)(83380400001)(66946007)(66476007)(86362001)(508600001)(8676002)(66446008)(76116006)(91956017)(64756008)(66556008)(4326008)(6512007)(33656002)(186003)(6486002)(45980500001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?jdgAy9ttquvG03jrtkpov8/Xo1WM?= =?utf-8?q?cEOfy+Q4w6g633rYfxEBnVt2S1qwOO+aLnaqX2/AStMud0fjYukVZ9BU9KqgeM9HE?= =?utf-8?q?tAtxSEyhopL2qPZayWE7U5fuKMs5POOf07nUa1BDLb1oQSvR/Pg334Tk8SZWbjurd?= =?utf-8?q?sQBKg6ZoTCUhZiiwS+J+MnaTw3xqLkW+tTDytKKjYb5PhHqgVvBNltf35/7wgCfyd?= =?utf-8?q?8y6LcQhHV6xbtwaxbt8/p9rQXKiBfg51BvIF1yHEIQmA7DuRHo06hmAnQGatUEB/P?= =?utf-8?q?V3SbWRTie8E4ZQQBAD2U94zqr46gBcadPvm6PYtBXKb8mhnJFTibXljnUZi+xLWcg?= =?utf-8?q?kjl/8GkqAD2AIGZoLPSRL7culGKMUpkw3ynG+4oPP/DwnV/o2cEJGyHvXT+3ESDVB?= =?utf-8?q?EP4q5Itd2vFVzW3fgktgZzpaflK8eutb6dGpPdKuyax4IGjJGZ+uFD7IjaLry1RuM?= =?utf-8?q?Q0LJO2Ek2UVeAtEpq/qGcGSPa9L5g4Ni332gTVz+CaQT/y0QP+cLZ2YL8w4cSAyEK?= =?utf-8?q?+7tvpfv37gww8EsaOLdiUxpi20OFpKrsYMJzAD/2DLR1fxZHMMrIc2H9ZsN9rC4UG?= =?utf-8?q?+9TUjz643vHIsT/lBq6E7qI15DX06JyF7zfI0faXNyZtXr6hy/B3zcMgFIOG7fYPq?= =?utf-8?q?Spc/Ka0LAYdECLXlPbAZ9LN6FzHcxYXZe5GJtGp0jUbTI4OFShVTCJ7+1zEpPGcyF?= =?utf-8?q?dPTnhiz4LGg6VWnLcCE6RlQoyOfog47Qv+OXtTCvWQlcJo+s+rjoNQfcuMCKjyfj3?= =?utf-8?q?3Wflw4vUWkBee+3nCSYJwKya+mkSs/zStRglNjRmMLKbXvnW7IiNjMkzcVyEjTHvE?= =?utf-8?q?prUdHIUj59sifAy9aVeCr0PtDW1NCvNKN6OZiswEptC7ylkX/8Y96Y7OTCamjh8Ia?= =?utf-8?q?NB9EyI1zOmGGMlRAv9GbaBwr/q1buNjdEjmNqEgI4cWSUsH+j5UElTfxCH9cY1EL7?= =?utf-8?q?TmwMBn07Bslnw8GRvR5yznJm5nPhYKenFzB02Eks9W2Kf3IrXzrOwOmLZ2xdTe/7j?= =?utf-8?q?TS3AE61H9W7Q2STQ6jjQA5Gtxn5sMXzAokLU2otyqQyN/g/Gjdd9GXroSys0Pw/q0?= =?utf-8?q?wQTGX/tWWIKXmasrK1XeqSIkW2ofzVh2AYpOFgPgFIy6NakoHgAejsEmuGmwjLXld?= =?utf-8?q?raw5h2ZRNcxdHn3VzA8GxrpNOHtBwTZkhPXSbP6KYBC5eCkrunq3SgzpFGHLUIY4A?= =?utf-8?q?HLN2NlLrOPsb5AEmjGQmIGihUO8sUTVTgN2QXmcQVGfL7+61h4+ZZyK8gj4Axq+QD?= =?utf-8?q?PB5do2fNi201wmts6CEsz1pJzy0Q5UlwiNvzinTc20kFRXsn2R+paFgPr1E=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="utf-8" Content-ID: <8C2C12D7FC9C2940AD4300072B4DC868@namprd10.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4344.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 269e9363-dda2-4d1f-e94e-08d982beea2c X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2021 20:31:13.3396 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 1DXCQDknhdgY+N+grTih8lbV1shkF9T3VE+JcCoL839Twpebpc5I0t6Bex25i4Wvry+J0sM0ahehtp5htzdAyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4826 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10121 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2109280120 X-Proofpoint-ORIG-GUID: kibvMLeAbotPLgAFpyFN3sHfp_dsFJY- X-Proofpoint-GUID: kibvMLeAbotPLgAFpyFN3sHfp_dsFJY- X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Qing Zhao <qing.zhao@oracle.com> Cc: gcc-patches Nick Alcock via <gcc-patches@gcc.gnu.org>, kees Cook <keescook@chromium.org> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
[gcc12-changes] Add a new item about the support for automatic static variable initialization
|
|
Commit Message
Qing Zhao
Sept. 28, 2021, 8:31 p.m. UTC
Hi,
This is the patch for the gcc12 changes per your request.
Kees provided most of the wording.
Please take a look and let’s know whether it’s good for commit?
thanks.
Qing
================================================
From: qing zhao <qing.zhao@oracle.com>
Date: Tue, 28 Sep 2021 12:01:42 -0700
Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables
initialization update
* htdocs/gcc-12/changes.html (Eliminating uninitialized variables):
Item about the support for automatic static variable initialization.
---
htdocs/gcc-12/changes.html | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
Comments
On Tue, Sep 28, 2021 at 08:31:13PM +0000, Qing Zhao wrote: > Hi, > > This is the patch for the gcc12 changes per your request. > > Kees provided most of the wording. > > Please take a look and let’s know whether it’s good for commit? > > thanks. > > Qing > > ================================================ > > > From: qing zhao <qing.zhao@oracle.com> > Date: Tue, 28 Sep 2021 12:01:42 -0700 > Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables > initialization update > > * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): > Item about the support for automatic static variable initialization. > --- > htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html > index 1f156a9..8e2979c 100644 > --- a/htdocs/gcc-12/changes.html > +++ b/htdocs/gcc-12/changes.html > @@ -245,6 +245,25 @@ a work-in-progress.</p> > <!-- .................................................................. --> > <h2>Other significant improvements</h2> > > +<h3 id="uninitialized">Eliminating uninitialized variables</h3> > + > +<ul> > + <li>GCC can now initialize all stack variables implicitly, including > + padding. This is intended to eliminate all classes of uninitialized > + stack variable flaws. Lack of explicit initialization will still > + warn when <code>-Wuninitialized</code> is active. For best > + debugging, use of the new command-line option > + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill > + variables with a repeated 0xFE pattern, which tends to illuminate > + many bugs (e.g. pointers receive invalid addresses, sizes and indices > + are very large). For best production results, the new command-line > + option <code>-ftrivial-auto-var-init=zero</code> can be used to > + fill variables with 0x00, which tends to provide a safer state for > + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes Minor nit: I've always been corrected that "NULL" refers to a pointer, and "NUL" refers to the "null character", so the latter use of NULL should be "NUL": ... pointers are NULL, strings are NUL filled, and size ... I mix this up all the time, so apologies if that got introduced by me! :) -Kees > + and indices are 0). > + </li> > +</ul> > + > <h3 id="debug">Debugging formats</h3> > > <ul> > -- > 1.9.1 > >
On Tue, 28 Sep 2021, Kees Cook wrote: > On Tue, Sep 28, 2021 at 08:31:13PM +0000, Qing Zhao wrote: > > Hi, > > > > This is the patch for the gcc12 changes per your request. > > > > Kees provided most of the wording. > > > > Please take a look and let’s know whether it’s good for commit? > > > > thanks. > > > > Qing > > > > ================================================ > > > > > > From: qing zhao <qing.zhao@oracle.com> > > Date: Tue, 28 Sep 2021 12:01:42 -0700 > > Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables > > initialization update > > > > * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): > > Item about the support for automatic static variable initialization. > > --- > > htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html > > index 1f156a9..8e2979c 100644 > > --- a/htdocs/gcc-12/changes.html > > +++ b/htdocs/gcc-12/changes.html > > @@ -245,6 +245,25 @@ a work-in-progress.</p> > > <!-- .................................................................. --> > > <h2>Other significant improvements</h2> > > > > +<h3 id="uninitialized">Eliminating uninitialized variables</h3> > > + > > +<ul> > > + <li>GCC can now initialize all stack variables implicitly, including > > + padding. This is intended to eliminate all classes of uninitialized > > + stack variable flaws. Lack of explicit initialization will still > > + warn when <code>-Wuninitialized</code> is active. For best > > + debugging, use of the new command-line option > > + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill > > + variables with a repeated 0xFE pattern, which tends to illuminate > > + many bugs (e.g. pointers receive invalid addresses, sizes and indices > > + are very large). For best production results, the new command-line > > + option <code>-ftrivial-auto-var-init=zero</code> can be used to > > + fill variables with 0x00, which tends to provide a safer state for > > + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes > > Minor nit: I've always been corrected that "NULL" refers to a pointer, and > "NUL" refers to the "null character", so the latter use of NULL should be > "NUL": ... pointers are NULL, strings are NUL filled, and size ... > > I mix this up all the time, so apologies if that got introduced by me! > :) Also things like 0xFE and NULL should be wrapped in <code></code>, otherwise it looks good to me. Thanks, Richard. > -Kees > > > + and indices are 0). > > + </li> > > +</ul> > > + > > <h3 id="debug">Debugging formats</h3> > > > > <ul> > > -- > > 1.9.1 > > > > > >
> On Sep 28, 2021, at 3:39 PM, Kees Cook <keescook@chromium.org> wrote: > > On Tue, Sep 28, 2021 at 08:31:13PM +0000, Qing Zhao wrote: >> Hi, >> >> This is the patch for the gcc12 changes per your request. >> >> Kees provided most of the wording. >> >> Please take a look and let’s know whether it’s good for commit? >> >> thanks. >> >> Qing >> >> ================================================ >> >> >> From: qing zhao <qing.zhao@oracle.com> >> Date: Tue, 28 Sep 2021 12:01:42 -0700 >> Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables >> initialization update >> >> * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): >> Item about the support for automatic static variable initialization. >> --- >> htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html >> index 1f156a9..8e2979c 100644 >> --- a/htdocs/gcc-12/changes.html >> +++ b/htdocs/gcc-12/changes.html >> @@ -245,6 +245,25 @@ a work-in-progress.</p> >> <!-- .................................................................. --> >> <h2>Other significant improvements</h2> >> >> +<h3 id="uninitialized">Eliminating uninitialized variables</h3> >> + >> +<ul> >> + <li>GCC can now initialize all stack variables implicitly, including >> + padding. This is intended to eliminate all classes of uninitialized >> + stack variable flaws. Lack of explicit initialization will still >> + warn when <code>-Wuninitialized</code> is active. For best >> + debugging, use of the new command-line option >> + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill >> + variables with a repeated 0xFE pattern, which tends to illuminate >> + many bugs (e.g. pointers receive invalid addresses, sizes and indices >> + are very large). For best production results, the new command-line >> + option <code>-ftrivial-auto-var-init=zero</code> can be used to >> + fill variables with 0x00, which tends to provide a safer state for >> + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes > > Minor nit: I've always been corrected that "NULL" refers to a pointer, and > "NUL" refers to the "null character", so the latter use of NULL should be > "NUL": ... pointers are NULL, strings are NUL filled, and size ... > > I mix this up all the time, so apologies if that got introduced by me! > :) I thought that was a typo -:) Will change it back. Qing > > -Kees > >> + and indices are 0). >> + </li> >> +</ul> >> + >> <h3 id="debug">Debugging formats</h3> >> >> <ul> >> -- >> 1.9.1 >> >> > > -- > Kees Cook
> On Sep 29, 2021, at 5:39 AM, Richard Biener <rguenther@suse.de> wrote: > > On Tue, 28 Sep 2021, Kees Cook wrote: > >> On Tue, Sep 28, 2021 at 08:31:13PM +0000, Qing Zhao wrote: >>> Hi, >>> >>> This is the patch for the gcc12 changes per your request. >>> >>> Kees provided most of the wording. >>> >>> Please take a look and let’s know whether it’s good for commit? >>> >>> thanks. >>> >>> Qing >>> >>> ================================================ >>> >>> >>> From: qing zhao <qing.zhao@oracle.com> >>> Date: Tue, 28 Sep 2021 12:01:42 -0700 >>> Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables >>> initialization update >>> >>> * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): >>> Item about the support for automatic static variable initialization. >>> --- >>> htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ >>> 1 file changed, 19 insertions(+) >>> >>> diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html >>> index 1f156a9..8e2979c 100644 >>> --- a/htdocs/gcc-12/changes.html >>> +++ b/htdocs/gcc-12/changes.html >>> @@ -245,6 +245,25 @@ a work-in-progress.</p> >>> <!-- .................................................................. --> >>> <h2>Other significant improvements</h2> >>> >>> +<h3 id="uninitialized">Eliminating uninitialized variables</h3> >>> + >>> +<ul> >>> + <li>GCC can now initialize all stack variables implicitly, including >>> + padding. This is intended to eliminate all classes of uninitialized >>> + stack variable flaws. Lack of explicit initialization will still >>> + warn when <code>-Wuninitialized</code> is active. For best >>> + debugging, use of the new command-line option >>> + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill >>> + variables with a repeated 0xFE pattern, which tends to illuminate >>> + many bugs (e.g. pointers receive invalid addresses, sizes and indices >>> + are very large). For best production results, the new command-line >>> + option <code>-ftrivial-auto-var-init=zero</code> can be used to >>> + fill variables with 0x00, which tends to provide a safer state for >>> + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes >> >> Minor nit: I've always been corrected that "NULL" refers to a pointer, and >> "NUL" refers to the "null character", so the latter use of NULL should be >> "NUL": ... pointers are NULL, strings are NUL filled, and size ... >> >> I mix this up all the time, so apologies if that got introduced by me! >> :) > > Also things like 0xFE and NULL should be wrapped in <code></code>, > otherwise it looks good to me. Okay, will update them before committing. Thanks. Qing > > Thanks, > Richard. > >> -Kees >> >>> + and indices are 0). >>> + </li> >>> +</ul> >>> + >>> <h3 id="debug">Debugging formats</h3> >>> >>> <ul> >>> -- >>> 1.9.1 >>> >>> >> >> > > -- > Richard Biener <rguenther@suse.de> > SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, > Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)
On 9/28/21 2:31 PM, Qing Zhao via Gcc-patches wrote: > Hi, > > This is the patch for the gcc12 changes per your request. > > Kees provided most of the wording. > > Please take a look and let’s know whether it’s good for commit? > > thanks. > > Qing > > ================================================ > > > From: qing zhao <qing.zhao@oracle.com> > Date: Tue, 28 Sep 2021 12:01:42 -0700 > Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables > initialization update > > * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): > Item about the support for automatic static variable initialization. > --- > htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html > index 1f156a9..8e2979c 100644 > --- a/htdocs/gcc-12/changes.html > +++ b/htdocs/gcc-12/changes.html > @@ -245,6 +245,25 @@ a work-in-progress.</p> > <!-- .................................................................. --> > <h2>Other significant improvements</h2> > > +<h3 id="uninitialized">Eliminating uninitialized variables</h3> > + > +<ul> > + <li>GCC can now initialize all stack variables implicitly, including > + padding. This is intended to eliminate all classes of uninitialized > + stack variable flaws. Lack of explicit initialization will still > + warn when <code>-Wuninitialized</code> is active. For best > + debugging, use of the new command-line option > + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill > + variables with a repeated 0xFE pattern, which tends to illuminate > + many bugs (e.g. pointers receive invalid addresses, sizes and indices > + are very large). For best production results, the new command-line > + option <code>-ftrivial-auto-var-init=zero</code> can be used to > + fill variables with 0x00, which tends to provide a safer state for > + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes > + and indices are 0). The "use ... can be used" in the sentence For best debugging, use of the new command-line option -ftrivial-auto-var-init=pattern can be used... reads a bit awkward. Following the phrasing of the second such sentence would look better: To aid in debugging, the new command-line option -ftrivial-auto-var-init=pattern can be used... Martin > + </li> > +</ul> > + > <h3 id="debug">Debugging formats</h3> > > <ul> >
FYI, just committed the change: https://gcc.gnu.org/gcc-12/changes.html Qing > On Sep 29, 2021, at 9:18 AM, Qing Zhao via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > > >> On Sep 29, 2021, at 5:39 AM, Richard Biener <rguenther@suse.de> wrote: >> >> On Tue, 28 Sep 2021, Kees Cook wrote: >> >>> On Tue, Sep 28, 2021 at 08:31:13PM +0000, Qing Zhao wrote: >>>> Hi, >>>> >>>> This is the patch for the gcc12 changes per your request. >>>> >>>> Kees provided most of the wording. >>>> >>>> Please take a look and let’s know whether it’s good for commit? >>>> >>>> thanks. >>>> >>>> Qing >>>> >>>> ================================================ >>>> >>>> >>>> From: qing zhao <qing.zhao@oracle.com> >>>> Date: Tue, 28 Sep 2021 12:01:42 -0700 >>>> Subject: [PATCH] gcc-12/changes.html: Uninitialized stack variables >>>> initialization update >>>> >>>> * htdocs/gcc-12/changes.html (Eliminating uninitialized variables): >>>> Item about the support for automatic static variable initialization. >>>> --- >>>> htdocs/gcc-12/changes.html | 19 +++++++++++++++++++ >>>> 1 file changed, 19 insertions(+) >>>> >>>> diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html >>>> index 1f156a9..8e2979c 100644 >>>> --- a/htdocs/gcc-12/changes.html >>>> +++ b/htdocs/gcc-12/changes.html >>>> @@ -245,6 +245,25 @@ a work-in-progress.</p> >>>> <!-- .................................................................. --> >>>> <h2>Other significant improvements</h2> >>>> >>>> +<h3 id="uninitialized">Eliminating uninitialized variables</h3> >>>> + >>>> +<ul> >>>> + <li>GCC can now initialize all stack variables implicitly, including >>>> + padding. This is intended to eliminate all classes of uninitialized >>>> + stack variable flaws. Lack of explicit initialization will still >>>> + warn when <code>-Wuninitialized</code> is active. For best >>>> + debugging, use of the new command-line option >>>> + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill >>>> + variables with a repeated 0xFE pattern, which tends to illuminate >>>> + many bugs (e.g. pointers receive invalid addresses, sizes and indices >>>> + are very large). For best production results, the new command-line >>>> + option <code>-ftrivial-auto-var-init=zero</code> can be used to >>>> + fill variables with 0x00, which tends to provide a safer state for >>>> + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes >>> >>> Minor nit: I've always been corrected that "NULL" refers to a pointer, and >>> "NUL" refers to the "null character", so the latter use of NULL should be >>> "NUL": ... pointers are NULL, strings are NUL filled, and size ... >>> >>> I mix this up all the time, so apologies if that got introduced by me! >>> :) >> >> Also things like 0xFE and NULL should be wrapped in <code></code>, >> otherwise it looks good to me. > > Okay, will update them before committing. > > Thanks. > > Qing >> >> Thanks, >> Richard. >> >>> -Kees >>> >>>> + and indices are 0). >>>> + </li> >>>> +</ul> >>>> + >>>> <h3 id="debug">Debugging formats</h3> >>>> >>>> <ul> >>>> -- >>>> 1.9.1 >>>> >>>> >>> >>> >> >> -- >> Richard Biener <rguenther@suse.de> >> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, >> Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg) >
On Wed, Sep 29, 2021 at 02:43:35PM +0000, Qing Zhao wrote: > FYI, just committed the change: > > https://gcc.gnu.org/gcc-12/changes.html Looks great to me; thanks! :) -Kees
diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html index 1f156a9..8e2979c 100644 --- a/htdocs/gcc-12/changes.html +++ b/htdocs/gcc-12/changes.html @@ -245,6 +245,25 @@ a work-in-progress.</p> <!-- .................................................................. --> <h2>Other significant improvements</h2> +<h3 id="uninitialized">Eliminating uninitialized variables</h3> + +<ul> + <li>GCC can now initialize all stack variables implicitly, including + padding. This is intended to eliminate all classes of uninitialized + stack variable flaws. Lack of explicit initialization will still + warn when <code>-Wuninitialized</code> is active. For best + debugging, use of the new command-line option + <code>-ftrivial-auto-var-init=pattern</code> can be used to fill + variables with a repeated 0xFE pattern, which tends to illuminate + many bugs (e.g. pointers receive invalid addresses, sizes and indices + are very large). For best production results, the new command-line + option <code>-ftrivial-auto-var-init=zero</code> can be used to + fill variables with 0x00, which tends to provide a safer state for + bugs (e.g. pointers are NULL, strings are NULL filled, and sizes + and indices are 0). + </li> +</ul> + <h3 id="debug">Debugging formats</h3> <ul>