]> git.pld-linux.org Git - packages/blcr.git/blob - blcr-update.patch
- x32 is not supported after all
[packages/blcr.git] / blcr-update.patch
1 diff -Nur blcr-0.8.5/acinclude.m4 blcr-0.8.6_b4/acinclude.m4
2 --- blcr-0.8.5/acinclude.m4     2013-01-05 01:59:58.000000000 +0100
3 +++ blcr-0.8.6_b4/acinclude.m4  2014-10-21 02:14:39.000000000 +0200
4 @@ -22,12 +22,12 @@
5  #   along with this program; if not, write to the Free Software
6  #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7  #
8 -# $Id: acinclude.m4,v 1.177.14.17 2013/01/05 00:59:58 phargrov Exp $
9 -AC_REVISION($Revision: 1.177.14.17 $)
10 +# $Id: acinclude.m4,v 1.177.14.22 2014/10/21 00:14:39 phargrov Exp $
11 +AC_REVISION($Revision: 1.177.14.22 $)
12  
13  # Match all kernels major/minor we might accept
14 -m4_define([cr_kern_maj_min_patt],[[\(2\.6\|3\.[0-9][0-9]*\)\.]])[]dnl  No SUBLEVEL or following
15 -m4_define([cr_kern_maj_min_perl],[[(2\.6|3\.[0-9]+)\.]])[]dnl  No SUBLEVEL or following
16 +m4_define([cr_kern_maj_min_patt],[[\(2\.6\|3\.[0-9][0-9]*\)[-.]]])[]dnl  No SUBLEVEL or following
17 +m4_define([cr_kern_maj_min_perl],[[(2\.6|3\.[0-9]+)[-.]]])[]dnl  No SUBLEVEL or following
18  
19  # cr_substr(STRING,OFFSET,[LEN])
20  # ------------------------------------------------------
21 @@ -256,7 +256,7 @@
22        open(F, "echo '=${stamp}->UTS_RELEASE<-' | ${cpp_cmd} -include ${path} - |") || exit 1;
23        LINE: while (<F>) {
24          next LINE if(/^#/);
25 -        if ((my $uts) = /=${stamp}->"(]cr_kern_maj_min_perl[[0-9].*)"<-/o) {
26 +        if ((my $uts) = /=${stamp}->"(]cr_kern_maj_min_perl[.*)"<-/o) {
27            print "$uts\n";
28            exit 0;
29          }
30 @@ -309,7 +309,7 @@
31        if test -z "$cr_tmp"; then
32          # If a dependency does not exist, then make may complain.
33          # The -k and 2>/dev/null take care of that.
34 -        cr_tmp=`(make -k echo_kver --no-print-directory -C $2 -f - 2>/dev/null | grep '^cr_kern_maj_min_patt') <<'_EOF_'
35 +        cr_tmp=`(${MAKE} -k echo_kver --no-print-directory -C $2 -f - 2>/dev/null | grep '^cr_kern_maj_min_patt') <<'_EOF_'
36  echo_kver:
37         @echo '$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)'
38  
39 @@ -344,11 +344,16 @@
40    else
41      AC_MSG_RESULT([$cr_result])
42    fi
43 -  # Check that version is acceptible (exact match, or a prefix with the next char non-numeric)
44 +  # Check that version is acceptible (exact match, or a prefix with the next char non-numeric), including matches forced by --with-linux-src-ver
45    case "$cr_linux_obj_ver" in
46      [${cr_result}|${cr_result}[!0-9]*])      # the outer [] is m4 quoting
47          cr_linux_src_ver="$cr_result";;
48 -    *)  cr_linux_src_ver='';;
49 +    *)  cr_linux_src_ver=''
50 +       if test x"$cr_result" = x"$LINUX_SRC_VER"; then
51 +         AC_MSG_WARN([Accepting $2 as kernel source due to --with-linux-src-ver=$LINUX_SRC_VER])
52 +         cr_linux_src_ver="$LINUX_SRC_VER"
53 +       fi
54 +       ;;
55    esac
56  ])
57  
58 @@ -380,7 +385,7 @@
59        fi
60    done
61    CR_IF([test -z "$cr_linux_src_ver"],
62 -       [AC_MSG_ERROR([Could not locate source directory corresponding to build directory '${LINUX_OBJ}'.  Please use --with-linux-src=FULL_PATH_TO_KERNEL_SRC])])
63 +       [AC_MSG_ERROR([Could not locate source directory corresponding to build directory '${LINUX_OBJ}'.  Please use --with-linux-src=FULL_PATH_TO_KERNEL_SRC to specify a directory and/or --with-linux-src-ver=VERSION to force use of a source directory with a version which does not appear to match the build])])
64  ])
65  
66  # _CR_CHECK_LINUX_OBJ(VER_PATT,DIR,VAR)
67 @@ -477,8 +482,8 @@
68    CR_IF([test -n "$cr_linux_obj_ver"],[CR_FIND_LINUX_SRC($cr_linux_obj_ver)])
69    CR_IF([test -n "$cr_linux_src_ver" -a -n "$cr_linux_obj_ver"],[
70      case "$cr_linux_obj_ver" in
71 -      2.6.*) HAVE_LINUX_2_6=yes;;
72 -      3.*.*) HAVE_LINUX_3=yes;;
73 +      2.6.[[0-9]]*) HAVE_LINUX_2_6=yes;;
74 +      3.[[0-9]]*) HAVE_LINUX_3=yes;;
75      esac
76      LINUX_VER="$cr_linux_obj_ver"
77      CR_KERNEL=`echo $cr_linux_obj_ver | tr - _`
78 @@ -529,8 +534,8 @@
79    echo 'int foo = 0;' >> conftestdir/conftest.c
80    echo 'obj-m := conftest.o' >conftestdir/Makefile
81    unset cr_tmp
82 -  echo "make -C ${LINUX_SRC} builddir=\"`pwd`/conftestdir\" ${KBUILD_MAKE_ARGS} CC=\"${KCC}\" V=1" >&5
83 -  make -C ${LINUX_SRC} builddir="`pwd`/conftestdir" ${KBUILD_MAKE_ARGS} CC="${KCC}" V=1 >conftestdir/output 2>&1 </dev/null
84 +  echo "${MAKE} -C ${LINUX_SRC} builddir=\"`pwd`/conftestdir\" ${KBUILD_MAKE_ARGS} CC=\"${KCC}\" V=1" >&5
85 +  ${MAKE} -C ${LINUX_SRC} builddir="`pwd`/conftestdir" ${KBUILD_MAKE_ARGS} CC="${KCC}" V=1 >conftestdir/output 2>&1 </dev/null
86    if test $? = 0; then cr_tmp=`grep -m1 conftest\\.c conftestdir/output | [sed -e "s:^[        ]*${KCC}::"]`; fi
87    cat conftestdir/output >&5
88    if test "${cr_tmp:+OK}" != OK; then
89 @@ -581,6 +586,7 @@
90         -Wp,-MMD,*) continue;;
91         -I/*) ;;
92         -I*) arg=`echo $arg | [sed -e "s:-I:-I${LINUX_OBJ}/:"]`;;
93 +       -Werror=strict-prototypes) continue;; # Breaks "int main()" in our probes
94        esac
95      fi
96      cr_cvname="$cr_cvname $arg"
97 @@ -682,7 +688,7 @@
98         #include <dlfcn.h>
99  
100         extern int __libc_allocate_rtsig(int);
101 -       int main()
102 +       int main(void)
103         {
104           int s = -1;
105           FILE *f=fopen("conftestval", "w");
106 diff -Nur blcr-0.8.5/autogen.sh blcr-0.8.6_b4/autogen.sh
107 --- blcr-0.8.5/autogen.sh       2012-12-22 00:32:49.000000000 +0100
108 +++ blcr-0.8.6_b4/autogen.sh    2014-10-07 01:12:43.000000000 +0200
109 @@ -22,13 +22,13 @@
110  #   along with this program; if not, write to the Free Software
111  #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
112  #
113 -#  $Id: autogen.sh,v 1.7.38.3 2012/12/21 23:32:49 phargrov Exp $
114 +#  $Id: autogen.sh,v 1.7.38.4 2014/10/06 23:12:43 phargrov Exp $
115  
116  set -e
117  
118  mkdir -p config
119  for dir in . ./config; do
120 -  ( cd $dir && rm -f config.guess config.sub depcomp install-sh libtool ltmain.sh missing mkinstalldirs )
121 +  ( cd $dir && rm -f config.guess config.sub depcomp install-sh libtool ltmain.sh missing mkinstalldirs test-driver )
122  done
123  rm -rf autom4te.cache
124  aclocal
125 @@ -42,6 +42,11 @@
126         rm -f config.sub config.guess
127  fi
128  automake --include-deps --add-missing --copy
129 +if test -e config/test-driver; then # Disable parallel tests:
130 +  rm config/test-driver
131 +  perl -pi -e 's/^#AUTOMAKE_OPTIONS/AUTOMAKE_OPTIONS/;' -- tests/Makefile.am
132 +  automake --include-deps --add-missing --copy
133 +fi
134  
135  if [ -x config.status ]; then
136      echo "################################################################"
137 diff -Nur blcr-0.8.5/configure.ac blcr-0.8.6_b4/configure.ac
138 --- blcr-0.8.5/configure.ac     2013-01-26 01:04:25.000000000 +0100
139 +++ blcr-0.8.6_b4/configure.ac  2014-10-21 02:14:39.000000000 +0200
140 @@ -1,7 +1,7 @@
141  # Process this file with autoconf to produce a configure script.
142  #
143  #   Berkeley Lab Checkpoint/Restart (BLCR) for Linux is Copyright (c)
144 -#   2012, The Regents of the University of California, through Lawrence
145 +#   2014, The Regents of the University of California, through Lawrence
146  #   Berkeley National Laboratory (subject to receipt of any required
147  #   approvals from the U.S. Dept. of Energy).  All rights reserved.
148  #
149 @@ -22,7 +22,7 @@
150  #   along with this program; if not, write to the Free Software
151  #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
152  #
153 -# $Id: configure.ac,v 1.410.2.52 2013/01/26 00:04:25 phargrov Exp $
154 +# $Id: configure.ac,v 1.410.2.63 2014/10/21 00:14:39 phargrov Exp $
155  #
156  
157  ################################################################################
158 @@ -47,7 +47,7 @@
159  # AC_INIT wants to see constants, not shell vars, so we define these with m4.
160  m4_define(RELEASE_MAJOR, 0)
161  m4_define(RELEASE_MINOR, 8)
162 -m4_define(RELEASE_PATCH, 5)
163 +m4_define(RELEASE_PATCH, 6_b4)
164  
165  m4_define(RELEASE_VERSION, RELEASE_MAJOR.RELEASE_MINOR.RELEASE_PATCH)
166  AC_INIT([blcr],[RELEASE_VERSION], [http://ftg.lbl.gov/checkpoint])
167 @@ -126,7 +126,7 @@
168  ################################################################################
169  # Boilerplate for versions and copyrights in generated files
170  ################################################################################
171 -AC_REVISION($Revision: 1.410.2.52 $)
172 +AC_REVISION($Revision: 1.410.2.63 $)
173  AC_COPYRIGHT([[
174      Berkeley Lab Checkpoint/Restart (BLCR) for Linux is Copyright (c)
175      2012, The Regents of the University of California, through Lawrence
176 @@ -265,6 +265,9 @@
177  AC_ARG_WITH([linux-src],
178    [AC_HELP_STRING([--with-linux-src=DIR],[specify full path to Linux kernel source directory if needed (default is to search in some standard locations)])],
179    [AS_IF([test x"$with_linux_src" != xyes],[LINUX_SRC_ARG=$with_linux_src])],)
180 +AC_ARG_WITH([linux-src-ver],
181 +  [AC_HELP_STRING([--with-linux-src-ver=VERSION],[force configure to accept a given kernel source version to use, even if it does not appear to match the build])],
182 +  [AS_IF([test x"$with_linux_src_ver" != xyes],[LINUX_SRC_VER=$with_linux_src_ver])],)
183  
184  # Let user specify location of kernel System.map and/or vmlinux
185  AC_ARG_WITH([system-map],
186 @@ -884,8 +887,8 @@
187  CR_CHECK_KERNEL_HEADER([asm/desc.h],[#include <linux/sched.h>])
188  CR_CHECK_KERNEL_HEADER([asm/vsyscall32.h])
189  CR_CHECK_KERNEL_HEADER([asm/i387.h])
190 -CR_CHECK_KERNEL_HEADER([asm/switch_to.h])
191 -CR_CHECK_KERNEL_HEADER([asm/tls.h])
192 +CR_CHECK_KERNEL_HEADER([asm/switch_to.h],[#include <linux/sched.h>])
193 +CR_CHECK_KERNEL_HEADER([asm/tls.h],[#include <linux/sched.h>])
194  
195  CR_CHECK_KERNEL_HEADER([linux/utsrelease.h])
196  CR_CHECK_KERNEL_HEADER([generated/utsrelease.h])
197 @@ -1019,6 +1022,8 @@
198  if test "${HAVE_NAMEIDATA_PATH}${HAVE_NAMEIDATA_DENTRY}" != "1"; then
199    CR_BAD_KERNEL([unable to determine composition of struct nameidata])
200  fi
201 +CR_CHECK_KERNEL_MEMBER([file.f_path],[#include <linux/fs.h>],
202 +                      [struct file],[struct path],[f_path])
203  
204  CR_CHECK_KERNEL_CALL([path_lookup],[#include <linux/namei.h>])
205  CR_CHECK_KERNEL_CALL([kern_path],[#include <linux/namei.h>])
206 @@ -1029,6 +1034,9 @@
207  
208  CR_CHECK_KERNEL_CALL([__putname],[#include <linux/fs.h>])
209  
210 +CR_CHECK_KERNEL_CALL_NARGS([vfs_getattr],[#include <linux/fs.h>],
211 +  [NULL,NULL],[NULL,NULL,NULL])
212 +
213  CR_CHECK_KERNEL_TYPE([struct delayed_work],[#include <linux/workqueue.h>])
214  
215  # Order for "best" match
216 @@ -1071,6 +1079,11 @@
217    CR_BAD_KERNEL([unable to determine type of task.pids array])
218  fi
219  
220 +CR_FIND_KSYM([signal_wake_up],[CODE],
221 +             [extern void signal_wake_up(struct task_struct *, int);])
222 +CR_FIND_KSYM([signal_wake_up_state],[CODE],
223 +             [extern void signal_wake_up_state(struct task_struct *, int);])
224 +
225  # put_task_struct() requires one of these:
226  CR_FIND_KSYM([__put_task_struct],[CODE],[extern void __put_task_struct(struct task_struct *);])
227  CR_FIND_KSYM([__put_task_struct_cb],[CODE])
228 @@ -1096,8 +1109,22 @@
229  CR_CHECK_KERNEL_MEMBER([thread_info.sysenter_return],[#include <linux/thread_info.h>],
230    [struct thread_info],[void *],[sysenter_return])
231  if test $CR_KARCH = arm; then
232 +  CR_CHECK_KERNEL_MEMBER([mm.context.sigpage],[#include <linux/sched.h>],
233 +    [mm_context_t],[unsigned long],[sigpage])
234    CR_CHECK_KERNEL_MEMBER([thread_info.tp_value],[#include <linux/thread_info.h>],
235      [struct thread_info],[unsigned long],[tp_value])
236 +  pushdef([cr_cvname],cr_cv_kconfig_HAVE_THREAD_INFO_TP_VALUE_ARRAY)[]dnl
237 +  AC_CACHE_CHECK([kernel thread_info.tp_value as array],cr_cvname,[
238 +    CR_TRY_KERNEL_COMPILE([
239 +       #include <linux/thread_info.h>
240 +    ],[
241 +       struct thread_info x;
242 +       unsigned long i = x.tp_value[1];
243 +    ],[cr_cvname=yes],[cr_cvname=no])
244 +  ])
245 +  CR_DEFINE(HAVE_THREAD_INFO_TP_VALUE_ARRAY,[test x$]cr_cvname[ = xyes],
246 +    [Define to 1 if struct thread_info.tp_value has array member 'tp_value'])
247 +  popdef([cr_cvname])[]dnl
248    CR_FIND_KSYM([__kuser_helper_start],[CODE],[extern int __kuser_helper_start(void);])
249    CR_FIND_KSYM([__kuser_cmpxchg],[CODE],[extern int __kuser_cmpxchg(void);])
250  fi
251 @@ -1118,14 +1145,32 @@
252  if test -n "${HAVE_MAP_VSYSCALL}"; then
253    CR_FIND_KSYM([map_vsyscall],[CODE])
254  fi
255 -if test $CR_KARCH = x86_64; then
256 +case $CR_KARCH in
257 +x86_64)
258    CR_FIND_KSYM([syscall32_setup_pages],[CODE],
259         [extern int syscall32_setup_pages(void *, int);])
260 -fi
261 -if test $CR_KARCH = arm; then
262 +  CR_FIND_KSYM([compat_arch_setup_additional_pages],[CODE],
263 +       [extern int compat_arch_setup_additional_pages(void *, int);])
264 +  ;;
265 +arm)
266    CR_FIND_KSYM([vectors_user_mapping],[CODE],
267         [extern int vectors_user_mapping(void);])
268 -fi
269 +  ;;
270 +esac
271 +
272 +pushdef([cr_cvname],cr_cv_kconfig_HAVE_VM_OPS_NAME)[]dnl
273 +AC_CACHE_CHECK([kernel for vm_operations_struct.name],cr_cvname,[
274 +  CR_TRY_KERNEL_COMPILE([
275 +       #include <linux/sched.h>
276 +       #include <linux/mm.h>
277 +    ],[
278 +       struct vm_operations_struct x;
279 +       const char *(*name)(struct vm_area_struct *vma) = x.name;
280 +    ],[cr_cvname=yes],[cr_cvname=no])
281 +])
282 +popdef([cr_cvname])[]dnl
283 +CR_DEFINE(HAVE_VM_OPS_NAME,[test x$cr_cv_kconfig_HAVE_VM_OPS_NAME = xyes],
284 +           [Define to 1 if struct vm_operations_struct has member 'name'])
285  
286  CR_FIND_KSYM([arch_pick_mmap_layout],[CODE])
287  CR_FIND_KSYM([arch_get_unmaped_area],[CODE])
288 @@ -1134,11 +1179,16 @@
289         [struct mm_struct],[unsigned long],[mmap_base])
290  CR_CHECK_KERNEL_MEMBER([mm.cached_hole_size],[#include <linux/sched.h>],
291         [struct mm_struct],[unsigned long],[cached_hole_size])
292 +CR_CHECK_KERNEL_MEMBER([mm.free_area_cache],[#include <linux/sched.h>],
293 +       [struct mm_struct],[unsigned long],[free_area_cache])
294  
295  CR_FIND_KSYM([do_munmap],[CODE])
296  CR_CHECK_KERNEL_CALL([do_mmap],[#include <linux/mm.h>])
297  CR_CHECK_KERNEL_CALL([do_mmap_pgoff],[#include <linux/mm.h>])
298 -if test -n "${HAVE_DO_MMAP_PGOFF}"; then
299 +
300 +CR_CHECK_KERNEL_CALL_NARGS([do_mmap_pgoff],[#include <linux/mm.h>],
301 +  [NULL,0,0,0,0,0],[NULL,0,0,0,0,0,NULL])
302 +if test -n "${HAVE_6_ARG_DO_MMAP_PGOFF}${HAVE_7_ARG_DO_MMAP_PGOFF}"; then
303    CR_FIND_KSYM([do_mmap_pgoff],[CODE])
304  elif test -n "${HAVE_DO_MMAP}"; then
305    CR_FIND_KSYM([do_mmap],[CODE])
306 @@ -1271,6 +1321,17 @@
307    CR_CHECK_KERNEL_MEMBER([pt_regs.gs],[#include <asm/ptrace.h>],[struct pt_regs],[int],[gs])
308  fi
309  
310 +if test $CR_KARCH = ppc -o $CR_KARCH = ppc64; then
311 +  CR_CHECK_KERNEL_MEMBER([thread.fpr],[#include <linux/sched.h>],
312 +                        [struct thread_struct],[void*],[fpr])
313 +  CR_CHECK_KERNEL_MEMBER([thread.vr],[#include <linux/sched.h>],
314 +                        [struct thread_struct],[void*],[vr])
315 +  CR_CHECK_KERNEL_MEMBER([thread.fp_state],[#include <linux/sched.h>],
316 +                        [struct thread_struct],[struct thread_fp_state],[fp_state])
317 +  CR_CHECK_KERNEL_MEMBER([thread.vr_state],[#include <linux/sched.h>],
318 +                        [struct thread_struct],[struct thread_vr_state],[vr_state])
319 +fi
320 +
321  CR_CHECK_KERNEL_MEMBER([inode sem],[
322      #include <linux/sched.h>
323      #include <linux/fs.h>
324 @@ -1287,9 +1348,13 @@
325  
326  CR_CHECK_KERNEL_MEMBER([mm.dumpable],[#include <linux/sched.h>],
327    [struct mm_struct],[int],[dumpable])
328 -CR_FIND_KSYM([get_dumpable],[CODE],[extern int get_dumpable(struct mm_struct *mm);])
329 +CR_CHECK_KERNEL_CALL([get_dumpable],[#include <linux/sched.h>])
330 +if test -n "${HAVE_GET_DUMPABLE}"; then
331 +  # Note: may be an inline in some kernels
332 +  CR_FIND_KSYM([get_dumpable],[CODE],[extern int get_dumpable(struct mm_struct *mm);])
333 +fi
334  # Allow one or more match(es)
335 -if test -z "${HAVE_MM_DUMPABLE}${cr_addr}"; then
336 +if test -z "${HAVE_MM_DUMPABLE}${HAVE_GET_DUMPABLE}"; then
337    CR_BAD_KERNEL([unable to determine how to identify non-dumpable tasks])
338  fi
339  
340 @@ -1308,6 +1373,8 @@
341    CR_CHECK_KERNEL_CALL_NARGS([dentry_open],[#include <linux/fs.h>],
342         [NULL,0,NULL],[NULL,NULL,0,NULL])
343  fi
344 +CR_CHECK_KERNEL_CALL([uid_eq],[#include <linux/sched.h>])
345 +CR_CHECK_KERNEL_CALL([from_kuid],[#include <linux/sched.h>])
346  
347  CR_CHECK_KERNEL_MEMBER([task.group_info],[#include <linux/sched.h>],
348    [struct task_struct],[struct group_info *],[group_info])
349 @@ -1368,6 +1435,10 @@
350         #include <linux/slab.h>
351         #include <linux/pid_namespace.h>
352      ], [struct pid_namespace],[void *],[pid_cachep])
353 +  CR_CHECK_KERNEL_MEMBER([pid_namespace.nr_hashed],[
354 +       #include <linux/slab.h>
355 +       #include <linux/pid_namespace.h>
356 +    ], [struct pid_namespace],[unsigned int],[nr_hashed])
357    CR_FIND_KSYM([pid_cachep],[DATA],[
358      #if HAVE_KMEM_CACHE_T
359        extern kmem_cache_t *pid_cachep;
360 @@ -1398,16 +1469,18 @@
361          #include <linux/pid.h>],
362         [extern void attach_pid(struct task_struct *task, enum pid_type type, struct pid *pid);])
363  
364 -# Require exactly one match
365 -if test "${HAVE_2_6_0_ATTACH_PID}${HAVE_2_6_22_ATTACH_PID}${HAVE_2_6_26_ATTACH_PID}" != "1"; then
366 -  CR_BAD_KERNEL([unable to determine how to call attach_pid()])
367 -fi
368 -
369  CR_CHECK_KERNEL_CALL([change_pid],[
370         #include <linux/sched.h>
371         #include <linux/pid.h>])
372  # OK if missing
373  
374 +# Require change_pid or exactly one match to attach_pid family
375 +if test -z "${HAVE_CHANGE_PID}"; then
376 +  if test "${HAVE_2_6_0_ATTACH_PID}${HAVE_2_6_22_ATTACH_PID}${HAVE_2_6_26_ATTACH_PID}" != "1"; then
377 +    CR_BAD_KERNEL([unable to determine how to call attach_pid()])
378 +  fi
379 +fi
380 +
381  CR_CHECK_KERNEL_TYPE([struct pidmap],[
382    #if HAVE_LINUX_PSPACE_H
383      #include <linux/pspace.h>
384 @@ -1493,7 +1566,7 @@
385    ],[struct pipe_inode_info],[char*],[base])
386  # OK if missing.
387  CR_CHECK_KERNEL_MEMBER([pipe_inode_info.buffers],[
388 -    #include <linux/wait.h>
389 +    #include <linux/sched.h>
390      #include <linux/pipe_fs_i.h>
391      ],[struct pipe_inode_info],[unsigned int],[buffers])
392  # OK if missing.
393 @@ -1516,9 +1589,10 @@
394        struct pipe_buf_operations p;
395        (void)p.unmap(NULL,NULL,NULL);
396      ])
397 +  CR_CHECK_KERNEL_CALL([copy_page_to_iter],[#include <linux/uio.h>])
398  fi
399  # Require exactly one match
400 -if test "${HAVE_PIPE_INODE_INFO_BASE}${HAVE_PIPE_BUF_OPERATIONS_PIN}${HAVE_2_ARG_PIPE_OPS_UNMAP}${HAVE_3_ARG_PIPE_OPS_UNMAP}" != "1"; then
401 +if test "${HAVE_PIPE_INODE_INFO_BASE}${HAVE_PIPE_BUF_OPERATIONS_PIN}${HAVE_2_ARG_PIPE_OPS_UNMAP}${HAVE_3_ARG_PIPE_OPS_UNMAP}${HAVE_COPY_PAGE_TO_ITER}" != "1"; then
402    CR_BAD_KERNEL([unrecognized pipe buf operations])
403  fi
404  CR_FIND_KSYM([anon_pipe_buf_ops],[DATA],
405 @@ -1607,6 +1681,9 @@
406  fi
407  
408  CR_CHECK_KERNEL_SYMBOL([proc_root],[#include <linux/proc_fs.h>])
409 +CR_CHECK_KERNEL_CALL([proc_mkdir],[#include <linux/proc_fs.h>])
410 +CR_CHECK_KERNEL_CALL([proc_create],[#include <linux/proc_fs.h>])
411 +CR_CHECK_KERNEL_CALL([proc_remove],[#include <linux/proc_fs.h>])
412  
413  # check kmalloc max size
414  CR_CHECK_KMALLOC_MAX
415 @@ -1699,6 +1776,7 @@
416  # For blcr
417  CR_FIND_KSYM([set_fs_pwd],[CODE])
418  # For vmadump4
419 +CR_FIND_KSYM([set_mm_exe_file],[CODE])
420  CR_FIND_KSYM([sys_mremap],[CODE],
421         [extern asmlinkage unsigned long sys_mremap(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, unsigned long new_addr);])
422  CR_FIND_KSYM([do_sigaction],[CODE])
423 @@ -1736,7 +1814,10 @@
424  fi
425  CR_FIND_KSYM([expand_files],[CODE],
426         [extern int expand_files(struct files_struct *, int);])
427 +CR_FIND_KSYM([expand_fdtable],[CODE],
428 +       [extern int expand_fdtable(struct files_struct *, int);])
429  CR_FIND_KSYM([__flush_icache_range],[CODE])
430 +CR_FIND_KSYM([flush_icache_range],[CODE])
431  
432  CR_FIND_KSYM([sys_fchmod],[CODE],
433         [extern asmlinkage long sys_fchmod(int fd, mode_t mode);])
434 diff -Nur blcr-0.8.5/cr_module/cr_chkpt_req.c blcr-0.8.6_b4/cr_module/cr_chkpt_req.c
435 --- blcr-0.8.5/cr_module/cr_chkpt_req.c 2012-12-18 19:32:05.000000000 +0100
436 +++ blcr-0.8.6_b4/cr_module/cr_chkpt_req.c      2014-09-19 01:46:06.000000000 +0200
437 @@ -21,7 +21,7 @@
438   * along with this program; if not, write to the Free Software
439   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
440   *
441 - * $Id: cr_chkpt_req.c,v 1.264.6.5 2012/12/18 18:32:05 phargrov Exp $
442 + * $Id: cr_chkpt_req.c,v 1.264.6.6 2014/09/18 23:46:06 phargrov Exp $
443   */
444  
445  #include "cr_module.h"
446 @@ -382,7 +382,7 @@
447  // cr_is_dumpable(task)
448  #if HAVE_MM_DUMPABLE
449      #define __cr_mm_get_dumpable(mm) ((mm)->dumpable)
450 -#elif defined(CR_KCODE_get_dumpable)
451 +#elif HAVE_GET_DUMPABLE
452      #define __cr_mm_get_dumpable(mm) get_dumpable(mm)
453  #else
454      #error
455 @@ -410,8 +410,8 @@
456         task_lock(task);
457         tcred = cr_task_cred(task);
458         if ((!cr_is_dumpable(task) ||
459 -            ((cred->euid != tcred->suid) && (cred->euid != tcred->uid) &&
460 -             (cred->uid  != tcred->suid) && (cred->uid  != tcred->uid)))
461 +            (cr_uid_ne(cred->euid, tcred->suid) && cr_uid_ne(cred->euid, tcred->uid) &&
462 +             cr_uid_ne(cred->uid,  tcred->suid) && cr_uid_ne(cred->uid,  tcred->uid)))
463             && !cr_capable(CAP_KILL)) {
464                 result = -EPERM;
465         }
466 diff -Nur blcr-0.8.5/cr_module/cr_creds.c blcr-0.8.6_b4/cr_module/cr_creds.c
467 --- blcr-0.8.5/cr_module/cr_creds.c     2009-02-07 03:42:54.000000000 +0100
468 +++ blcr-0.8.6_b4/cr_module/cr_creds.c  2014-09-19 11:13:53.000000000 +0200
469 @@ -21,7 +21,7 @@
470   * along with this program; if not, write to the Free Software
471   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
472   *
473 - * $Id: cr_creds.c,v 1.384.8.2 2009/02/07 02:42:54 phargrov Exp $
474 + * $Id: cr_creds.c,v 1.384.8.4 2014/09/19 09:13:53 phargrov Exp $
475   */
476  
477  #include "cr_module.h"
478 @@ -103,7 +103,8 @@
479             int gid_ok = 0; /* Assume no match for this gid */
480  
481      #if defined(CR_KCODE_groups_search)
482 -           gid_ok = groups_search((struct group_info *)gi, g); // search is const, but not declared as such
483 +           // NOTE: groups_search is const, but not always declared as such
484 +           gid_ok = groups_search((struct group_info *)gi, cr_make_kgid(g));
485      #elif defined(CR_KCODE_supplemental_group_member)
486             gid_ok = supplemental_group_member(g);
487      #else
488 @@ -189,7 +190,7 @@
489           *
490           * Set the dumpable flag for the process, taken from 2.6.22 fs/exec.c
491           */
492 -        if (my_cred->euid == my_cred->uid && my_cred->egid == my_cred->gid) {
493 +        if (cr_uid_eq(my_cred->euid, my_cred->uid) && cr_gid_eq(my_cred->egid, my_cred->gid)) {
494              cr_set_dumpable(current->mm, 1);
495          } else {
496              cr_set_dumpable(current->mm, cr_suid_dumpable);
497 @@ -214,12 +215,12 @@
498      cr_cred_t my_cred = cr_current_cred();
499      cr_group_info_t gi;
500  
501 -    cf_creds.uid   = my_cred->uid;
502 -    cf_creds.euid  = my_cred->euid;
503 -    cf_creds.suid  = my_cred->suid;
504 -    cf_creds.gid   = my_cred->gid;
505 -    cf_creds.egid  = my_cred->egid;
506 -    cf_creds.sgid  = my_cred->sgid;
507 +    cf_creds.uid   = cr_from_kuid(my_cred->uid);
508 +    cf_creds.euid  = cr_from_kuid(my_cred->euid);
509 +    cf_creds.suid  = cr_from_kuid(my_cred->suid);
510 +    cf_creds.gid   = cr_from_kgid(my_cred->gid);
511 +    cf_creds.egid  = cr_from_kgid(my_cred->egid);
512 +    cf_creds.sgid  = cr_from_kgid(my_cred->sgid);
513  
514      /* save the number of groups, so we know how many to read later */
515      gi = cr_current_groups();
516 @@ -258,7 +259,7 @@
517         }
518  
519         for (i=0; i<cf_creds.ngroups; ++i) {
520 -           groups[i] = CR_GROUP_AT(gi, i);
521 +           groups[i] = cr_from_kgid(CR_GROUP_AT(gi, i));
522         }
523  
524         result = cr_kwrite(eb, proc_req->file, groups, sizeof_groups);
525 diff -Nur blcr-0.8.5/cr_module/cr_dump_self.c blcr-0.8.6_b4/cr_module/cr_dump_self.c
526 --- blcr-0.8.5/cr_module/cr_dump_self.c 2012-12-19 06:21:28.000000000 +0100
527 +++ blcr-0.8.6_b4/cr_module/cr_dump_self.c      2014-09-19 01:46:06.000000000 +0200
528 @@ -21,7 +21,7 @@
529   * along with this program; if not, write to the Free Software
530   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
531   *
532 - * $Id: cr_dump_self.c,v 1.228.8.7 2012/12/19 05:21:28 phargrov Exp $
533 + * $Id: cr_dump_self.c,v 1.228.8.8 2014/09/18 23:46:06 phargrov Exp $
534   */
535  
536  #include "cr_module.h"
537 @@ -61,8 +61,8 @@
538         goto out;
539      }
540  
541 -    read_lock(&tasklist_lock);
542      read_lock(&req->lock);
543 +    read_lock(&tasklist_lock);
544      /* loop over each task, and copy important fields into the linkage */
545      task_num = 0;
546      list_for_each_entry(cr_task, &proc_req->tasks, proc_req_list) {
547 @@ -119,8 +119,8 @@
548      }
549  
550  out_nulltask:
551 -    read_unlock(&req->lock);
552      read_unlock(&tasklist_lock);
553 +    read_unlock(&req->lock);
554  
555      /* This will catch the goto, and a possible race condition */
556      if (task_num != task_count) {
557 diff -Nur blcr-0.8.5/cr_module/cr_io.c blcr-0.8.6_b4/cr_module/cr_io.c
558 --- blcr-0.8.5/cr_module/cr_io.c        2013-01-04 05:21:24.000000000 +0100
559 +++ blcr-0.8.6_b4/cr_module/cr_io.c     2014-09-19 01:46:06.000000000 +0200
560 @@ -21,7 +21,7 @@
561   * along with this program; if not, write to the Free Software
562   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
563   *
564 - * $Id: cr_io.c,v 1.77.4.6 2013/01/04 04:21:24 phargrov Exp $
565 + * $Id: cr_io.c,v 1.77.4.7 2014/09/18 23:46:06 phargrov Exp $
566   */
567  
568  /*
569 @@ -1308,7 +1308,7 @@
570         /* Attrs up-to-date, so nothing to do */
571      } else {
572         struct kstat stat;
573 -       retval = vfs_getattr(filp->f_vfsmnt, dentry, &stat);
574 +       retval = cr_vfs_getattr(filp, &stat);
575         if (map && !retval) {
576             cr_insert_object(map, map_key, (void *)1UL, GFP_KERNEL);
577         }
578 diff -Nur blcr-0.8.5/cr_module/cr_kcompat.h blcr-0.8.6_b4/cr_module/cr_kcompat.h
579 --- blcr-0.8.5/cr_module/cr_kcompat.h   2013-01-04 05:21:24.000000000 +0100
580 +++ blcr-0.8.6_b4/cr_module/cr_kcompat.h        2014-09-19 11:13:53.000000000 +0200
581 @@ -21,7 +21,7 @@
582   * along with this program; if not, write to the Free Software
583   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
584   *
585 - * $Id: cr_kcompat.h,v 1.247.8.8 2013/01/04 04:21:24 phargrov Exp $
586 + * $Id: cr_kcompat.h,v 1.247.8.10 2014/09/19 09:13:53 phargrov Exp $
587   *
588   * This file tries to hide as much as practical the differences among Linux
589   * kernel versions.  Preferably this is done by back-porting new features, but
590 @@ -171,6 +171,12 @@
591    #define CR_MAX_FDS(_fdt) ((_fdt)->max_fds)
592  #endif
593  
594 +#if !defined(CR_KCODE_expand_files) && defined(CR_KCODE_expand_fdtable)
595 +  static __inline__ int expand_files(struct files_struct *files, int nr) {
596 +    return (nr < CR_MAX_FDS(cr_fdtable(files))) ? 0 : expand_fdtable(files, nr);
597 +  }
598 +#endif
599 +
600  #ifndef thread_group_leader
601    #define thread_group_leader(p) ((p)->pid == (p)->tgid)
602  #endif
603 @@ -248,8 +254,16 @@
604    }
605  #endif
606  
607 -#if HAVE_DO_MMAP_PGOFF
608 +#if HAVE_6_ARG_DO_MMAP_PGOFF
609    #define cr_mmap_pgoff do_mmap_pgoff
610 +#elif HAVE_7_ARG_DO_MMAP_PGOFF
611 +  static __inline__ unsigned long
612 +  cr_mmap_pgoff(struct file *filp, unsigned long addr,
613 +                unsigned long len, unsigned long prot,
614 +                unsigned long flags, unsigned long pgoff) {
615 +    unsigned long populate;
616 +    return do_mmap_pgoff(filp, addr, len, prot, flags, pgoff, &populate);
617 +  }
618  #elif HAVE_DO_MMAP
619    #define cr_mmap_pgoff(_filp, _start, _len, _prot, _flags, _pgoff) \
620                  do_mmap(_filp, _start, _len, _prot, _flags, ((_pgoff) << PAGE_SHIFT))
621 @@ -540,12 +554,6 @@
622    #error
623  #endif
624  
625 -#if HAVE_PROC_ROOT
626 -  #define cr_proc_root (&proc_root)
627 -#else
628 -  #define cr_proc_root NULL
629 -#endif
630 -
631  #if HAVE_SET_DUMPABLE
632    #define cr_set_dumpable(_mm,_val)    set_dumpable((_mm),(_val))
633  #elif HAVE_MM_DUMPABLE
634 @@ -560,6 +568,18 @@
635    #define cr_suid_dumpable 0
636  #endif
637  
638 +#if HAVE_2_ARG_VFS_GETATTR
639 +  static __inline__ int cr_vfs_getattr(struct file *filp, struct kstat *stat) {
640 +       return vfs_getattr(&filp->f_path, stat);
641 +  }
642 +#elif HAVE_3_ARG_VFS_GETATTR
643 +  static __inline__ int cr_vfs_getattr(struct file *filp, struct kstat *stat) {
644 +        return vfs_getattr(filp->f_vfsmnt, filp->f_dentry, stat);
645 +  }
646 +#else 
647 +  #error
648 +#endif
649 +
650  // wait_event_timeout() first appears in 2.6.9
651  // This is reproduced from linux-2.6.9/include/linux/wait.h
652  #ifndef wait_event_timeout
653 @@ -609,6 +629,30 @@
654    #define cr_task_cred(_t)     (_t)
655  #endif
656  
657 +#if HAVE_UID_EQ
658 +  #define cr_uid_eq(_left, _right) (uid_eq(_left, _right))
659 +  #define cr_uid_ne(_left, _right) (!uid_eq(_left, _right))
660 +  #define cr_gid_eq(_left, _right) (gid_eq(_left, _right))
661 +  #define cr_gid_ne(_left, _right) (!gid_eq(_left, _right))
662 +#else
663 +  #define cr_uid_eq(_left, _right) ((_left) == (_right))
664 +  #define cr_uid_ne(_left, _right) ((_left) != (_right))
665 +  #define cr_gid_eq(_left, _right) ((_left) == (_right))
666 +  #define cr_gid_ne(_left, _right) ((_left) != (_right))
667 +#endif
668 +
669 +#if HAVE_FROM_KUID
670 +  #define cr_from_kuid(_id) from_kuid(&init_user_ns, (_id))
671 +  #define cr_make_kuid(_id) make_kuid(&init_user_ns, (_id))
672 +  #define cr_from_kgid(_id) from_kgid(&init_user_ns, (_id))
673 +  #define cr_make_kgid(_id) make_kgid(&init_user_ns, (_id))
674 +#else
675 +  #define cr_from_kuid(_id) (_id)
676 +  #define cr_make_kuid(_id) (_id)
677 +  #define cr_from_kgid(_id) (_id)
678 +  #define cr_make_kgid(_id) (_id)
679 +#endif
680 +
681  #if defined(CR_KCODE_put_fs_struct)
682    static __inline__ void cr_free_fs_struct(struct fs_struct *fs) {
683      CRI_ASSERT(atomic_read(&fs->count) == 1);
684 diff -Nur blcr-0.8.5/cr_module/cr_pipes.c blcr-0.8.6_b4/cr_module/cr_pipes.c
685 --- blcr-0.8.5/cr_module/cr_pipes.c     2013-01-04 05:21:24.000000000 +0100
686 +++ blcr-0.8.6_b4/cr_module/cr_pipes.c  2014-09-30 04:32:47.000000000 +0200
687 @@ -21,7 +21,7 @@
688   * along with this program; if not, write to the Free Software
689   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
690   *
691 - * $Id: cr_pipes.c,v 1.225.8.9 2013/01/04 04:21:24 phargrov Exp $
692 + * $Id: cr_pipes.c,v 1.225.8.11 2014/09/30 02:32:47 phargrov Exp $
693   */
694  
695  #include "cr_module.h"
696 @@ -125,8 +125,13 @@
697                      const char *name)
698  {
699      cr_errbuf_t *eb = req->errbuf;
700 +#if HAVE_FILE_F_PATH
701 +    struct dentry *dentry = first_filp->f_path.dentry;
702 +    struct vfsmount *mnt = first_filp->f_path.mnt;
703 +#else
704      struct dentry *dentry = first_filp->f_dentry;
705      struct vfsmount *mnt = first_filp->f_vfsmnt;
706 +#endif
707      struct dentry *new_dentry = NULL;
708      int retval = -EINVAL;
709  
710 @@ -356,7 +361,7 @@
711         retval = 0;
712      }
713  #else
714 -    {   struct pipe_inode_info *pipe = p_inode->i_pipe;
715 +    {
716         char * p;
717          int nrbufs;
718  
719 @@ -801,9 +806,9 @@
720             curbuf = pipe->curbuf;
721             for (i = 0; i < pipe->nrbufs; ++i) {
722                 struct pipe_buffer *pbuf = pipe->bufs + curbuf;
723 -               const struct pipe_buf_operations *ops = pbuf->ops;
724                 char *addr;
725  #if HAVE_PIPE_BUF_OPERATIONS_PIN
726 +               const struct pipe_buf_operations *ops = pbuf->ops;
727                 int error = ops->pin(pipe, pbuf);
728                 if (error) {
729                   retval = error;
730 @@ -814,13 +819,19 @@
731                 memcpy(p, addr + pbuf->offset, pbuf->len);
732                 ops->unmap(pipe, pbuf, addr);
733  #elif HAVE_2_ARG_PIPE_OPS_UNMAP
734 +               const struct pipe_buf_operations *ops = pbuf->ops;
735                 addr = ops->map(filp, pipe, pbuf);
736                 memcpy(p, addr + pbuf->offset, pbuf->len);
737                 ops->unmap(pipe, pbuf);
738  #elif HAVE_3_ARG_PIPE_OPS_UNMAP
739 +               const struct pipe_buf_operations *ops = pbuf->ops;
740                 addr = ops->map(pipe, pbuf, 0);
741                 memcpy(p, addr + pbuf->offset, pbuf->len);
742                 ops->unmap(pipe, pbuf, addr);
743 +#elif HAVE_COPY_PAGE_TO_ITER
744 +               addr = kmap(pbuf->page);
745 +               memcpy(p, addr + pbuf->offset, pbuf->len);
746 +               kunmap(pbuf->page);
747  #else
748    #error "Unknown pipe buf operations"
749  #endif
750 diff -Nur blcr-0.8.5/cr_module/cr_proc.c blcr-0.8.6_b4/cr_module/cr_proc.c
751 --- blcr-0.8.5/cr_module/cr_proc.c      2008-06-19 09:47:57.000000000 +0200
752 +++ blcr-0.8.6_b4/cr_module/cr_proc.c   2014-09-19 01:46:07.000000000 +0200
753 @@ -21,7 +21,7 @@
754   * along with this program; if not, write to the Free Software
755   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
756   *
757 - * $Id: cr_proc.c,v 1.19 2008/06/19 07:47:57 phargrov Exp $
758 + * $Id: cr_proc.c,v 1.19.12.1 2014/09/18 23:46:07 phargrov Exp $
759   */
760  
761  #include "cr_module.h"
762 @@ -30,6 +30,12 @@
763  #include <linux/init.h>
764  
765  
766 +#if HAVE_PROC_ROOT
767 +  #define cr_proc_root (&proc_root)
768 +#else
769 +  #define cr_proc_root NULL
770 +#endif
771 +
772  /*
773   * Our proc_fs entries
774   */
775 @@ -46,21 +52,31 @@
776  {
777         CR_KTRACE_FUNC_ENTRY();
778  
779 +#if HAVE_PROC_MKDIR
780 +       proc_checkpoint = proc_mkdir("checkpoint", cr_proc_root);
781 +#else
782         proc_checkpoint = create_proc_entry("checkpoint", S_IFDIR, cr_proc_root);
783 +#endif
784         if (proc_checkpoint == NULL) {
785                 CR_ERR("proc_create_entry(/proc/checkpoint/) failed");
786                 return -ENOMEM;
787         }
788  
789 +#if HAVE_PROC_CREATE
790 +       proc_ctrl = proc_create("ctrl", S_IFREG | S_IRUGO | S_IWUGO,
791 +                               proc_checkpoint, &cr_ctrl_fops);
792 +#else
793         proc_ctrl = create_proc_entry("ctrl", S_IFREG | S_IRUGO | S_IWUGO,
794                                       proc_checkpoint);
795 +       if (proc_ctrl) {
796 +               proc_ctrl->proc_fops = &cr_ctrl_fops;
797 +       }
798 +#endif
799         if (proc_ctrl == NULL) {
800                 CR_ERR("proc_create_entry(/proc/checkpoint/ctrl) failed");
801                 return -ENOMEM;
802         }
803  
804 -       proc_ctrl->proc_fops = &cr_ctrl_fops;
805 -
806         return 0;
807  }
808  
809 @@ -74,6 +90,11 @@
810  {
811         CR_KTRACE_FUNC_ENTRY();
812  
813 +#if HAVE_PROC_REMOVE
814 +       proc_remove(proc_ctrl);
815 +       proc_remove(proc_checkpoint);
816 +#else
817         remove_proc_entry("ctrl", proc_checkpoint);
818         remove_proc_entry("checkpoint", cr_proc_root);
819 +#endif
820  }
821 diff -Nur blcr-0.8.5/cr_module/cr_rstrt_req.c blcr-0.8.6_b4/cr_module/cr_rstrt_req.c
822 --- blcr-0.8.5/cr_module/cr_rstrt_req.c 2012-12-25 04:27:28.000000000 +0100
823 +++ blcr-0.8.6_b4/cr_module/cr_rstrt_req.c      2014-09-30 04:32:47.000000000 +0200
824 @@ -21,7 +21,7 @@
825   * along with this program; if not, write to the Free Software
826   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
827   *
828 - * $Id: cr_rstrt_req.c,v 1.393.4.16 2012/12/25 03:27:28 phargrov Exp $
829 + * $Id: cr_rstrt_req.c,v 1.393.4.18 2014/09/30 02:32:47 phargrov Exp $
830   */
831  
832  #include "cr_module.h"
833 @@ -290,8 +290,12 @@
834  
835  /* Code based heavily on kernel/pid.c */
836  #include <linux/threads.h>
837 +#ifndef BITS_PER_PAGE
838  #define BITS_PER_PAGE (8*PAGE_SIZE)
839 +#endif
840 +#ifndef BITS_PER_PAGE_MASK
841  #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
842 +#endif
843  #if defined(CR_KDATA_pidmap_array)
844    #define cr_pidmap(nr)                &(pidmap_array[(nr) / BITS_PER_PAGE])
845    #define cr_pidmap_alloc()    ((void *)get_zeroed_page(GFP_KERNEL))
846 @@ -399,6 +403,9 @@
847             spin_lock_irq(&pidmap_lock);
848             upid = &pid->numbers[0];
849             hlist_add_head_rcu(&upid->pid_chain, &pid_hash[pid_hashfn(upid->nr, upid->ns)]);
850 +#if HAVE_PID_NAMESPACE_NR_HASHED
851 +           upid->ns->nr_hashed++;
852 +#endif
853             spin_unlock_irq(&pidmap_lock);
854         #endif
855         }
856 @@ -2341,7 +2348,6 @@
857      cr_pdata_t *priv;
858      cr_rstrt_req_t *req; 
859      cr_rstrt_proc_req_t *proc_req; 
860 -    cr_errbuf_t *eb;
861      cr_task_t *cr_task = NULL;
862      int retval;
863      int old_pid = -1;
864 @@ -2368,7 +2374,6 @@
865          goto out;
866      }
867  
868 -    eb = req->errbuf;
869      cr_task = lookup_task(req);
870      if (IS_ERR(cr_task)) {
871         retval = PTR_ERR(cr_task);
872 diff -Nur blcr-0.8.5/cr_module/cr_trigger.c blcr-0.8.6_b4/cr_module/cr_trigger.c
873 --- blcr-0.8.5/cr_module/cr_trigger.c   2008-12-06 00:15:19.000000000 +0100
874 +++ blcr-0.8.6_b4/cr_module/cr_trigger.c        2013-03-26 20:03:14.000000000 +0100
875 @@ -21,7 +21,7 @@
876   * along with this program; if not, write to the Free Software
877   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
878   *
879 - * $Id: cr_trigger.c,v 1.39 2008/12/05 23:15:19 phargrov Exp $
880 + * $Id: cr_trigger.c,v 1.39.6.1 2013/03/26 19:03:14 phargrov Exp $
881   */
882  
883  #include "cr_module.h"
884 @@ -96,7 +96,7 @@
885         /* Save the "stoppedness" of the task for later restore */
886         cr_task->stopped = (task->state == TASK_STOPPED);
887         if (!retval && (cr_task->stopped)) {
888 -               wake_up_process(task);
889 +               signal_wake_up(task,1);
890         }
891         cr_task->self_exec_id = task->self_exec_id;
892  out:
893 diff -Nur blcr-0.8.5/doc/html/BLCR_Admin_Guide.html blcr-0.8.6_b4/doc/html/BLCR_Admin_Guide.html
894 --- blcr-0.8.5/doc/html/BLCR_Admin_Guide.html   2013-01-29 23:32:43.000000000 +0100
895 +++ blcr-0.8.6_b4/doc/html/BLCR_Admin_Guide.html        2014-10-21 00:29:39.000000000 +0200
896 @@ -1,7 +1,7 @@
897  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
898  <html>
899  <head>
900 -  <title>BLCR Admin Guide - version 0.8.5</title>
901 +  <title>BLCR Admin Guide - version 0.8.6_b4</title>
902    <meta http-equiv="Content-Type"
903   content="text/html; charset=ISO-8859-1">
904  </head>
905 @@ -24,7 +24,7 @@
906    <li>Many "vanilla" Linux 2.6.x and 3.x.y kernels (from <a
907   href="http://www.kernel.org/">kernel.org</a>) have also been tested
908  with many glibc versions (2.2 and up).<br>
909 -We believe vanilla versions 2.6.0 through 3.7.1 all work.
910 +We believe vanilla versions 2.6.0 through 3.16.2 all work.
911    <li>BLCR uses a set of autoconf-based feature tests to probe the
912  kernels it builds against. It is thus likely that a custom kernel based
913  on one of the above kernel sources will work with BLCR, provided that
914 @@ -442,11 +442,11 @@
915  RPMs in the last few lines of output from <tt>rpmbuild</tt> - 
916  something like this:
917  </p><pre>
918 -    Wrote: /usr/src/redhat/RPMS/i686/blcr-0.8.5-1.i686.rpm
919 -    Wrote: /usr/src/redhat/RPMS/i686/blcr-libs-0.8.5-1.i686.rpm
920 -    Wrote: /usr/src/redhat/RPMS/i686/blcr-devel-0.8.5-1.i686.rpm
921 -    Wrote: /usr/src/redhat/RPMS/i686/blcr-modules_2.6.12_1.234-0.8.5-1.i686.rpm
922 -    Wrote: /usr/src/redhat/RPMS/i686/blcr-testsuite-0.8.5-1.i686.rpm
923 +    Wrote: /usr/src/redhat/RPMS/i686/blcr-0.8.6_b4-1.i686.rpm
924 +    Wrote: /usr/src/redhat/RPMS/i686/blcr-libs-0.8.6_b4-1.i686.rpm
925 +    Wrote: /usr/src/redhat/RPMS/i686/blcr-devel-0.8.6_b4-1.i686.rpm
926 +    Wrote: /usr/src/redhat/RPMS/i686/blcr-modules_2.6.12_1.234-0.8.6_b4-1.i686.rpm
927 +    Wrote: /usr/src/redhat/RPMS/i686/blcr-testsuite-0.8.6_b4-1.i686.rpm
928  </pre>
929  You should note that the kernel version <tt>2.6.12-1.234</tt> has
930  become
931 diff -Nur blcr-0.8.5/doc/html/BLCR_Users_Guide.html blcr-0.8.6_b4/doc/html/BLCR_Users_Guide.html
932 --- blcr-0.8.5/doc/html/BLCR_Users_Guide.html   2013-01-29 23:32:43.000000000 +0100
933 +++ blcr-0.8.6_b4/doc/html/BLCR_Users_Guide.html        2014-10-21 00:29:39.000000000 +0200
934 @@ -1,7 +1,7 @@
935  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
936  <html>
937  <head>
938 -  <title>Berkeley Lab Checkpoint/Restart User's Guide - version 0.8.5</title>
939 +  <title>Berkeley Lab Checkpoint/Restart User's Guide - version 0.8.6_b4</title>
940    <meta http-equiv="Content-Type"
941   content="text/html; charset=ISO-8859-1">
942  </head>
943 diff -Nur blcr-0.8.5/doc/html/FAQ.html blcr-0.8.6_b4/doc/html/FAQ.html
944 --- blcr-0.8.5/doc/html/FAQ.html        2013-01-29 23:32:43.000000000 +0100
945 +++ blcr-0.8.6_b4/doc/html/FAQ.html     2014-10-21 00:29:39.000000000 +0200
946 @@ -1,12 +1,12 @@
947  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
948  <html>
949  <head>
950 -    <title>BLCR Frequently Asked Questions (for version 0.8.5)</title>
951 +    <title>BLCR Frequently Asked Questions (for version 0.8.6_b4)</title>
952   <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
953  </head>
954  <body bgcolor="#ffffff">
955  
956 -<h1>BLCR Frequently Asked Questions (for version 0.8.5)</h1>
957 +<h1>BLCR Frequently Asked Questions (for version 0.8.6_b4)</h1>
958  
959  
960  <h3>General Questions</h3>
961 @@ -104,9 +104,9 @@
962  <blockquote>
963      BLCR runs on x86 and x86_64 (Opteron/EM64T) systems running Linux 2.6.x
964      and 3.x.y kernels.
965 -    With the 0.8.5 release, we believe the following to work:
966 +    With the 0.8.6_b4 release, we believe the following to work:
967      <ul>
968 -      <li>2.6.0 through 3.7.1 on x86 and x86_64.
969 +      <li>2.6.0 through 3.17.x on x86 and x86_64.
970      </ul>
971      <p>BLCR 0.7.0 added experimental support for PPC (32-bit), and 0.6.0 added experimental
972         support for PPC64 and ARM.  These three architectures have been tested as follows:
973 diff -Nur blcr-0.8.5/etc/blcr.rc blcr-0.8.6_b4/etc/blcr.rc
974 --- blcr-0.8.5/etc/blcr.rc      2013-01-15 04:50:01.000000000 +0100
975 +++ blcr-0.8.6_b4/etc/blcr.rc   2013-07-24 23:13:22.000000000 +0200
976 @@ -3,7 +3,19 @@
977  # chkconfig:   345 90 01
978  # description:  Load and unload BLCR kernel modules
979  #
980 -# $Id: blcr.rc,v 1.17.14.1 2013/01/15 03:50:01 phargrov Exp $
981 +# $Id: blcr.rc,v 1.17.14.2 2013/07/24 21:13:22 phargrov Exp $
982 +
983 +### BEGIN INIT INFO
984 +# Provides:          blcr
985 +# Required-Start:    
986 +# Required-Stop:     
987 +# Default-Start:     2 3 4 5
988 +# Default-Stop:      0 1 6
989 +# Short-Description: Load BLCR kernel modules
990 +# Description:       This file loads the kernel modules required for
991 +#                    Berkeley Lab Checkpoint/Restart (BCLR).
992 +#                    Visit http://ftg.lbl.gov/checkpoint for information.
993 +### END INIT INFO
994  
995  # The only likely configuration is these three variables:
996  PATH=/bin:/sbin:/usr/bin:/usr/sbin
997 @@ -35,12 +47,12 @@
998  
999  # Try modprobe by default, but fallback on insmod+fullpath
1000  do_insmod() {
1001 -       modprobe $1 || (do_checkmod $1 || insmod ${module_dir}/${1}.ko)
1002 +       (modprobe $1 >/dev/null 2>&1) || (do_checkmod $1 || insmod ${module_dir}/${1}.ko)
1003  }
1004  
1005  # Try modprobe -r by default, but fallback on rmmod
1006  do_rmmod() {
1007 -       modprobe -r $1 || (do_checkmod $1 && rmmod $1)
1008 +       (modprobe -r $1 >/dev/null 2>&1) || (do_checkmod $1 && rmmod $1)
1009  }
1010  
1011  do_start() {
1012 diff -Nur blcr-0.8.5/include/blcr_imports.h.in blcr-0.8.6_b4/include/blcr_imports.h.in
1013 --- blcr-0.8.5/include/blcr_imports.h.in        2010-08-12 23:58:34.000000000 +0200
1014 +++ blcr-0.8.6_b4/include/blcr_imports.h.in     2013-07-24 22:12:33.000000000 +0200
1015 @@ -22,7 +22,7 @@
1016   * along with this program; if not, write to the Free Software
1017   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1018   *
1019 - * $Id: blcr_imports.h.in,v 1.14.14.2 2010/08/12 21:58:34 phargrov Exp $
1020 + * $Id: blcr_imports.h.in,v 1.14.14.3 2013/07/24 20:12:33 phargrov Exp $
1021   *
1022   * This file provides otherwise missing declarations for functions
1023   * and data which BLCR imports via the blcr_imports kernel module.
1024 @@ -65,6 +65,7 @@
1025  #include <linux/dcache.h>
1026  #include <linux/namei.h>
1027  #include <linux/fs_struct.h>
1028 +#include <linux/proc_fs.h>
1029  #if HAVE_LINUX_SYSCALLS_H
1030    #include <linux/syscalls.h>
1031  #endif
1032 diff -Nur blcr-0.8.5/libcr/cr_core.c blcr-0.8.6_b4/libcr/cr_core.c
1033 --- blcr-0.8.5/libcr/cr_core.c  2009-02-18 02:23:15.000000000 +0100
1034 +++ blcr-0.8.6_b4/libcr/cr_core.c       2014-09-19 01:46:08.000000000 +0200
1035 @@ -21,7 +21,7 @@
1036   * License along with this library; if not, write to the Free Software
1037   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1038   *
1039 - * $Id: cr_core.c,v 1.206.6.2 2009/02/18 01:23:15 phargrov Exp $
1040 + * $Id: cr_core.c,v 1.206.6.3 2014/09/18 23:46:08 phargrov Exp $
1041   */
1042  
1043  #include <sys/ioctl.h>
1044 @@ -407,10 +407,9 @@
1045  #if LIBCR_TRACING
1046         int pid = (int)getpid();
1047  #endif
1048 -       int rc;
1049         info->run.index = info->cr_cb_count;
1050         LIBCR_TRACE(LIBCR_TRACE_INFO, "[%d] START", pid);
1051 -       rc = cr_checkpoint(0);
1052 +       (void) cr_checkpoint(0);
1053         LIBCR_TRACE(LIBCR_TRACE_INFO, "[%d] DONE", pid);
1054      } else if (!info->is_thread) {
1055         CRI_ABORT("STATE ERROR.  Probably an excess call to cr_leave_cs().");
1056 diff -Nur blcr-0.8.5/libcr/cr_request.c blcr-0.8.6_b4/libcr/cr_request.c
1057 --- blcr-0.8.5/libcr/cr_request.c       2009-02-14 03:55:38.000000000 +0100
1058 +++ blcr-0.8.6_b4/libcr/cr_request.c    2014-09-19 01:46:08.000000000 +0200
1059 @@ -21,7 +21,7 @@
1060   * License along with this library; if not, write to the Free Software
1061   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1062   *
1063 - * $Id: cr_request.c,v 1.222.4.1 2009/02/14 02:55:38 phargrov Exp $
1064 + * $Id: cr_request.c,v 1.222.4.2 2014/09/18 23:46:08 phargrov Exp $
1065   *
1066   * Code for clients to request checkpoints and restarts, poll and forward them.
1067   */
1068 @@ -132,10 +132,9 @@
1069  static int cri_rstrt_hndl_child_inner(void *arg) {
1070      int token = (uintptr_t)arg;
1071      int local_errno;
1072 -    int err;
1073  
1074      /* Now overlay ourselves with the new image */
1075 -    err = __cri_syscall_token(token, CR_OP_RSTRT_CHILD, CRI_SYSCALL_NOARG, &local_errno);
1076 +    (void) __cri_syscall_token(token, CR_OP_RSTRT_CHILD, CRI_SYSCALL_NOARG, &local_errno);
1077  
1078      /* Not reached unless we've encountered a fatal error.
1079       * ********** Things are hairy here **********
1080 diff -Nur blcr-0.8.5/libcr/Makefile.am blcr-0.8.6_b4/libcr/Makefile.am
1081 --- blcr-0.8.5/libcr/Makefile.am        2013-01-04 05:26:33.000000000 +0100
1082 +++ blcr-0.8.6_b4/libcr/Makefile.am     2014-10-07 01:12:45.000000000 +0200
1083 @@ -55,8 +55,9 @@
1084                         -e ' [TD] \.?_fini' \
1085                         -e ' D __data_start' \
1086                         -e ' D _edata' \
1087 -                       -e ' B __bss_start' \
1088 -                       -e ' B _end' \
1089 +                       -e ' B _{1,2}bss_start_{0,2}' \
1090 +                       -e ' B _{1,2}bss_end_{0,2}' \
1091 +                       -e ' B _{1,2}end_{0,2}' \
1092                         -e ' T _(save|rest)[gf]pr_[123][0-9](_x)?'); \
1093                 then \
1094                 echo "ERROR: libcr_run.so leaks symbol(s), above."; \
1095 diff -Nur blcr-0.8.5/libcr/Makefile.in blcr-0.8.6_b4/libcr/Makefile.in
1096 --- blcr-0.8.5/libcr/Makefile.in        2013-01-30 01:57:44.000000000 +0100
1097 +++ blcr-0.8.6_b4/libcr/Makefile.in     2014-10-21 02:15:26.000000000 +0200
1098 @@ -802,8 +802,9 @@
1099  @CR_ENABLE_SHARED_TRUE@                        -e ' [TD] \.?_fini' \
1100  @CR_ENABLE_SHARED_TRUE@                        -e ' D __data_start' \
1101  @CR_ENABLE_SHARED_TRUE@                        -e ' D _edata' \
1102 -@CR_ENABLE_SHARED_TRUE@                        -e ' B __bss_start' \
1103 -@CR_ENABLE_SHARED_TRUE@                        -e ' B _end' \
1104 +@CR_ENABLE_SHARED_TRUE@                        -e ' B _{1,2}bss_start_{0,2}' \
1105 +@CR_ENABLE_SHARED_TRUE@                        -e ' B _{1,2}bss_end_{0,2}' \
1106 +@CR_ENABLE_SHARED_TRUE@                        -e ' B _{1,2}end_{0,2}' \
1107  @CR_ENABLE_SHARED_TRUE@                        -e ' T _(save|rest)[gf]pr_[123][0-9](_x)?'); \
1108  @CR_ENABLE_SHARED_TRUE@                then \
1109  @CR_ENABLE_SHARED_TRUE@                echo "ERROR: libcr_run.so leaks symbol(s), above."; \
1110 diff -Nur blcr-0.8.5/LICENSE.txt blcr-0.8.6_b4/LICENSE.txt
1111 --- blcr-0.8.5/LICENSE.txt      2012-12-20 00:43:08.000000000 +0100
1112 +++ blcr-0.8.6_b4/LICENSE.txt   2014-09-19 02:03:15.000000000 +0200
1113 @@ -1,5 +1,5 @@
1114  Berkeley Lab Checkpoint/Restart (BLCR) for Linux is Copyright (c)
1115 -2012, The Regents of the University of California, through Lawrence
1116 +2014, The Regents of the University of California, through Lawrence
1117  Berkeley National Laboratory (subject to receipt of any required
1118  approvals from the U.S. Dept. of Energy).  All rights reserved.
1119  
1120 diff -Nur blcr-0.8.5/Makefile.in blcr-0.8.6_b4/Makefile.in
1121 --- blcr-0.8.5/Makefile.in      2013-01-30 01:57:45.000000000 +0100
1122 +++ blcr-0.8.6_b4/Makefile.in   2014-10-21 02:15:27.000000000 +0200
1123 @@ -664,7 +664,7 @@
1124         *.zip*) \
1125           unzip $(distdir).zip ;;\
1126         esac
1127 -       chmod -R a-w $(distdir); chmod a+w $(distdir)
1128 +       chmod -R a-w $(distdir); chmod u+w $(distdir)
1129         mkdir $(distdir)/_build
1130         mkdir $(distdir)/_inst
1131         chmod a-w $(distdir)
1132 diff -Nur blcr-0.8.5/NEWS blcr-0.8.6_b4/NEWS
1133 --- blcr-0.8.5/NEWS     2013-01-30 01:57:30.000000000 +0100
1134 +++ blcr-0.8.6_b4/NEWS  2014-10-21 00:29:37.000000000 +0200
1135 @@ -1,6 +1,58 @@
1136  This file lists the significant user-visible changes between releases
1137  of BLCR, including main features and bug fixes.
1138  
1139 +0.8.6_b4
1140 +-----------
1141 +October 20, 2014
1142 +Bug fix and expanded-support release.
1143 + - Relative to the previous Beta:
1144 +   + Can now parse Debian Jessie kernel naming (3.x-y vs 3.x.y).
1145 +     Hopefully for real this time!
1146 +   + Correct operation confirmed with 3.17.x kernels
1147 + - Testing is now "sufficient" for release.
1148 +
1149 +0.8.6_b3
1150 +-----------
1151 +October 6, 2014
1152 +Bug fix and expanded-support release.
1153 + - Relative to the previous Beta:
1154 +   + Fix compilation problems with recent ARM kernels
1155 +   + A couple minor bug fixes
1156 +   + Can now parse Debian Jessie kernel naming (3.x-y vs 3.x.y).
1157 +   + autogen.sh now supports recent automake versions
1158 + - Testing on x86, x86-64, ppc and ppc64 now "sufficient" for release.
1159 +
1160 +0.8.6_b2
1161 +-----------
1162 +September 29, 2014
1163 +Bug fix and expanded-support release.
1164 + - Relative to the previous Beta:
1165 +   + Fix compilation problems with recent PPC/PPC64 kernels
1166 + - Testing on CPUs other than x86-64 remains "thin".
1167 + - The issue with Debian Jessie kernel naming remains UNresolved.
1168 +
1169 +0.8.6_b1
1170 +-----------
1171 +September 19, 2014
1172 +Bug fix and expanded-support release.
1173 + - This release adds support for "vanilla" Linux kernels up to 3.16,
1174 +   and has been tested with x86-64 3.x kernels from several popular
1175 +   distributions.
1176 + - Testing on other CPUs will precede release of the final 0.8.6.
1177 + - This release fixes the following user-visible bugs and "issues"
1178 +   + Fix bug 3142 - stopped.st timeout on many recent kernels
1179 +     The problem would manifest as a failure of the stopped.st test
1180 +     in "make check" on kernels containing the fix for CVE-2013-0871.
1181 +   + Fix bug 2620 - /proc/PID/exe not restored on restart
1182 +     The fix has been known since Dec 2009, but had unintentionally
1183 +     never been applied to the 0.8.x release branch.
1184 +   + Fix support that was broken by recent "RHEL6" kernels (such as
1185 +     2.6.32-431.23.3.el6.x86_64).
1186 +   + Fix possible deadlock in pid-restore code
1187 + - This release is known NOT to work with Debian Jessie kernels due
1188 +   to their kernel naming scheme (3.x-y) which BLCR's configure logic
1189 +   does not recognize.  This should be fixed in the final 0.8.6.
1190 +
1191  0.8.5
1192  -----------
1193  January 29, 2013
1194 diff -Nur blcr-0.8.5/rpm/specfile.in blcr-0.8.6_b4/rpm/specfile.in
1195 --- blcr-0.8.5/rpm/specfile.in  2012-12-21 21:32:42.000000000 +0100
1196 +++ blcr-0.8.6_b4/rpm/specfile.in       2013-07-24 23:21:13.000000000 +0200
1197 @@ -179,13 +179,21 @@
1198  
1199  %post
1200  if [ $1 = 1 ]; then
1201 + if [ -x /usr/lib/lsb/install_initd ]; then
1202 +  /usr/lib/lsb/install_initd /etc/init.d/blcr
1203 + else
1204    /sbin/chkconfig --add blcr
1205 + fi
1206  fi
1207  exit 0
1208  
1209  %preun
1210  if [ $1 = 0 ]; then
1211 + if [ -x /usr/lib/lsb/remove_initd ]; then
1212 +  /usr/lib/lsb/remove_initd /etc/init.d/blcr
1213 + else
1214    /sbin/chkconfig --del blcr
1215 + fi
1216  fi
1217  exit 0
1218  
1219 diff -Nur blcr-0.8.5/tests/crut_wrapper.c blcr-0.8.6_b4/tests/crut_wrapper.c
1220 --- blcr-0.8.5/tests/crut_wrapper.c     2009-03-12 21:07:38.000000000 +0100
1221 +++ blcr-0.8.6_b4/tests/crut_wrapper.c  2014-10-07 01:12:46.000000000 +0200
1222 @@ -21,7 +21,7 @@
1223   * along with this program; if not, write to the Free Software
1224   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1225   *
1226 - * $Id: crut_wrapper.c,v 1.16.4.1 2009/03/12 20:07:38 phargrov Exp $
1227 + * $Id: crut_wrapper.c,v 1.16.4.2 2014/10/06 23:12:46 phargrov Exp $
1228   *
1229   * Runs a crut-style test.
1230   *
1231 @@ -222,7 +222,7 @@
1232         rc = waitpid(pid, &status, 0);
1233         timeout = 1 + alarm(0);
1234         if ((rc < 0) && expired) goto timeout;
1235 -    } while ((rc < 0) && (errno = EINTR));
1236 +    } while ((rc < 0) && (errno == EINTR));
1237  
1238      while (!kill(-pid, 0)) {
1239         if (! --timeout) goto timeout;
1240 @@ -365,7 +365,7 @@
1241  
1242      do {
1243         rc = waitpid(pid, &status, 0);
1244 -    } while ((rc < 0) && (errno = EINTR));
1245 +    } while ((rc < 0) && (errno == EINTR));
1246      if (rc < 0) {
1247         die("waitpid(restart_cmd) failed: %s", cr_strerror(errno));
1248      } else if (status) {
1249 diff -Nur blcr-0.8.5/tests/dlopen_aux.c blcr-0.8.6_b4/tests/dlopen_aux.c
1250 --- blcr-0.8.5/tests/dlopen_aux.c       2008-05-20 02:44:57.000000000 +0200
1251 +++ blcr-0.8.6_b4/tests/dlopen_aux.c    2013-03-26 02:11:57.000000000 +0100
1252 @@ -1,3 +1,29 @@
1253 +/*
1254 + * Berkeley Lab Checkpoint/Restart (BLCR) for Linux is Copyright (c)
1255 + * 2009, The Regents of the University of California, through Lawrence
1256 + * Berkeley National Laboratory (subject to receipt of any required
1257 + * approvals from the U.S. Dept. of Energy).  All rights reserved.
1258 + *
1259 + * Portions may be copyrighted by others, as may be noted in specific
1260 + * copyright notices within specific files.
1261 + *
1262 + * This program is free software; you can redistribute it and/or modify
1263 + * it under the terms of the GNU General Public License as published by
1264 + * the Free Software Foundation; either version 2 of the License, or
1265 + * (at your option) any later version.
1266 + *
1267 + * This program is distributed in the hope that it will be useful,
1268 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1269 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1270 + * GNU General Public License for more details.
1271 + *
1272 + * You should have received a copy of the GNU General Public License
1273 + * along with this program; if not, write to the Free Software
1274 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1275 + *
1276 + * $Id: dlopen_aux.c,v 1.1.30.1 2013/03/26 01:11:57 phargrov Exp $
1277 + */
1278 +
1279  #define _GNU_SOURCE 1 // For RTLD_DEFAULT
1280  #include <stdio.h>
1281  #include <errno.h>
1282 @@ -9,8 +35,14 @@
1283  
1284  #include "libcr.h"
1285  
1286 +#ifndef _STRINGIFY
1287 +  #define _STRINGIFY_HELPER(x) #x
1288 +  #define _STRINGIFY(x) _STRINGIFY_HELPER(x)
1289 +#endif
1290 +
1291  int main(void)
1292  {
1293 +    char filename[] = "libcr.so." _STRINGIFY(LIBCR_MAJOR);
1294      cr_client_id_t (*my_cr_init)(void);
1295      void *self_handle = dlopen(NULL, RTLD_LAZY);
1296      void *libcr_handle;
1297 @@ -28,9 +60,9 @@
1298         exit(1);
1299      }
1300  
1301 -    libcr_handle = dlopen("libcr.so", RTLD_NOW);
1302 +    libcr_handle = dlopen(filename, RTLD_NOW);
1303      if (libcr_handle == NULL) {
1304 -       fprintf(stderr, "dlopen(libcr.so) failed unexpectedly.  Bad LD_LIBRARY_PATH?\n");
1305 +       fprintf(stderr, "dlopen(%s) failed unexpectedly.  Bad LD_LIBRARY_PATH?\n", filename);
1306         exit(1);
1307      }
1308  
1309 diff -Nur blcr-0.8.5/tests/emacslisp_test.sh blcr-0.8.6_b4/tests/emacslisp_test.sh
1310 --- blcr-0.8.5/tests/emacslisp_test.sh  2008-04-27 23:26:39.000000000 +0200
1311 +++ blcr-0.8.6_b4/tests/emacslisp_test.sh       2014-09-19 01:46:09.000000000 +0200
1312 @@ -8,7 +8,7 @@
1313  \rm -f Context[123] .Context[123].tmp 2>/dev/null
1314  exec 2>/dev/null # To drop job control messages
1315  echo '#ST_ALARM:120'
1316 -$cr_run emacs -nw -q -batch \
1317 +$cr_run_lb emacs -nw -q -batch \
1318   -eval '(defun greet (n)
1319                 (princ (format "%d Hello\n" n))
1320                 (sleep-for 1)
1321 @@ -43,7 +43,7 @@
1322  echo "# Restart^2"
1323  $cr_restart Context2 2>&1 &
1324  wait
1325 -echo "# Restart interpreter" # Note entire emacs output still might be bufferd
1326 +echo "# Restart interpreter"
1327  sleep 2
1328  $cr_restart Context3 2>&1
1329  \rm -f Context[123] .Context[123].tmp 2>/dev/null
1330 diff -Nur blcr-0.8.5/tests/Makefile.am blcr-0.8.6_b4/tests/Makefile.am
1331 --- blcr-0.8.5/tests/Makefile.am        2011-08-03 21:24:29.000000000 +0200
1332 +++ blcr-0.8.6_b4/tests/Makefile.am     2014-09-19 01:46:09.000000000 +0200
1333 @@ -1,3 +1,8 @@
1334 +# Uncomment the following if your automake defaults to parallel tests.
1335 +# You'll know becuase your build will fail with output like:
1336 +#   Makefile:1923: *** unterminated variable reference.  Stop.
1337 +#AUTOMAKE_OPTIONS = serial-tests
1338 +
1339  # Special target (run before tests) ensures the kernel modules are loaded
1340  check_module:
1341         @(/sbin/lsmod | grep '^blcr ' > /dev/null 2>&1) || \
1342 diff -Nur blcr-0.8.5/tests/RUN_ME.in blcr-0.8.6_b4/tests/RUN_ME.in
1343 --- blcr-0.8.5/tests/RUN_ME.in  2011-08-03 21:24:29.000000000 +0200
1344 +++ blcr-0.8.6_b4/tests/RUN_ME.in       2013-03-25 21:13:25.000000000 +0100
1345 @@ -33,7 +33,7 @@
1346    echo   '#### BLCR modules are not loaded.  Cannot run the tests! ####'
1347    echo   '#### You must insmod/modprobe the following modules as   ####'
1348    echo   '#### root (in order) before you can run the test suite.  ####'
1349 -  echo   '####    blcr_imports   blcr_vmadump   blcr               ####'
1350 +  echo   '####    blcr_imports   blcr                              ####'
1351    echo   '#############################################################'
1352    exit 1
1353  fi
1354 diff -Nur blcr-0.8.5/tests/shellinit.in blcr-0.8.6_b4/tests/shellinit.in
1355 --- blcr-0.8.5/tests/shellinit.in       2008-05-23 03:30:56.000000000 +0200
1356 +++ blcr-0.8.6_b4/tests/shellinit.in    2014-09-19 01:46:10.000000000 +0200
1357 @@ -26,6 +26,10 @@
1358  @CR_ENABLE_SHARED_TRUE@cr_run=${cr_run:-${cr_bindir}/cr_run}
1359  @CR_ENABLE_SHARED_FALSE@cr_run=env
1360  export cr_run
1361 +# cr_run which additionally attempts to force line buffered stdout.
1362 +# This is needed for some SEQ tests.
1363 +cr_run_lb="$cr_run"
1364 +if (stdbuf -oL true >/dev/null 2>&1); then cr_run_lb="$cr_run stdbuf -oL"; fi
1365  #
1366  cr_checkpoint=${cr_checkpoint:-${cr_bindir}/cr_checkpoint}
1367  export cr_checkpoint
1368 diff -Nur blcr-0.8.5/vmadump4/vmadump_arm.c blcr-0.8.6_b4/vmadump4/vmadump_arm.c
1369 --- blcr-0.8.5/vmadump4/vmadump_arm.c   2012-12-22 20:14:36.000000000 +0100
1370 +++ blcr-0.8.6_b4/vmadump4/vmadump_arm.c        2014-10-07 01:12:47.000000000 +0200
1371 @@ -17,7 +17,7 @@
1372   *  along with this program; if not, write to the Free Software
1373   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1374   *
1375 - * $Id: vmadump_arm.c,v 1.8.16.5 2012/12/22 19:14:36 phargrov Exp $
1376 + * $Id: vmadump_arm.c,v 1.8.16.6 2014/10/06 23:12:47 phargrov Exp $
1377   *
1378   *  Experimental ARM support contributed by Anton V. Uzunov
1379   *  <anton.uzunov@dsto.defence.gov.au> of the Australian Government
1380 @@ -88,12 +88,13 @@
1381  
1382  #if HAVE_THREAD_INFO_TP_VALUE
1383    // Store thread-specific pointer
1384 + #if HAVE_THREAD_INFO_TP_VALUE_ARRAY
1385 +  thread->tp_value[1] = get_tpuser();
1386 + #endif
1387    r = write_kern(ctx, file, &thread->tp_value,
1388                   sizeof(thread->tp_value));
1389    if (r != sizeof(thread->tp_value)) goto err;
1390    bytes += r;
1391 -  VMAD_DEBUG( "vmadump: thread->tp_value == %ld",
1392 -              thread->tp_value );
1393  #endif
1394  
1395    return( bytes );
1396 @@ -145,13 +146,20 @@
1397    r = read_kern(ctx, file, &thread->tp_value,
1398                   sizeof(thread->tp_value));
1399    if (r != sizeof(thread->tp_value)) goto bad_read;
1400 -  VMAD_DEBUG( "vmadump: thread->tp_value == %ld",
1401 -              thread->tp_value );
1402 - #if defined(has_tls_reg)
1403 + #if defined(has_tls_reg) && HAVE_THREAD_INFO_TP_VALUE_ARRAY
1404    /* Since 2.6.36 tls_emu and had_tls_reg are macros w/ value 0 or 1 */
1405    if (tls_emu) {
1406      /* Do nothing */
1407    } else if (has_tls_reg) {
1408 +    asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (thread->tp_value[0]) );
1409 +    asm ("mcr p15, 0, %0, c13, c0, 2" : : "r" (thread->tp_value[1]) );
1410 +  } else { // Note: must be (much) later than 2.6.12
1411 +    *((unsigned int *)0xffff0ff0) = (thread->tp_value[0]);
1412 +  }
1413 + #elif defined(has_tls_reg)
1414 +  if (tls_emu) {
1415 +    /* Do nothing */
1416 +  } else if (has_tls_reg) {
1417      asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (thread->tp_value) );
1418    } else { // Note: must be (much) later than 2.6.12
1419      *((unsigned int *)0xffff0ff0) = (thread->tp_value);
1420 @@ -178,9 +186,20 @@
1421  
1422  #if defined(ARCH_HAS_SETUP_ADDITIONAL_PAGES)
1423  
1424 +#ifndef CONFIG_VECTORS_BASE
1425 +  #define CONFIG_VECTORS_BASE 0xffff0000
1426 +#endif
1427 +
1428 +#if HAVE_MM_CONTEXT_SIGPAGE
1429 +  #define VMAD_SIGPAGE(_task) ((_task)->mm->context.sigpage)
1430 +#else
1431 +  #define VMAD_SIGPAGE(_task) 0
1432 +#endif
1433 +
1434  int vmad_is_arch_map(const struct vm_area_struct *map)
1435  {
1436 -       return (map->vm_start == 0xffff0000);
1437 +       return (map->vm_start == CONFIG_VECTORS_BASE) ||
1438 +              (map->vm_start == VMAD_SIGPAGE(current));
1439  }
1440  EXPORT_SYMBOL_GPL(vmad_is_arch_map);
1441  
1442 @@ -196,7 +215,7 @@
1443         head.end     = map->vm_end;
1444         head.flags   = map->vm_flags;
1445         head.namelen = VMAD_NAMELEN_ARCH;
1446 -       head.pgoff   = 0;
1447 +       head.pgoff   = VMAD_SIGPAGE(current);
1448  
1449         up_read(&current->mm->mmap_sem);
1450         r = write_kern(ctx, file, &head, sizeof(head));
1451 @@ -217,11 +236,9 @@
1452  
1453      /* First check if the mapping is still/already in place */
1454      down_read(&current->mm->mmap_sem);
1455 -    map = find_vma(current->mm, 0xffff0000);
1456 +    map = find_vma(current->mm, CONFIG_VECTORS_BASE);
1457      up_read(&current->mm->mmap_sem);
1458      if (map != NULL) goto out;
1459 -    
1460 -    /* NOT REACHED - since in practice we'll never remove the mapping. */
1461  
1462    #if HAVE_2_ARG_ARCH_SETUP_ADDITIONAL_PAGES
1463      r = arch_setup_additional_pages(NULL, 0);
1464 @@ -235,6 +252,18 @@
1465         goto err;
1466      }
1467  
1468 +  #if HAVE_MM_CONTEXT_SIGPAGE
1469 +    // TODO: Can we fixup the boot-time randomization in [sigpage]?
1470 +    if (head->pgoff && VMAD_SIGPAGE(current) != head->pgoff) {
1471 +        r = vmad_remap(ctx, VMAD_SIGPAGE(current), head->pgoff, PAGE_SIZE);
1472 +       if (r < 0) {
1473 +           CR_ERR_CTX(ctx, "sigpage remap failed %d", (int)r); 
1474 +           goto err;
1475 +       }
1476 +       VMAD_SIGPAGE(current) = head->pgoff;
1477 +    }
1478 +  #endif
1479 +
1480  out:
1481      r = 0;
1482  err:
1483 diff -Nur blcr-0.8.5/vmadump4/vmadump_common.c blcr-0.8.6_b4/vmadump4/vmadump_common.c
1484 --- blcr-0.8.5/vmadump4/vmadump_common.c        2013-01-29 21:17:11.000000000 +0100
1485 +++ blcr-0.8.6_b4/vmadump4/vmadump_common.c     2014-09-19 01:46:11.000000000 +0200
1486 @@ -17,7 +17,7 @@
1487   *  along with this program; if not, write to the Free Software
1488   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1489   *
1490 - * $Id: vmadump_common.c,v 1.86.4.14 2013/01/29 20:17:11 phargrov Exp $
1491 + * $Id: vmadump_common.c,v 1.86.4.17 2014/09/18 23:46:11 phargrov Exp $
1492   *
1493   * THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1494   *-----------------------------------------------------------------------*/
1495 @@ -565,10 +565,12 @@
1496          !filp->f_mapping->a_ops->direct_IO)
1497          goto out;
1498    #elif HAVE_INODE_I_MAPPING
1499 +  {
1500      struct inode *inode = filp->f_dentry->d_inode;
1501      if (!inode->i_mapping || !inode->i_mapping->a_ops ||
1502          !inode->i_mapping->a_ops->direct_IO)
1503          goto out;
1504 +  }
1505    #else
1506      #error
1507    #endif
1508 @@ -718,6 +720,7 @@
1509      long mapaddr;
1510      int open_flags;
1511      unsigned long prot;
1512 +    unsigned long start, end, pgoff;
1513  
1514      if (head->flags & VM_MAYSHARE) {
1515         if (head->flags & VM_MAYWRITE) {
1516 @@ -746,16 +749,27 @@
1517         return PTR_ERR(file);
1518      }
1519  
1520 +    start = head->start;
1521 +    end   = head->end;
1522 +    pgoff = head->pgoff;
1523 +
1524      down_write(&current->mm->mmap_sem);
1525 -    mapaddr = cr_mmap_pgoff(file, head->start, head->end - head->start,
1526 -                           prot, flags, head->pgoff);
1527 +    if (start & VMAD_VM_EXECUTABLE) {
1528 +       start ^= VMAD_VM_EXECUTABLE;
1529 +#if defined(CR_KCODE_set_mm_exe_file)
1530 +       if (!current->mm->exe_file)
1531 +           set_mm_exe_file(current->mm, file);
1532 +#endif
1533 +    }
1534 +    mapaddr = cr_mmap_pgoff(file, start, end - start,
1535 +                           prot, flags, pgoff);
1536      up_write(&current->mm->mmap_sem);
1537      fput(file);
1538 -    if (mapaddr != head->start)
1539 +    if (mapaddr != start)
1540         CR_ERR_CTX(ctx, "mmap(<file>, %p, %p, ...) failed: %p",
1541 -              (void *) head->start, (void *) (head->end-head->start),
1542 +              (void *) start, (void *) (end-start),
1543                (void *) mapaddr);
1544 -    return (mapaddr == head->start) ? 0 : mapaddr;
1545 +    return (mapaddr == start) ? 0 : mapaddr;
1546  }
1547  
1548  /* Reads in the header giving the the number of bytes of "fill" to
1549 @@ -893,6 +907,9 @@
1550      long r;
1551      unsigned long mmap_prot, mmap_flags, addr;
1552  
1553 +    const unsigned long start = head->start & ~VMAD_VM_EXECUTABLE;
1554 +    const unsigned long len = head->end - start; 
1555 +
1556      if (head->namelen == VMAD_NAMELEN_ARCH) {
1557  #if VMAD_HAVE_ARCH_MAPS
1558         return vmad_load_arch_map(ctx, file, head);
1559 @@ -941,13 +958,13 @@
1560      } else {
1561         /* Load the data from the dump file */
1562         down_write(&current->mm->mmap_sem);
1563 -       addr = cr_mmap_pgoff(0, head->start, head->end - head->start,
1564 +       addr = cr_mmap_pgoff(0, start, len,
1565                              mmap_prot|PROT_WRITE, mmap_flags, 0);
1566         up_write(&current->mm->mmap_sem);
1567 -       if (addr != head->start) {
1568 +       if (addr != start) {
1569             CR_ERR_CTX(ctx, "mmap(0, %08lx, %08lx, ...) = 0x%08lx (failed)",
1570 -                  head->start, head->end - head->start, addr);
1571 -            if ((addr != head->start) && IS_ERR((void *) addr)) {
1572 +                  start, len, addr);
1573 +            if ((addr != start) && IS_ERR((void *) addr)) {
1574                  r = PTR_ERR((void *) addr);
1575              } else {
1576                  r = -EINVAL;
1577 @@ -961,7 +978,7 @@
1578      r = vmadump_load_page_list(ctx, file, (mmap_prot & PROT_EXEC));
1579      if (r) goto err;
1580  
1581 -    if (sys_mprotect(head->start,head->end - head->start, mmap_prot))
1582 +    if (sys_mprotect(start, len, mmap_prot))
1583         CR_ERR_CTX(ctx, "thaw: mprotect failed. (ignoring)");
1584      return 0;
1585  
1586 @@ -1304,16 +1321,25 @@
1587  #if defined(CR_KCODE_arch_pick_mmap_layout)
1588      arch_pick_mmap_layout(mm);
1589  #endif
1590 -#if HAVE_MM_MMAP_BASE
1591 +
1592      /* want to restore these even if arch_pick_mmap_layout() set them */
1593 +#if HAVE_MM_MMAP_BASE
1594      mm->mmap_base = mmap_base;
1595 +#endif
1596 +#if HAVE_MM_FREE_AREA_CACHE
1597 +#  if HAVE_MM_MMAP_BASE
1598      mm->free_area_cache = mmap_base;
1599 -#else
1600 +#  else
1601      mm->free_area_cache = TASK_UNMAPPED_BASE;
1602 +#  endif
1603  #endif
1604  #if HAVE_MM_CACHED_HOLE_SIZE
1605      mm->cached_hole_size = ~0UL;
1606  #endif
1607 +
1608 +#if defined(CR_KCODE_set_mm_exe_file)
1609 +    set_mm_exe_file(current->mm, NULL);
1610 +#endif
1611      up_write(&current->mm->mmap_sem);
1612  
1613      /* Load new map data */
1614 @@ -1805,6 +1831,7 @@
1615             /* Region is an executable */
1616             if (flags & VMAD_DUMP_EXEC)
1617                 head.namelen = 0;
1618 +           head.start |= VMAD_VM_EXECUTABLE;
1619         } else if (is_library(filename)) {
1620             /* Region is a library */
1621             if (flags & VMAD_DUMP_LIBS)
1622 diff -Nur blcr-0.8.5/vmadump4/vmadump.h blcr-0.8.6_b4/vmadump4/vmadump.h
1623 --- blcr-0.8.5/vmadump4/vmadump.h       2012-12-18 19:32:09.000000000 +0100
1624 +++ blcr-0.8.6_b4/vmadump4/vmadump.h    2013-07-24 22:12:34.000000000 +0200
1625 @@ -17,7 +17,7 @@
1626   *  along with this program; if not, write to the Free Software
1627   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1628   *
1629 - * $Id: vmadump.h,v 1.47.4.2 2012/12/18 18:32:09 phargrov Exp $
1630 + * $Id: vmadump.h,v 1.47.4.3 2013/07/24 20:12:34 phargrov Exp $
1631   *
1632   *  THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1633   *-----------------------------------------------------------------------*/
1634 @@ -42,6 +42,9 @@
1635      unsigned long  pgoff;      /* file offset for mmap, in page units */
1636  };
1637  
1638 +/* Flag(s) ORed into start field of struct vmadump_vma_header: */
1639 +#define VMAD_VM_EXECUTABLE 1UL
1640 +
1641  struct vmadump_page_header {
1642      unsigned long start;       /* ~0 = end of list */
1643      unsigned int num_pages;
1644 diff -Nur blcr-0.8.5/vmadump4/vmadump_i386.c blcr-0.8.6_b4/vmadump4/vmadump_i386.c
1645 --- blcr-0.8.5/vmadump4/vmadump_i386.c  2012-12-22 08:42:52.000000000 +0100
1646 +++ blcr-0.8.6_b4/vmadump4/vmadump_i386.c       2014-09-19 01:46:11.000000000 +0200
1647 @@ -17,7 +17,7 @@
1648   *  along with this program; if not, write to the Free Software
1649   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1650   *
1651 - * $Id: vmadump_i386.c,v 1.38.8.4 2012/12/22 07:42:52 phargrov Exp $
1652 + * $Id: vmadump_i386.c,v 1.38.8.5 2014/09/18 23:46:11 phargrov Exp $
1653   *
1654   * THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1655   *-----------------------------------------------------------------------*/
1656 @@ -303,6 +303,7 @@
1657  
1658  int vmad_is_arch_map(const struct vm_area_struct *map)
1659  {
1660 +       if (vmad_is_vvar_map((struct vm_area_struct *)map)) return 1;
1661         return (map->vm_start == (unsigned long)vmad_vdso_base);
1662  }
1663  EXPORT_SYMBOL_GPL(vmad_is_arch_map);
1664 @@ -312,6 +313,8 @@
1665  {
1666      loff_t r = 0;
1667  
1668 +    if (vmad_is_vvar_map(map)) return 0;
1669 +
1670      if (vmad_is_arch_map(map)) {
1671         /* Just write out a section header */
1672          struct vmadump_vma_header head;
1673 @@ -373,6 +376,15 @@
1674          * Since no failure was indicatated we just fill it in below.
1675          */
1676      } else if (vmad_vdso_base != (void *)head->start) {
1677 +    #if HAVE_VM_OPS_NAME
1678 +       /* Relocate vvar map if present immediately above or below vdso */
1679 +        r = vmad_reloc_vvar(ctx, (unsigned long)vmad_vdso_base, head);
1680 +       if (r) {
1681 +           CR_ERR_CTX(ctx, "vvar remap failed %d", (int)r);
1682 +           goto err;
1683 +       }
1684 +    #endif
1685 +
1686         r = vmad_remap(ctx, (unsigned long)vmad_vdso_base, head->start, head->end - head->start);
1687         if (r) {
1688             CR_ERR_CTX(ctx, "vdso remap failed %d", (int)r);
1689 diff -Nur blcr-0.8.5/vmadump4/vmadump_ppc64.c blcr-0.8.6_b4/vmadump4/vmadump_ppc64.c
1690 --- blcr-0.8.5/vmadump4/vmadump_ppc64.c 2012-12-22 08:42:52.000000000 +0100
1691 +++ blcr-0.8.6_b4/vmadump4/vmadump_ppc64.c      2014-09-30 04:32:49.000000000 +0200
1692 @@ -17,7 +17,7 @@
1693   *  along with this program; if not, write to the Free Software
1694   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1695   *
1696 - * $Id: vmadump_ppc64.c,v 1.9.14.4 2012/12/22 07:42:52 phargrov Exp $
1697 + * $Id: vmadump_ppc64.c,v 1.9.14.5 2014/09/30 02:32:49 phargrov Exp $
1698   *
1699   * THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1700   *-----------------------------------------------------------------------*/
1701 @@ -33,6 +33,15 @@
1702  #  include <asm/switch_to.h>
1703  #endif
1704  
1705 +#if HAVE_THREAD_FP_STATE
1706 +  #define thread_fp_save_area(_thread) \
1707 +       ((_thread).fp_save_area ? (_thread).fp_save_area : &(_thread).fp_state)
1708 +#endif
1709 +#if HAVE_THREAD_VR_STATE
1710 +  #define thread_vr_save_area(_thread) \
1711 +       ((_thread).vr_save_area ? (_thread).vr_save_area : &(_thread).vr_state)
1712 +#endif
1713 +
1714  long vmadump_store_cpu(cr_chkpt_proc_req_t *ctx, struct file *file,
1715                        struct pt_regs *regs) {
1716      long bytes = 0, r;
1717 @@ -45,6 +54,7 @@
1718      /* Floating point regs */
1719      if (regs->msr & MSR_FP)
1720         giveup_fpu(current);
1721 +#if HAVE_THREAD_FPR
1722      r = write_kern(ctx, file, &current->thread.fpr,
1723                    sizeof(current->thread.fpr));
1724      if (r != sizeof(current->thread.fpr)) goto err;
1725 @@ -54,6 +64,14 @@
1726                    sizeof(current->thread.fpscr));
1727      if (r != sizeof(current->thread.fpscr)) goto err;
1728      bytes += r;
1729 +#elif HAVE_THREAD_FP_STATE
1730 +    r = write_kern(ctx, file, thread_fp_save_area(current->thread),
1731 +                  sizeof(current->thread.fp_state));
1732 +    if (r != sizeof(current->thread.fp_state)) goto err;
1733 +    bytes += r;
1734 +#else
1735 +    #error Unknown PPC floating point state
1736 +#endif
1737  
1738  #if HAVE_THREAD_VDSO_BASE
1739      /* unconditionally store the base of the VDSO library */
1740 @@ -67,6 +85,7 @@
1741      /* XXX I really need to find out if this is right */
1742      if (regs->msr & MSR_VEC)
1743         giveup_altivec(current);
1744 +  #if HAVE_THREAD_VR
1745      r = write_kern(ctx, file, &current->thread.vr,
1746                    sizeof(current->thread.vr));
1747      if (r != sizeof(current->thread.vr)) goto err;
1748 @@ -76,7 +95,24 @@
1749                    sizeof(current->thread.vscr));
1750      if (r != sizeof(current->thread.vscr)) goto err;
1751      bytes += r;
1752 +  #elif HAVE_THREAD_VR_STATE
1753 +    r = write_kern(ctx, file, thread_vr_save_area(current->thread),
1754 +                  sizeof(current->thread.vr_state));
1755 +    if (r != sizeof(current->thread.vr_state)) goto err;
1756 +    bytes += r;
1757 +  #else
1758 +    #error Unknown PPC vector register state
1759 +  #endif
1760 +#endif
1761 +
1762 +#ifdef CONFIG_VSX
1763 +    /* TODO: VSX state */
1764  #endif
1765 +
1766 +#ifdef CONFIG_SPE
1767 +    /* TODO: SPE state */
1768 +#endif
1769 +
1770      return bytes;
1771  
1772   err:
1773 @@ -105,6 +141,7 @@
1774      memcpy(regs, &regtmp, sizeof(regtmp));
1775  
1776      /* Floating point regs */
1777 +#if HAVE_THREAD_FPR
1778      r = read_kern(ctx, file, &current->thread.fpr,
1779                   sizeof(current->thread.fpr));
1780      if (r != sizeof(current->thread.fpr)) goto bad_read;
1781 @@ -112,6 +149,11 @@
1782      r = read_kern(ctx, file, &current->thread.fpscr,
1783                   sizeof(current->thread.fpscr));
1784      if (r != sizeof(current->thread.fpscr)) goto bad_read;
1785 +#elif HAVE_THREAD_FP_STATE
1786 +    r = read_kern(ctx, file, thread_fp_save_area(current->thread),
1787 +                 sizeof(current->thread.fp_state));
1788 +    if (r != sizeof(current->thread.fp_state)) goto bad_read;
1789 +#endif
1790  
1791  #if HAVE_THREAD_VDSO_BASE
1792      /* unconditonally restore this */
1793 @@ -122,6 +164,7 @@
1794  
1795  #ifdef CONFIG_ALTIVEC
1796      /* Restore Altivec */
1797 +  #if HAVE_THREAD_VR
1798      r = read_kern(ctx, file, &current->thread.vr,
1799                   sizeof(current->thread.vr));
1800      if (r != sizeof(current->thread.vr)) goto bad_read;
1801 @@ -129,6 +172,19 @@
1802      r = read_kern(ctx, file, &current->thread.vscr,
1803                   sizeof(current->thread.vscr));
1804      if (r != sizeof(current->thread.vscr)) goto bad_read;
1805 +  #elif HAVE_THREAD_VR_STATE
1806 +    r = read_kern(ctx, file, thread_vr_save_area(current->thread),
1807 +                 sizeof(current->thread.vr_state));
1808 +    if (r != sizeof(current->thread.vr_state)) goto bad_read;
1809 +  #endif
1810 +#endif
1811 +
1812 +#ifdef CONFIG_VSX
1813 +    /* TODO: VSX state */
1814 +#endif
1815 +
1816 +#ifdef CONFIG_SPE
1817 +    /* TODO: SPE state */
1818  #endif
1819  
1820      current->thread.regs = regs;
1821 diff -Nur blcr-0.8.5/vmadump4/vmadump_ppc.c blcr-0.8.6_b4/vmadump4/vmadump_ppc.c
1822 --- blcr-0.8.5/vmadump4/vmadump_ppc.c   2012-12-22 08:42:52.000000000 +0100
1823 +++ blcr-0.8.6_b4/vmadump4/vmadump_ppc.c        2014-09-30 04:32:49.000000000 +0200
1824 @@ -17,7 +17,7 @@
1825   *  along with this program; if not, write to the Free Software
1826   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1827   *
1828 - * $Id: vmadump_ppc.c,v 1.10.14.4 2012/12/22 07:42:52 phargrov Exp $
1829 + * $Id: vmadump_ppc.c,v 1.10.14.5 2014/09/30 02:32:49 phargrov Exp $
1830   *
1831   * THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1832   *-----------------------------------------------------------------------*/
1833 @@ -32,6 +32,15 @@
1834  #  include <asm/switch_to.h>
1835  #endif
1836  
1837 +#if HAVE_THREAD_FP_STATE
1838 +  #define thread_fp_save_area(_thread) \
1839 +       ((_thread).fp_save_area ? (_thread).fp_save_area : &(_thread).fp_state)
1840 +#endif
1841 +#if HAVE_THREAD_VR_STATE
1842 +  #define thread_vr_save_area(_thread) \
1843 +       ((_thread).vr_save_area ? (_thread).vr_save_area : &(_thread).vr_state)
1844 +#endif
1845 +
1846  long vmadump_store_cpu(cr_chkpt_proc_req_t *ctx, struct file *file,
1847                        struct pt_regs *regs) {
1848      long bytes = 0, r;
1849 @@ -44,6 +53,7 @@
1850      /* Floating point regs */
1851      if (regs->msr & MSR_FP)
1852         giveup_fpu(current);
1853 +#if HAVE_THREAD_FPR
1854      r = write_kern(ctx, file, &current->thread.fpr,
1855                    sizeof(current->thread.fpr));
1856      if (r != sizeof(current->thread.fpr)) goto err;
1857 @@ -53,6 +63,14 @@
1858                    sizeof(current->thread.fpscr));
1859      if (r != sizeof(current->thread.fpscr)) goto err;
1860      bytes += r;
1861 +#elif HAVE_THREAD_FP_STATE
1862 +    r = write_kern(ctx, file, thread_fp_save_area(current->thread),
1863 +                  sizeof(current->thread.fp_state));
1864 +    if (r != sizeof(current->thread.fp_state)) goto err;
1865 +    bytes += r;
1866 +#else
1867 +    #error Unknown PPC floating point state
1868 +#endif
1869  
1870  #if HAVE_THREAD_VDSO_BASE
1871      /* unconditionally store the base of the VDSO library */
1872 @@ -66,6 +84,7 @@
1873      /* XXX I really need to find out if this is right */
1874      if (regs->msr & MSR_VEC)
1875         giveup_altivec(current);
1876 +  #if HAVE_THREAD_VR
1877      r = write_kern(ctx, file, &current->thread.vr,
1878                    sizeof(current->thread.vr));
1879      if (r != sizeof(current->thread.vr)) goto err;
1880 @@ -75,7 +94,24 @@
1881                    sizeof(current->thread.vscr));
1882      if (r != sizeof(current->thread.vscr)) goto err;
1883      bytes += r;
1884 +  #elif HAVE_THREAD_VR_STATE
1885 +    r = write_kern(ctx, file, thread_vr_save_area(current->thread),
1886 +                  sizeof(current->thread.vr_state));
1887 +    if (r != sizeof(current->thread.vr_state)) goto err;
1888 +    bytes += r;
1889 +  #else
1890 +    #error Unknown PPC vector register state
1891 +  #endif
1892 +#endif
1893 +
1894 +#ifdef CONFIG_VSX
1895 +    /* TODO: VSX state */
1896  #endif
1897 +
1898 +#ifdef CONFIG_SPE
1899 +    /* TODO: SPE state */
1900 +#endif
1901 +
1902      return bytes;
1903  
1904   err:
1905 @@ -98,6 +134,7 @@
1906      memcpy(regs, &regtmp, sizeof(regtmp));
1907  
1908      /* Floating point regs */
1909 +#if HAVE_THREAD_FPR
1910      r = read_kern(ctx, file, &current->thread.fpr,
1911                   sizeof(current->thread.fpr));
1912      if (r != sizeof(current->thread.fpr)) goto bad_read;
1913 @@ -105,6 +142,11 @@
1914      r = read_kern(ctx, file, &current->thread.fpscr,
1915                   sizeof(current->thread.fpscr));
1916      if (r != sizeof(current->thread.fpscr)) goto bad_read;
1917 +#elif HAVE_THREAD_FP_STATE
1918 +    r = read_kern(ctx, file, thread_fp_save_area(current->thread),
1919 +                 sizeof(current->thread.fp_state));
1920 +    if (r != sizeof(current->thread.fp_state)) goto bad_read;
1921 +#endif
1922  
1923  #if HAVE_THREAD_VDSO_BASE
1924      /* unconditonally restore this */
1925 @@ -115,6 +157,7 @@
1926  
1927  #ifdef CONFIG_ALTIVEC
1928      /* Restore Altivec */
1929 +  #if HAVE_THREAD_VR
1930      r = read_kern(ctx, file, &current->thread.vr,
1931                   sizeof(current->thread.vr));
1932      if (r != sizeof(current->thread.vr)) goto bad_read;
1933 @@ -122,6 +165,19 @@
1934      r = read_kern(ctx, file, &current->thread.vscr,
1935                   sizeof(current->thread.vscr));
1936      if (r != sizeof(current->thread.vscr)) goto bad_read;
1937 +  #elif HAVE_THREAD_VR_STATE
1938 +    r = read_kern(ctx, file, thread_vr_save_area(current->thread),
1939 +                 sizeof(current->thread.vr_state));
1940 +    if (r != sizeof(current->thread.vr_state)) goto bad_read;
1941 +  #endif
1942 +#endif
1943 +
1944 +#ifdef CONFIG_VSX
1945 +    /* TODO: VSX state */
1946 +#endif
1947 +
1948 +#ifdef CONFIG_SPE
1949 +    /* TODO: SPE state */
1950  #endif
1951  
1952      current->thread.regs = regs;
1953 diff -Nur blcr-0.8.5/vmadump4/vmadump_x86_64.c blcr-0.8.6_b4/vmadump4/vmadump_x86_64.c
1954 --- blcr-0.8.5/vmadump4/vmadump_x86_64.c        2013-01-08 08:23:50.000000000 +0100
1955 +++ blcr-0.8.6_b4/vmadump4/vmadump_x86_64.c     2014-09-19 01:46:11.000000000 +0200
1956 @@ -17,7 +17,7 @@
1957   *  along with this program; if not, write to the Free Software
1958   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1959   *
1960 - * $Id: vmadump_x86_64.c,v 1.50.8.8 2013/01/08 07:23:50 phargrov Exp $
1961 + * $Id: vmadump_x86_64.c,v 1.50.8.9 2014/09/18 23:46:11 phargrov Exp $
1962   *
1963   * THIS VERSION MODIFIED FOR BLCR <http://ftg.lbl.gov/checkpoint>
1964   *-----------------------------------------------------------------------*/
1965 @@ -354,6 +354,8 @@
1966  {
1967      unsigned long vdso_base = (unsigned long) vmad_vdso_base;
1968  
1969 +    if (vmad_is_vvar_map((struct vm_area_struct *)map)) return 1;
1970 +
1971    #if HAVE_MM_CONTEXT_VDSO && defined(VSYSCALL32_BASE)
1972      /* Some RHEL5 kernels use fix the VSYSCALL32_BASE for 32-bit tasks and 
1973       * current->mm->context.vdso for 64-bit tasks.  Since we need to
1974 @@ -372,6 +374,8 @@
1975  {
1976      loff_t r = 0;
1977  
1978 +    if (vmad_is_vvar_map(map)) return 0;
1979 +
1980      if (vmad_is_arch_map(map)) {
1981         /* Just write out a section header */
1982          struct vmadump_vma_header head;
1983 @@ -409,6 +413,10 @@
1984      if (test_thread_flag(TIF_IA32)) {
1985         r = syscall32_setup_pages(NULL, 0);
1986      } else
1987 +  #elif defined(CR_KCODE_compat_arch_setup_additional_pages)
1988 +    if (test_thread_flag(TIF_IA32)) {
1989 +       r = compat_arch_setup_additional_pages(NULL, 0);
1990 +    } else
1991    #endif
1992      {
1993    #if HAVE_2_ARG_ARCH_SETUP_ADDITIONAL_PAGES
1994 @@ -441,6 +449,15 @@
1995          }
1996      #endif
1997      } else if (vmad_vdso_base != (void *)head->start) {
1998 +    #if HAVE_VM_OPS_NAME
1999 +        /* Relocate vvar map if present immediately above or below vdso */
2000 +        r = vmad_reloc_vvar(ctx, (unsigned long)vmad_vdso_base, head);
2001 +        if (r) {
2002 +            CR_ERR_CTX(ctx, "vvar remap failed %d", (int)r);
2003 +            goto err;
2004 +        }
2005 +    #endif
2006 +
2007         r = vmad_remap(ctx, (unsigned long)vmad_vdso_base, head->start, head->end - head->start);
2008         if (r) {
2009             CR_ERR_CTX(ctx, "vdso remap failed %d", (int)r);
2010 diff -Nur blcr-0.8.5/vmadump4/vmadump_x86.h blcr-0.8.6_b4/vmadump4/vmadump_x86.h
2011 --- blcr-0.8.5/vmadump4/vmadump_x86.h   2012-12-18 19:32:09.000000000 +0100
2012 +++ blcr-0.8.6_b4/vmadump4/vmadump_x86.h        2014-09-19 01:46:11.000000000 +0200
2013 @@ -17,7 +17,7 @@
2014   *  along with this program; if not, write to the Free Software
2015   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2016   *
2017 - * $Id: vmadump_x86.h,v 1.9.8.3 2012/12/18 18:32:09 phargrov Exp $
2018 + * $Id: vmadump_x86.h,v 1.9.8.4 2014/09/18 23:46:11 phargrov Exp $
2019   *
2020   *  THIS FILE ADDED FOR BLCR <http://ftg.lbl.gov/checkpoint>
2021   *-----------------------------------------------------------------------*/
2022 @@ -287,4 +287,40 @@
2023      return r;
2024  }
2025  
2026 +
2027 +#if VMAD_HAVE_ARCH_MAPS
2028 +  #if HAVE_VM_OPS_NAME
2029 +    #define vmad_is_vvar_map(map) \
2030 +       ((map)->vm_ops && (map)->vm_ops->name && !strcmp("[vvar]", (map)->vm_ops->name(map)))
2031 +
2032 +    /* Relocate vvar map if present immediately above or below vdso */
2033 +    static long vmad_reloc_vvar(cr_rstrt_proc_req_t *ctx,
2034 +                                unsigned long vdso_start, 
2035 +                                struct vmadump_vma_header *vdso_head)
2036 +    {
2037 +        long r = 0;
2038 +       unsigned long vvar_start = 0;
2039 +       unsigned long vdso_end = vdso_start + (vdso_head->end - vdso_head->start);
2040 +       struct vm_area_struct *map;
2041 +
2042 +       if ((NULL != (map = find_vma(current->mm, vdso_end))) &&
2043 +           (map->vm_start == vdso_end)) {
2044 +           vvar_start = vdso_head->end;
2045 +       } else
2046 +       if ((NULL != (map = find_vma(current->mm, vdso_start - PAGE_SIZE))) &&
2047 +           (map->vm_end == vdso_start)) {
2048 +           vvar_start = vdso_head->start - (map->vm_end - map->vm_start);
2049 +       }
2050 +
2051 +       if (vvar_start && vmad_is_vvar_map(map)) {
2052 +           r = vmad_remap(ctx, map->vm_start, vvar_start, map->vm_end - map->vm_start);
2053 +       }
2054 +
2055 +        return r;
2056 +    }
2057 +  #else
2058 +    #define vmad_is_vvar_map(map) 0
2059 +  #endif
2060 +#endif
2061 +
2062  #endif /* _VMADUMP_X86_H */
This page took 0.222013 seconds and 3 git commands to generate.