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

Re: [PATCH] x86emul: rework wrapping of libc functions in test and fuzzing harnesses


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 17 Aug 2023 15:52:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=qHrQdUBPsHPZgOK51qJCO539LEVHy3zN+7cGQIeryFA=; b=jqr/kLZjhZ0pzfi9UOurxVDY9J609qSsMERoqH3xk5mbeiGK9sI+tu8AiWn9ucDDffcMIobfxUqDDVkABMFmXD/GX5ucffMZ2apAZj2WvWKbvQwfW5jCVQ577XcOQUbQ1D5ricmGUs0hYtmzis7CC4ODajl8RjpbizTicmpTYxvksx9SOn/ih9QpIbjGN+XdWR67yj+s48Z2FN0yIsMWGSRpQF2e+yknfV6DbWFCUU8Rm3PN54h/aP6ENrENXTzWkWwsbss9i/u//2s66b91EK3nfJ405mJGXNQih4i0Tp563XExjuOzOwaP3uGMRTgQfrY8+hd+vh4/VdEfZZDj8Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYPa3hMvRqEUbhAvuFnRZiERnck5M/BBlnQaLc9uvH1hueYUkdJjW0tY05OSjTLGDJYseZ4AYXX8oiYka6acNLtKj62FzL224ZMejOeZX4zqRcuZ+/4BXCugDwW+JoRvNkLntYBA4lwQc+IJVHHNgdCSUaeIpUV7VWZY0zMGRej7n4WDAFV8RuLMDVzcGoYX8yzA1Ww/PZb6fsQah+os2p9BY1C/vDAY8WMZsy2982Sqf6pc/k0rl2mDrl310CCxv8B+2KseK14qf2q0GmwpKnhIOsjDnAgaQICtDjr6cvldG6/fl0KFxcpYZWjHZfIr2WB517RT28aoghnHH5Jp/A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 17 Aug 2023 14:53:13 +0000
  • Ironport-data: A9a23:S2ACJaOemK//PvHvrR2IlsFynXyQoLVcMsEvi/4bfWQNrUok0mEPz jdODG6Ca/qLZWqhed8iaou1oU1X7cXWm95rSgto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGjxSs/vrRC9H5qyo42tI5wNmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0ulqDFwS8 vAWEwEIakq7gr7v3uK5G/Y506zPLOGzVG8ekldJ6GiDSNoDH9XESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PtxujeNpOBy+OGF3N79U9qGX8hK2G2fo XrL5T/RCRAGLt2PjzGC9xpAg8eWxHKlBt1OTeHQGvhCv3mh710/AQ8sDlaJ/6CkpVGMW91EA hlBksYphe1onKCxdfH/VRClpH+PvjYHRsFdVeY97Wml1a788wufQG8eQVZpeNEg8cM7WzEu/ luIhM/yQyxitqWPTnCQ/avSqim9URX5NkcHbC4ACAcAvd/qpdhpigqVF4k9VqmoktfyBDf8h SiQqzQzjKkSishN0Lin+VfAgHSnoZ2hohMJ2zg7l1mNtmtRDLNJraTxgbQHxZ6s9Lqkc2Q=
  • Ironport-hdrordr: A9a23:JIjjyqgJzZUXfdhvoz8QG57/h3BQXh4ji2hC6mlwRA09TyX5ra 2TdZUgpHrJYVMqMk3I9uruBEDtex3hHP1OkOss1NWZPDUO0VHARO1fBOPZqAEIcBeOldK1u5 0AT0B/YueAd2STj6zBkXSF+wBL+qj6zEiq792usEuEVWtRGsVdB58SMHfiLqVxLjM2YqYRJd 6nyedsgSGvQngTZtTTPAh/YwCSz+e78q4PeHQ9dmca1DU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17/08/2023 2:15 pm, Jan Beulich wrote:
> On 17.08.2023 14:58, Andrew Cooper wrote:
>> On 17/08/2023 12:47 pm, Jan Beulich wrote:
>>> Our present approach is working fully behind the compiler's back. This
>>> was found to not work with LTO. Employ ld's --wrap= option instead. Note
>>> that while this makes the build work at least with new enough gcc (it
>>> doesn't with gcc7, for example, due to tool chain side issues afaict),
>>> according to my testing things still won't work when building the
>>> fuzzing harness with afl-cc: While with the gcc7 tool chain I see afl-as
>>> getting invoked, this does not happen with gcc13. Yet without using that
>>> assembler wrapper the resulting binary will look uninstrumented to
>>> afl-fuzz.
>>>
>>> While checking the resulting binaries I noticed that we've gained uses
>>> of snprintf() and strstr(), which only just so happen to not cause any
>>> problems. Add a wrappers for them as well.
>>>
>>> Since we don't have any actual uses of v{,sn}printf(), no definitions of
>>> their wrappers appear (just yet). But I think we want
>>> __wrap_{,sn}printf() to properly use __real_v{,sn}printf() right away,
>>> which means we need delarations of the latter.
>>>
>>> Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> This does resolve the build issue.  I do get a binary out of the end, so
>> Tested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>.  I presume that
>> you've smoke tested the resulting binary?
> Oh, another question: Because of you asking it's not really clear whether
> the T-b is kind of implying an A-b as well. Could you confirm one way or
> the other, please?

Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>



 


Rackspace

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