From 6ea6c182c7fb6c22dafbbf203abcc23726e06cba Mon Sep 17 00:00:00 2001 From: Sergio Gelato Date: Wed, 22 Feb 2017 13:55:33 -0800 Subject: [PATCH] LINUX: Debian/Ubuntu build regression on kernel 3.16.39 Now that kernel 4.9 has hit jessie-backports, it becomes desirable to also backport the associated openafs patches. Unfortunately, Linux-4.9-inode_change_ok-becomes-setattr_prepare.patch causes a build failure against jessie's current default kernel, 3.16.39-1, due to the fact that setattr_prepare() is available (it was cherrypicked to address CVE-2015-1350) but file_dentry() is not (it was introduced in kernel 4.6). This makes it difficult to have a version of openafs for jessie that supports both kernels. To deal with this, follow the implementation of file_dentry() in 4.6, and simplify it to account for the lack of d_real() support in older kernels. Note that inode_change_ok() has been added back to 3.16.39-1 to avoid ABI changes. That means the current openafs packages in jessie continue to work with kernel 3.16.39-1 since they do not include Linux-4.9-inode_change_ok-becomes-setattr_prepare.patch. Originally reported at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855366 FIXES RT134158 Change-Id: I157aa2ff25945c1c6e3b8e4a600557125711a681 Reviewed-on: https://gerrit.openafs.org/12523 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- acinclude.m4 | 3 +++ src/afs/LINUX/osi_compat.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index a676c8e014..1e40e9a4bb 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1035,6 +1035,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_FUNC([do_sync_read], [#include ], [do_sync_read(NULL, NULL, 0, NULL);]) + AC_CHECK_LINUX_FUNC([file_dentry], + [#include ], + [struct file *f; file_dentry(f);]) AC_CHECK_LINUX_FUNC([find_task_by_pid], [#include ], [pid_t p; find_task_by_pid(p);]) diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index d5916266b1..14762fab1c 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -47,6 +47,10 @@ typedef struct path afs_linux_path_t; # endif #endif +#ifndef HAVE_LINUX_FILE_DENTRY +#define file_dentry(file) ((file)->f_dentry) +#endif + #if defined(HAVE_LINUX_LOCKS_LOCK_FILE_WAIT) # define flock_lock_file_wait locks_lock_file_wait #endif