From: "Kaneda, Erik" <erik.kaneda@intel.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com>,
"will@kernel.org" <will@kernel.org>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"glider@google.com" <glider@google.com>,
Jung-uk Kim <jkim@freebsd.org>, "pcc@google.com" <pcc@google.com>,
Ard Biesheuvel <ardb@kernel.org>,
"dvyukov@google.com" <dvyukov@google.com>,
"devel@acpica.org" <devel@acpica.org>
Subject: RE: [Devel] Re: [PATCH] ACPICA: fix UBSAN warning using __builtin_offsetof
Date: Tue, 16 Jun 2020 21:39:17 +0000 [thread overview]
Message-ID: <MWHPR11MB15994AAFA4C5903DDB3C5861F09D0@MWHPR11MB1599.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CAKwvOdndPdAWVSJ530mgT5onG4zsHExqO79=QvvLvpz51D8LsQ@mail.gmail.com>
> -----Original Message-----
> From: Nick Desaulniers <ndesaulniers@google.com>
> Sent: Thursday, June 11, 2020 10:06 AM
> To: Kaneda, Erik <erik.kaneda@intel.com>
> Cc: Jung-uk Kim <jkim@freebsd.org>; Wysocki, Rafael J
> <rafael.j.wysocki@intel.com>; Ard Biesheuvel <ardb@kernel.org>;
> dvyukov@google.com; glider@google.com; linux-arm-
> kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
> lorenzo.pieralisi@arm.com; mark.rutland@arm.com; pcc@google.com;
> rjw@rjwysocki.net; will@kernel.org; stable@vger.kernel.org; linux-
> acpi@vger.kernel.org; devel@acpica.org
> Subject: Re: [Devel] Re: [PATCH] ACPICA: fix UBSAN warning using
> __builtin_offsetof
>
> On Thu, Jun 11, 2020 at 9:45 AM Kaneda, Erik <erik.kaneda@intel.com>
> wrote:
> >
> > > From: Jung-uk Kim <jkim@FreeBSD.org>
> > >
> > > Actually, I think we should let platform-specific acfoo.h decide what to
> > > do here, i.e.,
> >
> > That's a better solution. For Linux, it would look something like this:
> >
> > --- a/include/acpi/actypes.h
> > +++ b/include/acpi/actypes.h
> > @@ -508,10 +508,15 @@ typedef u64 acpi_integer;
> >
> > #define ACPI_TO_POINTER(i) ACPI_CAST_PTR (void, (acpi_size) (i))
> > #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p, (void *) 0)
> > -#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void *)
> 0)
> > #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
> > #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
> >
> > +/* Platforms may want to define their own ACPI_OFFSET */
> > +
> > +#ifndef ACPI_OFFSET
> > +#define ACPI_OFFSET(d, f) ACPI_PTR_DIFF (&(((d *) 0)->f), (void
> *) 0)
> > +#endif
> > +
> > /* Optimizations for 4-character (32-bit) acpi_name manipulation */
> >
> > #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
> > diff --git a/include/acpi/platform/aclinux.h
> b/include/acpi/platform/aclinux.h
> > index 987e2af7c335..5d1ca6015fce 100644
> > --- a/include/acpi/platform/aclinux.h
> > +++ b/include/acpi/platform/aclinux.h
> > @@ -71,6 +71,11 @@
> > #undef ACPI_DEBUG_DEFAULT
> > #define ACPI_DEBUG_DEFAULT (ACPI_LV_INFO | ACPI_LV_REPAIR)
> >
> > +/* Use gcc's builtin offset instead of the default */
> > +
> > +#undef ACPI_OFFSET
> > +#define ACPI_OFFSET(a,b) __builtin_offsetof(a,b)
> > +
> > #ifndef CONFIG_ACPI
> >
>
Hi,
Sorry about the delayed response.
> Looks good at first glance. Wouldn't actypes.h need to include
> platform/acenv.h first though? Otherwise you put some header
> inclusion order dependency on folks who include actypes.h to first
> include acenv.h otherwise we're not getting the definition in terms of
> __builtin_offsetof.
Actypes.h is intended for ACPICA use. For files using ACPI_OFFSET, they include headers like acpi.h that ends up including aclinux.h before including actypes.h. For those using ACPI_OFFSET, precedence will be given to the definition in aclinux.h before falling back to the definition in actypes.
Erik
>
> --
> Thanks,
> ~Nick Desaulniers
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-16 21:39 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 10:09 arm64/acpi: NULL dereference reports from UBSAN at boot Will Deacon
2020-05-21 17:37 ` Lorenzo Pieralisi
2020-05-26 20:21 ` Will Deacon
2020-05-27 13:41 ` Lorenzo Pieralisi
2020-06-01 7:05 ` Will Deacon
2020-06-01 21:51 ` Nick Desaulniers
2020-06-01 21:57 ` Ard Biesheuvel
2020-06-01 22:19 ` Nick Desaulniers
2020-06-01 22:28 ` Ard Biesheuvel
2020-06-01 23:18 ` [PATCH] ACPICA: fix UBSAN warning using __builtin_offsetof Nick Desaulniers
2020-06-01 23:37 ` Peter Collingbourne
2020-06-01 23:48 ` Nick Desaulniers
2020-06-02 0:02 ` Kaneda, Erik
2020-06-02 18:46 ` Nick Desaulniers
2020-06-08 14:51 ` Will Deacon
2020-06-08 20:29 ` Nick Desaulniers
2020-06-08 20:38 ` [PATCH v2] arm64: acpi: fix UBSAN warning Nick Desaulniers
2020-06-09 17:46 ` Lorenzo Pieralisi
2020-06-09 19:50 ` Jeremy Linton
2020-06-10 11:21 ` Will Deacon
2020-06-08 23:20 ` [PATCH] ACPICA: fix UBSAN warning using __builtin_offsetof Kaneda, Erik
2020-06-10 23:06 ` Kaneda, Erik
2020-06-10 23:29 ` Nick Desaulniers
2020-06-10 23:46 ` Jung-uk Kim
2020-06-11 16:45 ` [Devel] " Kaneda, Erik
2020-06-11 17:06 ` Nick Desaulniers
2020-06-16 21:39 ` Kaneda, Erik [this message]
2020-06-10 23:31 ` Jung-uk Kim
2020-05-22 8:07 ` arm64/acpi: NULL dereference reports from UBSAN at boot Hanjun Guo
2020-05-22 9:43 ` Hanjun Guo
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=MWHPR11MB15994AAFA4C5903DDB3C5861F09D0@MWHPR11MB1599.namprd11.prod.outlook.com \
--to=erik.kaneda@intel.com \
--cc=ardb@kernel.org \
--cc=devel@acpica.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=jkim@freebsd.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=ndesaulniers@google.com \
--cc=pcc@google.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=stable@vger.kernel.org \
--cc=will@kernel.org \
/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).