qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniele Buono <dbuono@linux.vnet.ibm.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	qemu-devel@nongnu.org, Bandan Das <bsd@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3 1/9] fuzz: Make fork_fuzz.ld compatible with LLVM's LLD
Date: Thu, 19 Nov 2020 17:06:57 -0500	[thread overview]
Message-ID: <edfa9312-f2cf-7f6e-f77a-b63dde380d96@linux.vnet.ibm.com> (raw)
In-Reply-To: <20201106145028.qlkng2l25b7ehvsb@mozz.bu.edu>

Thanks Alex,
do you think you could also give it a try linking with LLD?

just add --extra-ldflags="-fuse-ld=lld"

I do see some small differences when moving from BFD ro LLD, but they 
should not be of importance. The position of the data.fuzz* is kept.

size -A on qemu-fuzz-i386, LTO DISABLED:

BFD
section                  size       addr
[...]
.got                    10704   29849128
.data                 1160800   29859840
__sancov_pcs          3362992   31020640
.data.fuzz_start       210187   34385920
.data.fuzz_ordered     211456   34596352
.bss                  9659608   34807808
.comment                  225          0
[...]

BFD
section                  size       addr
[...]
.got                      816   27824632
.got.plt                 9992   27825448
.data                 1160808   27839536
.data.fuzz_start       210187   29003776
.data.fuzz_ordered     211456   29214208
.data.fuzz_end              0   29425664
.tm_clone_table             0   29425664
__sancov_pcs          3362992   29425664
.bss                  9659624   32788672

I tried running the fuzzer and didn't seem to have any issues, but I
haven't tried a test-build with OSS-Fuzz. Is there a info somewhere
on how to do that?

Thanks,
Daniele

On 11/6/2020 9:50 AM, Alexander Bulekov wrote:
> On 201105 1718, Daniele Buono wrote:
>> LLVM's linker, LLD, supports the keyword "INSERT AFTER", starting with
>> version 11.
>> However, when multiple sections are defined in the same "INSERT AFTER",
>> they are added in a reversed order, compared to BFD's LD.
>>
>> This patch makes fork_fuzz.ld generic enough to work with both linkers.
>> Each section now has its own "INSERT AFTER" keyword, so proper ordering is
>> defined between the sections added.
>>
> 
> Hi Daniele,
> Good to know that LLVM now has support for "INSERT AFTER" :)
> 
> I compared the resulting symbols between __FUZZ_COUNTERS_{START,END}
> (after linking with BFD) before/after this patch, and they look good. I
> also ran a test-build with OSS-Fuzz container and confirmed that the
> resulting binary also had proper symbols.
> 
> Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
> Tested-by: Alexander Bulekov <alxndr@bu.edu>
> 
> Thanks
> 
>> Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
>> ---
>>   tests/qtest/fuzz/fork_fuzz.ld | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/qtest/fuzz/fork_fuzz.ld b/tests/qtest/fuzz/fork_fuzz.ld
>> index bfb667ed06..cfb88b7fdb 100644
>> --- a/tests/qtest/fuzz/fork_fuzz.ld
>> +++ b/tests/qtest/fuzz/fork_fuzz.ld
>> @@ -16,6 +16,11 @@ SECTIONS
>>         /* Lowest stack counter */
>>         *(__sancov_lowest_stack);
>>     }
>> +}
>> +INSERT AFTER .data;
>> +
>> +SECTIONS
>> +{
>>     .data.fuzz_ordered :
>>     {
>>         /*
>> @@ -34,6 +39,11 @@ SECTIONS
>>          */
>>          *(.bss._ZN6fuzzer3TPCE);
>>     }
>> +}
>> +INSERT AFTER .data.fuzz_start;
>> +
>> +SECTIONS
>> +{
>>     .data.fuzz_end : ALIGN(4K)
>>     {
>>         __FUZZ_COUNTERS_END = .;
>> @@ -43,4 +53,4 @@ SECTIONS
>>    * Don't overwrite the SECTIONS in the default linker script. Instead insert the
>>    * above into the default script
>>    */
>> -INSERT AFTER .data;
>> +INSERT AFTER .data.fuzz_ordered;
>> -- 
>> 2.17.1
>>
> 


  reply	other threads:[~2020-11-19 22:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 22:18 [PATCH v3 0/9] Add support for Control-Flow Integrity Daniele Buono
2020-11-05 22:18 ` [PATCH v3 1/9] fuzz: Make fork_fuzz.ld compatible with LLVM's LLD Daniele Buono
2020-11-06 14:50   ` Alexander Bulekov
2020-11-19 22:06     ` Daniele Buono [this message]
2020-12-13  2:51       ` Alexander Bulekov
2020-11-05 22:18 ` [PATCH v3 2/9] s390x: fix clang 11 warnings in cpu_models.c Daniele Buono
2020-11-09 11:12   ` Cornelia Huck
2020-11-05 22:18 ` [PATCH v3 3/9] hw/usb: reorder fields in UASStatus Daniele Buono
2020-11-06 14:28   ` [PATCH-for-5.2? " Philippe Mathieu-Daudé
2020-11-19 16:16     ` Daniele Buono
2021-01-14  8:17       ` Marc-André Lureau
2021-01-14 19:33         ` Daniele Buono
2021-01-18 11:38       ` Philippe Mathieu-Daudé
2021-01-18 16:09         ` Gerd Hoffmann
2020-11-05 22:19 ` [PATCH v3 4/9] s390x: Avoid variable size warning in ipl.h Daniele Buono
2020-11-09 11:14   ` Cornelia Huck
2020-11-05 22:19 ` [PATCH v3 5/9] scsi: fix overflow in scsi_disk_new_request_dump Daniele Buono
2020-11-06 14:32   ` [PATCH-for-5.2? " Philippe Mathieu-Daudé
2020-11-06 14:43     ` Philippe Mathieu-Daudé
2020-11-09 13:26       ` Philippe Mathieu-Daudé
2020-11-19 16:44         ` Daniele Buono
2020-11-05 22:19 ` [PATCH v3 6/9] configure,meson: add option to enable LTO Daniele Buono
2020-11-05 22:19 ` [PATCH v3 7/9] cfi: Initial support for cfi-icall in QEMU Daniele Buono
2020-11-05 22:19 ` [PATCH v3 8/9] check-block: enable iotests with cfi-icall Daniele Buono
2020-11-05 22:19 ` [PATCH v3 9/9] configure,meson: support Control-Flow Integrity Daniele Buono
2020-11-06 12:47 ` [PATCH v3 0/9] Add support for " Cornelia Huck
2020-11-06 13:35   ` Daniele Buono
2020-11-06 14:58     ` Alexander Bulekov
2020-11-19 21:58       ` Daniele Buono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=edfa9312-f2cf-7f6e-f77a-b63dde380d96@linux.vnet.ibm.com \
    --to=dbuono@linux.vnet.ibm.com \
    --cc=alxndr@bu.edu \
    --cc=bsd@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).