lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 27 Oct 2021 08:19:49 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Randy Dunlap <rdunlap@...radead.org>
Cc:     Thomas Zimmermann <tzimmermann@...e.de>,
        Naresh Kamboju <naresh.kamboju@...aro.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        open list <linux-kernel@...r.kernel.org>,
        Linux-Next Mailing List <linux-next@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Andrey Konovalov <andreyknvl@...il.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Arnd Bergmann <arnd@...db.de>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: gpu: drm_fb_cma_helper.c:46: undefined reference to `drm_gem_fb_get_obj'

On Wed, Oct 27, 2021 at 2:58 AM Randy Dunlap <rdunlap@...radead.org> wrote:

> >
> > Looking at this config, there is:
> >
> > CONFIG_DRM=y
> > # CONFIG_DRM_DP_AUX_CHARDEV is not set
> > # CONFIG_DRM_DEBUG_MM is not set
> > # CONFIG_DRM_DEBUG_SELFTEST is not set
> > CONFIG_DRM_KMS_HELPER=m
> > # CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
> > # CONFIG_DRM_DP_CEC is not set
> > CONFIG_DRM_GEM_CMA_HELPER=y
> > CONFIG_DRM_KMS_CMA_HELPER=y
> >
> > GEM_CMA_HELPER depends on KMS_HELPER, but the latter is a module. That's probably the cause of the problem. Is it intentionally set this way?
> >
>
> The only drivers that select DRM_KMS_HELPER are both =m, so that's how
> DRM_KMS_HELPER is set also.
>
> Symbol: DRM_KMS_HELPER [=m]
> Type : tristate
> Defined at drivers/gpu/drm/Kconfig:82
> Depends on: HAS_IOMEM [=y] && DRM [=y]
> Selected by [m]:
> - DRM_ATMEL_HLCDC [=m] && HAS_IOMEM [=y] && DRM [=y] && OF [=y] && COMMON_CLK [=y] && MFD_ATMEL_HLCDC [=y] && ARM [=y]
> - DRM_ASPEED_GFX [=m] && HAS_IOMEM [=y] && DRM [=y] && OF [=y] && (COMPILE_TEST [=n] || ARCH_ASPEED [=y]) && MMU [=y]
>
>
> I did the ARM cross-build and also see the linker error.
> I didn't understand why -- and still don't, but here is a little
> speculation:
>
> In the past (e.g. 10 years ago), we have to move some .o files
> in lib/ from lib-y to obj-y so that they would always be included
> in the final object file and not cause their user/caller object
> files to suffer from undefined references.
> These happened because unused functions(?) in lib-y files are
> stripped out of the final object files.
> The same thing could be happening here (still just guessing).
>
> Does that help any?  I dunno.
>
> Adding Arnd to Cc: to see if he has any ideas...

>From all I can tell, the problem is that DRM_KMS_CMA_HELPER is a 'bool'
symbol, so if it gets selected by a '=m' driver, it turns into '=y', which
then selects DRM_GEM_CMA_HELPER=y, but that one cannot link
against DRM_KMS_HELPER=m code.

This trivial change makes it all build:

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index c08860db2520..699f434ce813 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -218,7 +218,7 @@ config DRM_GEM_CMA_HELPER
          Choose this if you need the GEM CMA helper functions

 config DRM_KMS_CMA_HELPER
-       bool
+       tristate
        depends on DRM
        select DRM_GEM_CMA_HELPER
        help

but this needs some more testing to make sure it doesn't add
any other regressions.

Interestingly, I never hit the problem in randconfig testing since
there is always some '=y' driver that selects DRM_KMS_HELPER.

        Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ