Received: by 10.192.165.156 with SMTP id m28csp1524170imm; Tue, 17 Apr 2018 00:18:10 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ZkIQQNh041k5OAwx5Xe9wkC8CwLmoPzWRRJBkUK1MEC/zc7FfRAfGH0gWrEAYuSsQs6Pa X-Received: by 2002:a17:902:7d92:: with SMTP id a18-v6mr1001018plm.331.1523949490027; Tue, 17 Apr 2018 00:18:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523949489; cv=none; d=google.com; s=arc-20160816; b=yR2X36xPt0/0VMoRFZsf5FBPNITX2xknd1Sd4+i0yCkcWDHjWrpsJGc3NZ1ZViYgNj 9Q6IkBmu6zaDfJGklk+ovDr2stSxY5eES3wfceNBx2OkbjipQoDO4bl+o8/RUNx5+rKl CmTJ3L10PX9LhZP7tQ2hxSDSGyRbDy5BXfrjfFZtFpQLEqQbfx7dRQnxah+6ESjlnTMB 49vnYxNS3tcKKuIo6xN1VszFKyDMVykjs0ppLjaD96NNcZthWGytYjT4ctXYreZCr21D ihx85l3OFVNr3MXnNhOIfqz/RWyPlUAFYSMQqW0kUG/ISMkamtRsdtY44wA5OYAfc0IS Hz4A== 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=jVpC9ORl8ZmJD+bkKK6nZ3zFrWG3jYNw/TIHmoFkqmc=; b=AuZKKbzDPNdvneF7gxb+BZ3NyWzAoO/NTr8NPoyqZFOofdO/0+yVXHdgdYAvVQI7cJ v+/GFTBCor7bJnUlrZd1lmtVzkOwvIbXUPcPNd/SH0cf1iRVcMQO7GVRzFMrH0qBovb3 wvYWyMwcadIaWd8p87b0VfuTn3pkjlJzTAgjK1lzhqr+E3EcvvjgX9qGHoRoe+iIDGpq ZyBcYtf0SW6L0t24R70TpwFZvxh+wyK9laTnaxD7BQfnrHDSS6OEYTaRXfSyjZPduLij 1/ecSautK5yx0mGr4Oyr3IR9iov0v37q5HlHZawf4/gpjL+O1mjB80A5r70HGX51xZRj QFtg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23-v6si14558238plr.576.2018.04.17.00.17.54; Tue, 17 Apr 2018 00:18:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751270AbeDQHQp (ORCPT + 99 others); Tue, 17 Apr 2018 03:16:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:39197 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbeDQHQo (ORCPT ); Tue, 17 Apr 2018 03:16:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E7C6FAD91; Tue, 17 Apr 2018 07:16:42 +0000 (UTC) Subject: Re: [PATCH] x86/xen: Remove use of VLAs To: Boris Ostrovsky , Laura Abbott 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: Juergen Gross Message-ID: Date: Tue, 17 Apr 2018 09:16:41 +0200 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: <7cf66c00-74c2-62bb-81f5-4332313a5a6e@oracle.com> Content-Type: text/plain; charset=utf-8 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 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. Juergen