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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a0wf8_8YWmi8FRjmqUZej3ximgfxHgRZEOxsV-x3M5_QQ@mail.gmail.com>
Date:   Mon, 11 Oct 2021 14:47:56 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     Will Deacon <will@...nel.org>
Cc:     Anders Roxell <anders.roxell@...aro.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arm64: asm: vdso: gettimeofday: export common variables

On Mon, Oct 11, 2021 at 12:03 PM Will Deacon <will@...nel.org> wrote:
>
> On Thu, Oct 07, 2021 at 09:57:54PM +0200, Anders Roxell wrote:
> > When building the kernel with sparse enabled 'C=1' the following
> > warnings can be seen:
> >
> > arch/arm64/kernel/vdso/vgettimeofday.c:9:5: warning: symbol '__kernel_clock_gettime' was not declared. Should it be static?
> > arch/arm64/kernel/vdso/vgettimeofday.c:15:5: warning: symbol '__kernel_gettimeofday' was not declared. Should it be static?
> > arch/arm64/kernel/vdso/vgettimeofday.c:21:5: warning: symbol '__kernel_clock_getres' was not declared. Should it be static?
> >
> > Rework so the variables are exported, since these variables are
> > created and used in vdso/vgettimeofday.c, also used in vdso.lds.S.
>
> Hmm, these functions are part of the vDSO and shouldn't be called from the
> kernel, so I don't think it makes sense to add prototypes for them to a
> kernel header, to be honest.

It's a recurring problem, and I have recommended this method to Anders as
I don't see any of the alternatives as better.

The thing is that both sparse (with make C=1) and gcc/clang (with make W=1)
warn about missing prototypes, and this catches a lot of real bugs. I hope
that we can eventually get to the point of enabling the warning by default for
all files, but that means we need a declaration for each global function and
variable.

It's possible to work around this by adding a declaration just before the
function definition to shut up those warnings, but I think that's worse because
we should not encourage having declarations in .c files where they may
get out of sync with a definition in another file. It's also possible that some
of the tools will start warning about extern declarations in .c files for this
reason, so it would end up as double work to add them here and move them
later.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ