[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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 17 Aug 2023 15:15:30 +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=nNW33ypy2BGVp6BXdLpDN94RzQIMtzX+Zmww4joZ3K8=; b=lXca1QSCoIEPRYjUNOHpPEs3Tpof0RDfx1k9Aq3XI+hoK4PDkt8YhT6yuS60NWtN7qDruUcuvoZrZFRt8xwmmiuQO8hPPqu4eLm9yQrU1Q0ndrf5ukDKyKEYmpeeJrMfr1qa6sLzeKAJiZbZ+h1jGr+5/k6xeqaxSqwH8CMm1mVFtyoH20feqQaAcmL8QGmVcMX2vI7xZ93XebZvVUJ/T+0OqpDAU1CLcwXLDZsDIkvKiEeim6a+6FHekvrR7u0iF/4ZoaYDgrm6/sAcDnI3G1ILLeaBCffj9SIoEq9b/XeZSJpWogabUAGFzN/Aj7kV+5r8f+/W7spesdxJYdAmlQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dzxDgLer8ps0o9sJnu7D2XK3t7dmt/Z7bwcZF2JGOUUyDcu5QTvnUCKbIhXg6JTzVdBa7hXVccFjfod1hnPnouepjHvVhC8cdzhBbMJ0w7kxGMW/D1F00e/vWpBFuUp5Rgh9q+Nr6QpPNACUSP9+CNqZVIE2YB4H+qXiEmKEjd6PV91JynmIgB8bvWaSx1IRwWIt4CK1qVKLigZDtXZF9CBK86r7FCQLiepOJZ0Z/+a3Gn3+zbVdDwhegKLgV3QrJOXzaknGvQXIK5E5ONicZY8H2xfSwH8Ko3FAAVZyEWMnkH/IeBcMl3nV7LpM3z0bMvW4U5UyiTmxbdLychUjcQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 17 Aug 2023 13:15:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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?

Jan



 


Rackspace

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