From: Alexander Potapenko <firstname.lastname@example.org> To: Kees Cook <email@example.com> Cc: firstname.lastname@example.org, Vivek Goyal <email@example.com>, firstname.lastname@example.org, LKML <email@example.com>, Roy Yang <firstname.lastname@example.org>, email@example.com Subject: Re: [PATCH] ovl: explicitly initialize error in ovl_copy_xattr() Date: Fri, 5 Jun 2020 11:46:34 +0200 Message-ID: <CAG_fn=UMye_Qq3XZCVQP150iYeV3BrF_mPVLh83+H4mUy_cmnA@mail.gmail.com> (raw) In-Reply-To: <202006040844.C50B47699@keescook> On Thu, Jun 4, 2020 at 5:57 PM Kees Cook <firstname.lastname@example.org> wrote: > > On Thu, Jun 04, 2020 at 10:42:45AM +0200, email@example.com wrote: > > Under certain circumstances (we found this out running Docker on a > > Clang-built kernel with CONFIG_INIT_STACK_ALL) ovl_copy_xattr() may > > return uninitialized value of |error| from ovl_copy_xattr(). > > It is then returned by ovl_create() to lookup_open(), which casts it to > > an invalid dentry pointer, that can be further read or written by the > > lookup_open() callers. > > > > The uninitialized value is returned when all the xattr on the file > > are ovl_is_private_xattr(), which is actually a successful case, > > therefore we initialize |error| with 0. > > > > Signed-off-by: Alexander Potapenko <firstname.lastname@example.org> > > Cc: Kees Cook <email@example.com> > > Cc: Roy Yang <firstname.lastname@example.org> > > Cc: <email@example.com> # 4.1 > > Please include a Fixes (more below) and Link tags for details to help > guide backporting, then you don't need to bother with with "# 4.1", > the -stable tools will figure it out with a "Fixes" tag. > > Thanks for the v2! > > Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1050405 > Reviewed-by: Kees Cook <firstname.lastname@example.org> > > > The bug seem to date back to at least v4.1 where the annotation has been > > introduced (i.e. the compilers started noticing error could be used > > before being initialized). I hovever didn't try to prove that the > > problem is actually reproducible on such ancient kernels. We've seen it > > on a real machine running v4.4 as well. > > It seems like it came from this, but that's v4.5: > > Fixes: e4ad29fa0d22 ("ovl: use a minimal buffer in ovl_copy_xattr") https://bugs.chromium.org/p/chromium/issues/detail?id=1050405 mentions v4.4.212. Your patch could've been slipped into that kernel as well. > What did you find in v4.1? It looks like error isn't uninitialized in > v4.1: The annotation appeared first in https://elixir.bootlin.com/linux/v4.1.18/source/fs/overlayfs/copy_up.c#L27, does that count as 4.1 or 4.2? > But v4.1.52 backported the above patch (e4ad29fa0d22), which is why I > don't try to figure these things out manually. Once we find the commit, > the tools will figure it out. I think you just need: > > Fixes: e4ad29fa0d22 ("ovl: use a minimal buffer in ovl_copy_xattr") > Cc: email@example.com Sounds good!
next prev parent reply index Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-04 8:42 glider 2020-06-04 8:57 ` Miklos Szeredi 2020-06-04 16:00 ` Kees Cook 2020-06-04 15:57 ` Kees Cook 2020-06-05 9:46 ` Alexander Potapenko [this message] 2020-06-05 9:54 ` Miklos Szeredi -- strict thread matches above, loose matches on Subject: below -- 2020-06-03 17:47 glider 2020-06-03 20:35 ` Kees Cook 2020-06-03 21:46 ` Vivek Goyal 2020-06-04 8:28 ` Alexander Potapenko
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='CAG_fn=UMye_Qq3XZCVQP150iYeV3BrF_mPVLh83+H4mUy_cmnA@mail.gmail.com' \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ /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
LKML Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \ firstname.lastname@example.org public-inbox-index lkml Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git