From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id 01F31385800E for ; Fri, 6 May 2022 16:08:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 01F31385800E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 850B47F098; Fri, 6 May 2022 16:08:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KvwVG35CGz3r4W; Fri, 6 May 2022 16:08:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651853334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gITsEFKapn6qg1Fge8grDZHPo2AU4ZhYAoWsZqK0AQ=; b=t75/aqd/rRWtyy4oAKHwWhN9luC0WoR/WcauH7zitHPnYSpUf9zytC2Z/cY4txcHgjfsVL CBb2k89wC+pPYPOJVuolX7xvonBAFfL2BUiB+DtXVfIed58hQO84B0nGj+CRVfvwH04neU t5hXHsbmByrNFjnd+O6Mi431FQFGzCuCYmHTxZEULfKyKmR08VTTkIkZPsmN6Rx8k5XJ+C aMIA704SBF/3orJ8+P5uJuegfMyHbHHI6AVoqyERHwi0H5p+4jvuKJtWt0R5G0Nu5W/G5e tbrEwDIpi6Ve6ZcajxzUtjnv+DrgdY2IRaukLXwlJNmitoVtE5+rgTmaBSX2qA== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 020A32F50F; Fri, 6 May 2022 16:08:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Fri, 6 May 2022 09:08:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 3/4] gdb, gdbserver: Allocate only a sane amount of buffer when fetching registers. Content-Language: en-US To: Felix Willgerodt , gdb-patches@sourceware.org References: <20220506121226.137608-1-felix.willgerodt@intel.com> <20220506121226.137608-4-felix.willgerodt@intel.com> From: John Baldwin In-Reply-To: <20220506121226.137608-4-felix.willgerodt@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651853334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5gITsEFKapn6qg1Fge8grDZHPo2AU4ZhYAoWsZqK0AQ=; b=oPaNrFleDIpxM9tufjoE5Phz60cknstPr9ZlxvkwEWOM3wQaKlSQSJPQOv4g2F6yM0h/T8 3ZTHFOyPXxjrI075PKkJkAIU6cPEkwSz13DicOEVFtcg4GcSox4DIh/FQ0QCCBIrnFwSlM RIqA6dq2QmRwbRS1+E7ekvLXp//q1f2BZZsjv6Uxe28e9Wa8cldQwu+9WDTmbxSa74I3lF sBealdqL+rp5XKEJLx3VIEq1tXMMNMMENrhYD73hkjSnhnPc6U3+YHiyGVxXhohodbISuG bMIPhI+O8mkTXzAPn75wbWmnWUqJSNg2guXvlt6PB3IP3+PpiaU2eljWbXaAYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651853334; a=rsa-sha256; cv=none; b=eRMWr/23lHfGbJm3BtVVk9/QhjZZeROE/04wEhWF7PkL4SHgvgiF2gIoYBqvjFP91MvZF0 gOXInxLIomR55cHuDPyGcOLcXf/PQhaajIFOyLSEOUgGMXqNYEvIyBArlUkun7kSdEjdkI /nV7JPdE4tK4CRXPgQt/PRd8BMM7ZWrCc1DmZKWxqpQKA0CzoMtngTtm6YJBfHLYgX/kjH 80EIhIbWWMJm5o74w87uB84EgPGTMpqlePaEf9YK5lkD1BLnHkPD30Qi+Q0VPMzAYGGaKF Zh0jUBvN+BYxUvr6dFNn4EltFOxsOQTDa96PM6p7+WplalZegthjiOPzAy4J3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 16:08:56 -0000 On 5/6/22 5:12 AM, Felix Willgerodt via Gdb-patches wrote: > A couple of functions blindly allocate a buffer of the size of > I386_MAX_REGISTER_SIZE. With the addition of AMX, this size has increased > drastically from 64 bytes to 8192. This changes these buffer allocations > to only use the actual amount needed, similar to how it is already done in > amd64-tdep.c (amd64_pseudo_register_read_value). > > For the i387_collect_xsave and i387_cache_to_xsave functions any feedback is > welcome. I opted to take the middle ground and only distinguish > between "AMX" and "Not-AMX". That might be unnecessary optimization, > we could alternatively be okay with using an 8kB buffer unconditionally or > be okay with having many smaller buffer allocations. I think these changes make sense, but I think it might be nice to have some sort of named constant (I386_NOAMX_REGISTER_SIZE perhaps) instead of a bare 64. -- John Baldwin