If you build with CONFIG_STACK_VALIDATION you will get

  CC      fs/aufs/cpup.o
  fs/aufs/cpup.o: warning: objtool: au_cp_regular()+0x24c: sibling call from 
callable instruction with modified stack frame

As stated in tools/objtool/Documentation/stack-validation.txt the use
of "Dynamic jumps and jumps to undefined symbols" has several
conditions, neither of which we meet. The use of .label to dictate
which label we 'goto' can be implemented in several ways that will be
'safe' from the stack validation point of view. Here we drop the
.label and instead are able to use the .flags to decide which label to
goto. This results in the same end result while ensuring we are a good
citizen with respect to the stack validation.

Signed-off-by: Mark Asselstine <mark.asselst...@windriver.com>
---
 fs/aufs/cpup.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/aufs/cpup.c b/fs/aufs/cpup.c
index 9309866..bc5634b 100644
--- a/fs/aufs/cpup.c
+++ b/fs/aufs/cpup.c
@@ -425,13 +425,11 @@ static int au_cp_regular(struct au_cp_generic *cpg)
                {
                        .bindex = cpg->bsrc,
                        .flags = O_RDONLY | O_NOATIME | O_LARGEFILE,
-                       .label = &&out
                },
                {
                        .bindex = cpg->bdst,
                        .flags = O_WRONLY | O_NOATIME | O_LARGEFILE,
                        .force_wr = !!au_ftest_cpup(cpg->flags, RWDST),
-                       .label = &&out_src
                }
        };
        struct au_branch *br;
@@ -447,8 +445,12 @@ static int au_cp_regular(struct au_cp_generic *cpg)
                f->file = au_h_open(cpg->dentry, f->bindex, f->flags,
                                    /*file*/NULL, f->force_wr);
                err = PTR_ERR(f->file);
-               if (IS_ERR(f->file))
-                       goto *f->label;
+               if (IS_ERR(f->file)) {
+                       if (f->flags & O_RDONLY)
+                               goto out;
+                       else
+                               goto out_src;
+               }
        }
 
        /* try stopping to update while we copyup */
-- 
2.7.4


Reply via email to