Skip to content

Commit

Permalink
compile original module for create-diff-object
Browse files Browse the repository at this point in the history
Normally, the symbols in the freshly built object file that
create-diff-object used are the same with our original module.

But the name of the symbols may change if use --skip-gcc-check
or the influence of KCFLAGS. This patch compile original module
for create-diff-object, like original vmlinux, to detect this
problem earlier, before we need to insmod klp.ko.

Signed-off-by: Zhou Chengming <zhouchengming1@_huawei.xyz_>
  • Loading branch information
Zhou Chengming authored and joe-lawrence committed Jan 9, 2017
1 parent aac3690 commit d2c72f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kpatch-build/kpatch-build
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ do
cp -f "$OBJDIR/$i" "$TEMPDIR/patched/$i" || die
done

unset KCFLAGS
echo "Extracting new and modified ELF sections"
FILES="$(cat "$TEMPDIR/changed_objs")"
cd "$TEMPDIR"
Expand All @@ -552,6 +553,13 @@ for i in $FILES; do
if [[ $KOBJFILE = vmlinux ]]; then
KOBJFILE=$VMLINUX
else
cd "$SRCDIR"
patch -p1 -R -d "$SRCDIR" < "$SRCDIR/$APPLIEDPATCHFILE" &> /dev/null
make "-j$CPUS" $KOBJFILE "O=$OBJDIR" >> "$LOGFILE" 2>&1 || die
cd "$OBJDIR"

# pass original module to create-diff-object
cp -f "$KOBJFILE" "$TEMPDIR/module/$KOBJFILE" || die
KOBJFILE="$TEMPDIR/module/$KOBJFILE"
fi
cd $TEMPDIR
Expand Down

0 comments on commit d2c72f2

Please sign in to comment.