Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752877AbdLDRGg (ORCPT ); Mon, 4 Dec 2017 12:06:36 -0500 Received: from mail-eopbgr20110.outbound.protection.outlook.com ([40.107.2.110]:54284 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753144AbdLDRF6 (ORCPT ); Mon, 4 Dec 2017 12:05:58 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Subject: Re: [PATCH v3 3/5] kasan: support alloca() poisoning From: Andrey Ryabinin To: Christoph Hellwig , Paul Lawrence Cc: Alexander Potapenko , Dmitry Vyukov , Masahiro Yamada , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kbuild@vger.kernel.org, Matthias Kaehlcke , Michael Davidson , Greg Hackmann References: <20171201213643.2506-1-paullawrence@google.com> <20171201213643.2506-4-paullawrence@google.com> <20171204164240.GA24425@infradead.org> Message-ID: Date: Mon, 4 Dec 2017 20:09:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0266.eurprd05.prod.outlook.com (2603:10a6:3:fc::18) To DB6PR08MB2823.eurprd08.prod.outlook.com (2603:10a6:6:1d::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 510175fd-9053-4d8e-635b-08d53b3948d9 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603286);SRVR:DB6PR08MB2823; X-Microsoft-Exchange-Diagnostics: 1;DB6PR08MB2823;3:uT21tzCEO+UdDD7ryw1cpm9T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RtZQr75GBT4TmUaNNuY3zqsyZNnoWGbxKAsLCbR73Jv4Se9hZnTikZPdMgGQGAX/lqFmIJoTl0KYSiLxr6fduldnyA7wlOlaqopOwr+cpJg+zlg4M7xSJFH7nYIWDQX3czyDq1fEuTG72rfZiJ7HhiNaexVkzRsaqW6SKRmrTCvb47+qNPGkYNRyeG4UqbHmki8srtm+CUBN3SXtetUtay23wFSbMfmc1lfg=;4:x0ytiW6NQSAshJuvxxou+qx32IY7x2hiCoYxie7bxn+E190jw5eWyioC2N4hudK026zvdfYjO18EQmueYOSovKZgCdsUy41AtrOw24BsCvZsX26FgJkESwkGRtubWesPzNr97ywLsu/EKMuqPlROE+Ei84i8A1wP9Ey7phl7HhMJLISCySghOVaY4z0etPWE5Z3kXXxOJOCrvXGlA1I65Px8TsWzKlEdYLdll5XE/kfPOy+cV7nPLZVkxbLMKe/Qrnf8J8u6haCGhAsETyrO/w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(3231022)(10201501046)(93006095)(93001095)(3002001)(6041248)(20161123564025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(201708071742011);SRVR:DB6PR08MB2823;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR08MB2823; X-Forefront-PRVS: 051158ECBB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6049001)(376002)(366004)(346002)(189002)(199003)(24454002)(65826007)(68736007)(33646002)(6666003)(53546010)(93886005)(5660300001)(16526018)(31686004)(101416001)(25786009)(6486002)(77096006)(83506002)(106356001)(64126003)(229853002)(2906002)(105586002)(478600001)(2950100002)(55236003)(8936002)(31696002)(50466002)(86362001)(7736002)(305945005)(97736004)(6116002)(16576012)(65956001)(3846002)(316002)(65806001)(7416002)(110136005)(2870700001)(54906003)(47776003)(8676002)(58126008)(66066001)(36756003)(81156014)(189998001)(23676004)(6246003)(76176011)(54356011)(52146003)(52116002)(4326008)(2486003)(53936002)(81166006);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR08MB2823;H:[172.16.25.12];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtEQjZQUjA4TUIyODIzOzIzOlE3SG9DMW1aT1c1ZkRaVVhMS2VsSEFiT0gy?= =?utf-8?B?YVpRaFViUU4yVU5SV2RRYjA0ZFZxcEl5c0FPUHJmMTRWN3h6STJFbXJkKzVy?= =?utf-8?B?TUYycUd5R0xBWFJhZFpQTis5MTJyNy9IeDl6cjRZQy91YmF1aTNYUXVLajRw?= =?utf-8?B?STQ2ektGUmRqTUpKTXQrS0RVZFhhRUxMY1NGUmZKZnZSMmV0b3B3UEVlUHRX?= =?utf-8?B?Tnp0cGczRE9VNkp1N3d1WktsZ1FVR0crcEJQUGdCUkdOY2Z5L3lRUGZaS3VV?= =?utf-8?B?T3NTMnlaVEpvYXFaZCt6NVJabzJQbUVUYm5OajYrQ0dsQkgzN0t2NkJKaHJD?= =?utf-8?B?Wk9wZDBCcTdEQ1lwb3d6dU1jeGlxejllMWZVRHNENHBPRzRHak5RbGhnSFlz?= =?utf-8?B?MEVvOFZGVzJWVy9WcmlpdFYwNmEzUzY0OGJUOEYrSDAxN3ptTEV4a21PSG5a?= =?utf-8?B?bUhNMENQaW1XMC9Qa3VDTHowa1ZKOVorTG5oV3JxZVFicUhldEhzTU53Tmoy?= =?utf-8?B?NTE0QTZkaEk1L0NLZGhGSmZKU0VaSGVBMk5lWVJXRnRlZzVGUWluT1pISURN?= =?utf-8?B?Zy9aQnZna05zWWhaNWtDa3d2WlRvUTJHR0haR1dQUk1FTXExQUJsN0NWdmZJ?= =?utf-8?B?Nk1NTkxlelo5SkxWZms0eUpzb0hPbmFIZDhGMGR4QnlJYlE1cTBiMitOMUtX?=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NSqw4jPG0P+yb6u8gKO5qaJN8z72+vnWRPUo4ADnLQpdYTj4eHx2spFmaioupRgk6bRxl/8Y5kFk=;7:ZhZUWXr5A8VjEC2SPB9cUsSizr1BiRRM6JO81RJZKhy3Kjrbgq+ZJOWo11jHRM0xgslg1vvFbYeLC1yLRhbsLzJaJKscxa7wcX/vpDgXs4w2I1rG7ZwfDU8E4HysY1mQnqwFYRSgsQwT01Ss0Q5buGtWq7oNSLhdDVvQ9m19kjRbu4LHGJesXES+9mHlfg0MPYiLdJQM5a5c2Ory0aR30E7sQp5J/PGM3HiDyhgslDDDEAA099f9iOJGlloCICAM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR08MB2823;20:gteXAENWVVeAjgtr84/ZE/Z0LxlQwUm+C0qzX8npsvpxx8YZje3dMMBCfr4v0f982XLpGZ8tiFP1+6JC2+i1zgJy3uBX9S67I+Bpy2QJfqXFJ2iUBnM0HE3FZY8Ow2VLD813yOl30CRruwvGh8GzEu+GTPcVX7mOEt3JKh+sPlc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 17:05:55.3236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 510175fd-9053-4d8e-635b-08d53b3948d9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2823 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2273 Lines: 49 On 12/04/2017 07:55 PM, Andrey Ryabinin wrote: > > > On 12/04/2017 07:42 PM, Christoph Hellwig wrote: >> I don't think we are using alloca in kernel mode code, and we shouldn't. >> What do I miss? Is this hidden support for on-stack VLAs? I thought >> we'd get rid of them as well. >> > > Yes, this is for on-stack VLA. Last time I checked, we still had a few. > E.g. building with -Wvla: /home/andrew/linux/sound/core/pcm_native.c: In function ‘constrain_params_by_rules’: /home/andrew/linux/sound/core/pcm_native.c:326:2: warning: ISO C90 forbids variable length array ‘rstamps’ [-Wvla] unsigned int rstamps[constrs->rules_num]; ^~~~~~~~ In file included from /home/andrew/linux/crypto/cbc.c:14:0: /home/andrew/linux/include/crypto/cbc.h: In function ‘crypto_cbc_decrypt_inplace’: /home/andrew/linux/include/crypto/cbc.h:116:2: warning: ISO C90 forbids variable length array ‘last_iv’ [-Wvla] u8 last_iv[bsize]; ^~ /home/andrew/linux/crypto/pcbc.c: In function ‘crypto_pcbc_encrypt_inplace’: /home/andrew/linux/crypto/pcbc.c:75:2: warning: ISO C90 forbids variable length array ‘tmpbuf’ [-Wvla] u8 tmpbuf[bsize]; ^~ /home/andrew/linux/crypto/pcbc.c: In function ‘crypto_pcbc_decrypt_inplace’: /home/andrew/linux/crypto/pcbc.c:147:2: warning: ISO C90 forbids variable length array ‘tmpbuf’ [-Wvla] u8 tmpbuf[bsize] __aligned(__alignof__(u32)); ^~ /home/andrew/linux/crypto/cts.c: In function ‘cts_cbc_encrypt’: /home/andrew/linux/crypto/cts.c:107:2: warning: ISO C90 forbids variable length array ‘d’ [-Wvla] u8 d[bsize * 2] __aligned(__alignof__(u32)); ^~ /home/andrew/linux/crypto/cts.c: In function ‘cts_cbc_decrypt’: /home/andrew/linux/crypto/cts.c:186:2: warning: ISO C90 forbids variable length array ‘d’ [-Wvla] u8 d[bsize * 2] __aligned(__alignof__(u32)); ^~ /home/andrew/linux/crypto/ctr.c: In function ‘crypto_ctr_crypt_final’: /home/andrew/linux/crypto/ctr.c:61:2: warning: ISO C90 forbids variable length array ‘tmp’ [-Wvla] u8 tmp[bsize + alignmask]; ^~ /home/andrew/linux/crypto/ctr.c: In function ‘crypto_ctr_crypt_inplace’: /home/andrew/linux/crypto/ctr.c:109:2: warning: ISO C90 forbids variable length array ‘tmp’ [-Wvla] u8 tmp[bsize + alignmask];