diff mbox

drm/i915: disable KASAN for handlers

Message ID 20170330094627.29460-1-jslaby@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jiri Slaby March 30, 2017, 9:46 a.m. UTC
Handlers are currently the only blocker to compile the kernel with gcc 7
and KASAN+use-after-scope enabled:
drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]

It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
offset. There are too many for KASAN to keep up.

So disable KASAN for this file.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Liska <mliska@suse.cz>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: Zhi Wang <zhi.a.wang@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: intel-gvt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gvt/Makefile | 2 ++
 1 file changed, 2 insertions(+)

Comments

Zhenyu Wang March 31, 2017, 7:21 a.m. UTC | #1
On 2017.03.30 11:46:27 +0200, Jiri Slaby wrote:
> Handlers are currently the only blocker to compile the kernel with gcc 7
> and KASAN+use-after-scope enabled:
> drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
> drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
> drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
> 
> It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
> INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
> offset. There are too many for KASAN to keep up.
> 
> So disable KASAN for this file.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Martin Liska <mliska@suse.cz>
> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang@intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: intel-gvt-dev@lists.freedesktop.org
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> ---
>  drivers/gpu/drm/i915/gvt/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
> index b123c20e2097..942f1849d194 100644
> --- a/drivers/gpu/drm/i915/gvt/Makefile
> +++ b/drivers/gpu/drm/i915/gvt/Makefile
> @@ -6,3 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
>  ccflags-y				+= -I$(src) -I$(src)/$(GVT_DIR) -Wall
>  i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
>  obj-$(CONFIG_DRM_I915_GVT_KVMGT)	+= $(GVT_DIR)/kvmgt.o
> +
> +KASAN_SANITIZE_handlers.o := n
> -- 
> 2.12.2
> 

Applied this, we'd better cleanup legacy usage to current i915 mmio reg define. Thanks!
Jani Nikula March 31, 2017, 10:29 a.m. UTC | #2
On Fri, 31 Mar 2017, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
> On 2017.03.30 11:46:27 +0200, Jiri Slaby wrote:
>> Handlers are currently the only blocker to compile the kernel with gcc 7
>> and KASAN+use-after-scope enabled:
>> drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>> drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>> drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>> 
>> It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
>> INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
>> offset. There are too many for KASAN to keep up.
>> 
>> So disable KASAN for this file.
>> 
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>> Cc: Martin Liska <mliska@suse.cz>
>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>> Cc: Zhi Wang <zhi.a.wang@intel.com>
>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: David Airlie <airlied@linux.ie>
>> Cc: intel-gvt-dev@lists.freedesktop.org
>> Cc: intel-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> ---
>>  drivers/gpu/drm/i915/gvt/Makefile | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
>> index b123c20e2097..942f1849d194 100644
>> --- a/drivers/gpu/drm/i915/gvt/Makefile
>> +++ b/drivers/gpu/drm/i915/gvt/Makefile
>> @@ -6,3 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
>>  ccflags-y				+= -I$(src) -I$(src)/$(GVT_DIR) -Wall
>>  i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
>>  obj-$(CONFIG_DRM_I915_GVT_KVMGT)	+= $(GVT_DIR)/kvmgt.o
>> +
>> +KASAN_SANITIZE_handlers.o := n
>> -- 
>> 2.12.2
>> 
>
> Applied this, we'd better cleanup legacy usage to current i915 mmio
> reg define. Thanks!

Hmmh, that was a bit fast, there was a related discussion going in [1].

BR,
Jani.


[1] http://mid.mail-archive.com/20170320215713.3086140-1-arnd@arndb.de
Arnd Bergmann March 31, 2017, 11:23 a.m. UTC | #3
On Fri, Mar 31, 2017 at 12:29 PM, Jani Nikula
<jani.nikula@linux.intel.com> wrote:
> On Fri, 31 Mar 2017, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
>> On 2017.03.30 11:46:27 +0200, Jiri Slaby wrote:
>>> Handlers are currently the only blocker to compile the kernel with gcc 7
>>> and KASAN+use-after-scope enabled:
>>> drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>> drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>> drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>>
>>> It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
>>> INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
>>> offset. There are too many for KASAN to keep up.
>>>
>>> So disable KASAN for this file.
>>>
>>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>>> Cc: Martin Liska <mliska@suse.cz>
>>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>>> Cc: Zhi Wang <zhi.a.wang@intel.com>
>>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: intel-gvt-dev@lists.freedesktop.org
>>> Cc: intel-gfx@lists.freedesktop.org
>>> Cc: dri-devel@lists.freedesktop.org
>>> ---
>>>  drivers/gpu/drm/i915/gvt/Makefile | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
>>> index b123c20e2097..942f1849d194 100644
>>> --- a/drivers/gpu/drm/i915/gvt/Makefile
>>> +++ b/drivers/gpu/drm/i915/gvt/Makefile
>>> @@ -6,3 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
>>>  ccflags-y                           += -I$(src) -I$(src)/$(GVT_DIR) -Wall
>>>  i915-y                                      += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
>>>  obj-$(CONFIG_DRM_I915_GVT_KVMGT)    += $(GVT_DIR)/kvmgt.o
>>> +
>>> +KASAN_SANITIZE_handlers.o := n
>>> --
>>> 2.12.2
>>>
>>
>> Applied this, we'd better cleanup legacy usage to current i915 mmio
>> reg define. Thanks!
>
> Hmmh, that was a bit fast, there was a related discussion going in [1].
>
> BR,
> Jani.
>
>
> [1] http://mid.mail-archive.com/20170320215713.3086140-1-arnd@arndb.de

Sorry about that, it looked like I never replied to your last mail.

There is also a related problem that I had sent another fix for:
https://patchwork.kernel.org/patch/9601349/

I still think that my two patches are correct and they should both be applied.

       Arnd
Jiri Slaby July 18, 2017, 5:48 a.m. UTC | #4
On 03/31/2017, 01:23 PM, Arnd Bergmann wrote:
> On Fri, Mar 31, 2017 at 12:29 PM, Jani Nikula
> <jani.nikula@linux.intel.com> wrote:
>> On Fri, 31 Mar 2017, Zhenyu Wang <zhenyuw@linux.intel.com> wrote:
>>> On 2017.03.30 11:46:27 +0200, Jiri Slaby wrote:
>>>> Handlers are currently the only blocker to compile the kernel with gcc 7
>>>> and KASAN+use-after-scope enabled:
>>>> drivers/gpu/drm/i915/gvt/handlers.c:2200:1: error: the frame size of 43760 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>>> drivers/gpu/drm/i915/gvt/handlers.c:2402:1: error: the frame size of 9400 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>>> drivers/gpu/drm/i915/gvt/handlers.c:2628:1: error: the frame size of 11256 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
>>>>
>>>> It is due to many expansions of MMIO_* macros in init_generic_mmio_info.
>>>> INTEL_GVT_MMIO_OFFSET generates for each such line a __reg and an
>>>> offset. There are too many for KASAN to keep up.
>>>>
>>>> So disable KASAN for this file.
>>>>
>>>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>>>> Cc: Martin Liska <mliska@suse.cz>
>>>> Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
>>>> Cc: Zhi Wang <zhi.a.wang@intel.com>
>>>> Cc: Daniel Vetter <daniel.vetter@intel.com>
>>>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>>>> Cc: David Airlie <airlied@linux.ie>
>>>> Cc: intel-gvt-dev@lists.freedesktop.org
>>>> Cc: intel-gfx@lists.freedesktop.org
>>>> Cc: dri-devel@lists.freedesktop.org
>>>> ---
>>>>  drivers/gpu/drm/i915/gvt/Makefile | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
>>>> index b123c20e2097..942f1849d194 100644
>>>> --- a/drivers/gpu/drm/i915/gvt/Makefile
>>>> +++ b/drivers/gpu/drm/i915/gvt/Makefile
>>>> @@ -6,3 +6,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
>>>>  ccflags-y                           += -I$(src) -I$(src)/$(GVT_DIR) -Wall
>>>>  i915-y                                      += $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
>>>>  obj-$(CONFIG_DRM_I915_GVT_KVMGT)    += $(GVT_DIR)/kvmgt.o
>>>> +
>>>> +KASAN_SANITIZE_handlers.o := n
>>>> --
>>>> 2.12.2
>>>>
>>>
>>> Applied this, we'd better cleanup legacy usage to current i915 mmio
>>> reg define. Thanks!
>>
>> Hmmh, that was a bit fast, there was a related discussion going in [1].
>>
>> BR,
>> Jani.
>>
>>
>> [1] http://mid.mail-archive.com/20170320215713.3086140-1-arnd@arndb.de
> 
> Sorry about that, it looked like I never replied to your last mail.
> 
> There is also a related problem that I had sent another fix for:
> https://patchwork.kernel.org/patch/9601349/
> 
> I still think that my two patches are correct and they should both be applied.

Hi,

have they been applied yet? Or was this fixed some other way?

thanks,
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/gvt/Makefile b/drivers/gpu/drm/i915/gvt/Makefile
index b123c20e2097..942f1849d194 100644
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ b/drivers/gpu/drm/i915/gvt/Makefile
@@ -6,3 +6,5 @@  GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
 ccflags-y				+= -I$(src) -I$(src)/$(GVT_DIR) -Wall
 i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
 obj-$(CONFIG_DRM_I915_GVT_KVMGT)	+= $(GVT_DIR)/kvmgt.o
+
+KASAN_SANITIZE_handlers.o := n