[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a28gyC6KQfAKf1CG6CGL=7y_pj2VkbuNTb3YvTi7+8+YA@mail.gmail.com>
Date: Tue, 1 Oct 2019 20:53:39 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Kees Cook <keescook@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Dan Carpenter <dan.carpenter@...cle.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] uaccess: Add missing __must_check attributes
On Tue, Oct 1, 2019 at 1:17 AM Kees Cook <keescook@...omium.org> wrote:
> On Mon, Sep 30, 2019 at 12:33:19PM +0200, Arnd Bergmann wrote:
> > On Wed, Aug 28, 2019 at 7:38 PM Kees Cook <keescook@...omium.org> wrote:
> > arch/x86/math-emu/reg_ld_str.c:88:2: error: ignoring return value of
> > function declared with 'warn_unused_result' attribute
> > [-Werror,-Wunused-result]
> > __copy_from_user(sti_ptr, s, 10);
> > ^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
> > arch/x86/math-emu/reg_ld_str.c:1129:2: error: ignoring return value of
> > function declared with 'warn_unused_result' attribute
> > [-Werror,-Wunused-result]
> > __copy_from_user(register_base + offset, s, other);
> > ^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > arch/x86/math-emu/reg_ld_str.c:1131:3: error: ignoring return value of
> > function declared with 'warn_unused_result' attribute
> > [-Werror,-Wunused-result]
> > __copy_from_user(register_base, s + other, offset);
> > ^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> What was the CONFIG for this? I didn't hit these in my build tests.
I saw three randconfig builds trigger it in one day, so not that common.
https://pastebin.com/mUhbNEVR is one of them.
> > Moreover, the same code also ignores the return value from most
> > get_user()/put_user()/FPU_get_user()/FPU_put_user() calls,
> > which have no warn_unused_result annotation (they are macros,
> > but I think something could be done if we want to have that
> > annotation to catch some of the other such users).
>
> It would certainly make sense to mark those as __must_check too... now
> tracking this here for anyone that wants to take a stab at it:
> https://github.com/KSPP/linux/issues/16
FWIW, I have not come up with a way to add the warning, but I
did send a fix for the instances in the math-emu code:
https://lore.kernel.org/lkml/20191001142344.1274185-1-arnd@arndb.de/
Arnd
Powered by blists - more mailing lists