[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] xen/hypfs: check the return value of snprintf to avoid leaking stack accidently


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 4 Aug 2022 15:13:16 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E+UpX4r3vviaB3X1TVywyJQBaTutGYVM78L9WRt0UZI=; b=egK/2mQlm80JMhk21Ib9eLLbYpR2gKb7SVuyIcqLZM0TNcEPV266ekaboCnIC7OwPJNltLZVBv1Q9czYvZREK4phvpX1GSBYqubvoc3taZGmDpbJAeqJ3rIkM0+RRN3ny5K/PBh9UvF87uXCT6Us6gdTUxcfgGgZSaZeaB/GeX1p47ZO2Qhb7OyfeOUdSiF8hsuRKe8vyJYetQXJeQl+JtTgEuF7BDy4hnnZF7Khe3ZtNSlhJGe0YjDljjqcmQz/CO7X/S/bqq8WluH74kYqHlwPvLO3yY9tNhdeIUQAjKdBWCLOXmpZSYsOW7OdT4MGl3DBMkfjMtIdRO8eOR5SUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V2Seh4k7v2Xi6T/NP1zAsUxPGTuFdvqI4Ah7GegkwEPJyewlmF5C1MqNgXOZ0vZR6xKAVX6qtCVf0EwKheTdqwcxhB5REGs1ZBUJfGP63T81VsRjJwkMD6h8Bh/Jc5YpgMqKQDnMkc8BwHberBbELME6/eMaf7Bu48TZGvAD7olkfSXCTa9cW1gUqznsHVkFFZn/qnnl/iNWsjMG7DgiOf1z8t5t4EbPghbk1mf2/tiqWP1s7BxZzMkubnB3wBp8HGQO9CktDhPRR4rJhOqvO5X4I/EA6u/2pmXy19xBIeQC2jCrkCWk66tHk0NXH2CLmRxI3SAH414xZkpd9J9DHQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 04 Aug 2022 13:13:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.08.2022 15:10, Xenia Ragiadakou wrote:
> On 8/4/22 16:01, Jan Beulich wrote:
>> On 04.08.2022 14:47, Xenia Ragiadakou wrote:
>>> Changes in v2:
>>> - add ASSERT_UNREACHABLE()
>>
>> Hmm, this ...
>>
>>> --- a/xen/common/hypfs.c
>>> +++ b/xen/common/hypfs.c
>>> @@ -377,8 +377,10 @@ int hypfs_read_dyndir_id_entry(const struct 
>>> hypfs_entry_dir *template,
>>>       unsigned int e_namelen, e_len;
>>>   
>>>       e_namelen = snprintf(name, sizeof(name), template->e.name, id);
>>> -    if ( e_namelen >= sizeof(name) )
>>> +    if ( e_namelen >= sizeof(name) ) {
>>> +        ASSERT_UNREACHABLE();
>>>           return -ENOBUFS;
>>> +    }
>>
>> ... looks to be an incremental patch on top of v1, not v2 of that
>> patch?
> 
> So, here, IIUC, I have to create a patch series and add the assert in 
> the second (2/2) patch? What should be the version number of the series?

No, why? Simply fold this change into the earlier one, and call the
result v3.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.