Received: by 10.192.165.156 with SMTP id m28csp619194imm; Tue, 17 Apr 2018 16:36:17 -0700 (PDT) X-Google-Smtp-Source: AIpwx48wpQC0JnAaTNbKAOUcpWAA/2rW8rh4CbmZ/ZjPhiqzK68cWvBa2NlBKEVcnJLTyzjAU1Ul X-Received: by 10.99.149.87 with SMTP id t23mr1474830pgn.77.1524008177697; Tue, 17 Apr 2018 16:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524008177; cv=none; d=google.com; s=arc-20160816; b=fzwMXpnfKv3ATqzMqSbOLn/CVKz7mX/ac6E4fy3/tdTlQWMySZeb2OhbP/E6+laq02 cVWxlG0ENCqgZNRwUDQqdEo3po3YYBDcpiCa2cpk7IiIUKMzjVsS5CXsXbQhm7fNfDAD 7DMdrcqfPc2HA5KvqmEvxUjrKoLE0vPWTVKw3k4zI8WmioQtCXV/hD8aOnzwjfkkfSje Qm2RCu7lkOMQo64CnGPXzEZl6lSUk4o1jbBP3P3y5+8apKogs3+2DZrqyPrGLdfDOKNc cyv/q/ogwWNfWhbXy1uxidxTF2ztt3W9igBn5cPl+PDfhCIszgT2BxfroamXy54x0DGf zyGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=2qU/UnvG2sElhgauqaVlQO0u0Bf2BaSoFePP/V30NS8=; b=CCHCAjWMYVub3/VnTJOcy5vTrewqS3MAvFmq3f1AYvnhpnWtXwRhwqB0Xl8IpqvEkK +WBejIYRlVcDCFZMJbyQSlnUHtataKOSgHin6881FW4Y/unc/Bv3EAHuyxtBhHxZa/ld 6qjH9SVLwtJeiXRP+N8ErqNer5Oehy6W6WQUOOhihDkP8cFbkGJp5b1RSct7D/frXoJ2 +5QxEP3UaeyQXJpMH/PgmzjaecrLr3HqWb8Ga5HS11Lero3/B7XBxbk1wCTJaTXkdLOP iArqPVheLBwnCqBsmCdkoshMYCoxSvWki1ZddVV9x4abZoD2TVoKmCix7BHNCU+m/tPj 9qZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si10203956plp.532.2018.04.17.16.35.53; Tue, 17 Apr 2018 16:36:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752679AbeDQXeC (ORCPT + 99 others); Tue, 17 Apr 2018 19:34:02 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:37443 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbeDQXeA (ORCPT ); Tue, 17 Apr 2018 19:34:00 -0400 Received: by mail-ot0-f193.google.com with SMTP id y46-v6so23336528otd.4 for ; Tue, 17 Apr 2018 16:34:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2qU/UnvG2sElhgauqaVlQO0u0Bf2BaSoFePP/V30NS8=; b=BqlQh8mJ4rfoxthuARd3KJxaYHY+yQu82F6iTgWpv8BDCGamVnSWkZI1RfOyU0I0mA ZjVql9i5iR+hICpJhsXU1J9eFOURYBkaf5V33LHk8zfKj2Drt3H0/yuhQghYs5Kunr4i NMpqkyF8pbT1GjgUNALvQC4nmabigNhlKnSruy9uRkDuUQAowT0Rt2vbnVIqcSTyQB+2 YjdR+8gAu4GqpTX5XJ509LdlryOtHc38j9C95q0/Py0J5TymMDJCP09p+VuE7fGZfDBy By7oeOw08g0ROKgYUgA4WGDOw81D/S8+sEKOQK7/NGiCSp4U/s9DxcvICxBFuTEmH+eC Q2+A== X-Gm-Message-State: ALQs6tD4D2H8z8i+LbzNn/GZrz0AD/zODFvAir4gyFFPoMu5oGlTOeXo FMdSOc1b0K4dN6tHnCAbSgy0NA== X-Received: by 2002:a9d:618c:: with SMTP id g12-v6mr2451990otk.225.1524008039739; Tue, 17 Apr 2018 16:33:59 -0700 (PDT) Received: from ?IPv6:2601:602:9802:a8dc::ce63? ([2601:602:9802:a8dc::ce63]) by smtp.gmail.com with ESMTPSA id d128-v6sm9095587oia.53.2018.04.17.16.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 16:33:58 -0700 (PDT) Subject: Re: [PATCH] x86/xen: Remove use of VLAs To: Juergen Gross , Boris Ostrovsky Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com References: <20180413221146.28476-1-labbott@redhat.com> <7cf66c00-74c2-62bb-81f5-4332313a5a6e@oracle.com> From: Laura Abbott Message-ID: <9fe26cf5-01dc-1fb0-25fd-29bf8615047f@redhat.com> Date: Tue, 17 Apr 2018 16:33:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2018 12:16 AM, Juergen Gross wrote: > On 16/04/18 15:27, Boris Ostrovsky wrote: >> On 04/13/2018 06:11 PM, Laura Abbott wrote: >>> There's an ongoing effort to remove VLAs[1] from the kernel to eventually >>> turn on -Wvla. The few VLAs in use have an upper bound based on a size >>> of 64K. This doesn't produce an excessively large stack so just switch >>> the upper bound. >>> >>> [1] https://lkml.org/lkml/2018/3/7/621 >>> >>> Signed-off-by: Laura Abbott >>> --- >>> arch/x86/xen/enlighten_pv.c | 6 ++---- >>> 1 file changed, 2 insertions(+), 4 deletions(-) >>> >>> diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c >>> index c36d23aa6c35..d96a5a535cbb 100644 >>> --- a/arch/x86/xen/enlighten_pv.c >>> +++ b/arch/x86/xen/enlighten_pv.c >>> @@ -421,8 +421,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr) >>> { >>> unsigned long va = dtr->address; >>> unsigned int size = dtr->size + 1; >>> - unsigned pages = DIV_ROUND_UP(size, PAGE_SIZE); >> >> >> >> Isn't dtr->size always either GDT_SIZE or 0? > > GDT_SIZE - 1 :-) > >>> - unsigned long frames[pages]; >>> + unsigned long frames[DIV_ROUND_UP(SZ_64K, PAGE_SIZE)]; > > So we could just go with one frame and modify the BUG_ON() further below > accordingly. > Do you want to just remove the loop as well since we're never going to do more than one frame? We end up with net code deletion. Thanks, Laura > > Juergen >