mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Mark Rutland <mark.rutland@arm.com>, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] UBSAN: support __ubsan_handle_type_mismatch_v1
Date: Thu, 8 Feb 2018 19:05:14 +0300	[thread overview]
Message-ID: <e1561019-21c2-04f9-5db7-1c27c327a8db@virtuozzo.com> (raw)
In-Reply-To: <20180208154636.21320-1-mark.rutland@arm.com>



On 02/08/2018 06:46 PM, Mark Rutland wrote:
> Originally, UBSAN's __ubsan_handle_type_mismatch took a struct
> type_mismatch_data, as defined in lib/ubsan.h. This has an unsigned long
> alignment field.
> 
> New versions of UBSAN call __ubsan_handle_type_mismatch_v1, which is
> similar to __ubsan_handle_type_mismatch, but takes a different struct
> where the alignment is stored in an unsigned char (as log2 of the
> alignment). All other fields are unchanged.
> 
> As we don't implement __ubsan_handle_type_mismatch_v1, the kernel will
> fail to link when compiled with compilers using the new ABI (e.g. clang
> form the LLVM 5.0.0 release).
> 
> This patch adds support for the new ABI. To keep things simple, we
> simply convert the new data format into the old format, and hand it on
> to the existing handlers.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
>  lib/ubsan.c | 14 ++++++++++++++
>  lib/ubsan.h |  7 +++++++
>  2 files changed, 21 insertions(+)
> 
> Andrey, does this look correct to you?

Almost.
Commit 42440c1f9911b4b7b8ba3dc4e90c1197bc561211 looks correct to me ;)

Copying ->location is wrong, because we use bit in location struct to suppress multiple
reports of the same location, see was_reported(). So in you case REPORTED_BIT will be set
on stack and original source_location remain unchanged.


> Are there any other new ABI bits that need to be plumbed in?
> 

ABI of __ubsan_handle_nonnull_return() changed as well, but it's never used in the kernel
and probably never will be. Thus I removed it, see bac7a1fff7926fb9891a18fe33650884b0e13e4

  reply	other threads:[~2018-02-08 16:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 15:46 Mark Rutland
2018-02-08 16:05 ` Andrey Ryabinin [this message]
2018-02-08 16:16   ` Mark Rutland

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=e1561019-21c2-04f9-5db7-1c27c327a8db@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.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

all inboxes | Powered by JetHome®