Commit Graph

573 Commits

Author SHA1 Message Date
Michael Meffie
2e39bea08f cf: Remove SRCDIR_PARENT
The SRCDIR_PARENT shell variable is set to the configure process current
working directory. It is used during configure to set the top level
directory variables used in the build; TOP_OBJDIR, TOP_INCDIR,
TOP_LIBDIR. It is also used during configure to specify the path to
generated programs.

However, this variable is redundant with the TOP_OBJDIR variable and the
name can be confusing, since the top build directory is not the source
parent directory when doing out-of-tree (objdir) builds.

Remove the SRCDIR_PARENT variable and set the top directory variables
early in configure. Use TOP_OBJDIR to indicate the path to generated
tools.

Change-Id: Iaf1ce7707e73dd3c8fdf849c9767e8b84401d5a7
Reviewed-on: https://gerrit.openafs.org/15816
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-08-19 09:41:11 -04:00
Andrew Deason
20e996af4e cf: Prevent default CFLAGS in OPENAFS_PATH_CC
Commit dba6ec9548 (cf: Set CC before calling AC_PROG_CC) moved our
logic for preventing a default CFLAGS from the top-level
configure.ac/configure-libafs.ac into OPENAFS_CONFIGURE_COMMON. This
doesn't work, because OPENAFS_CONFIGURE_COMMON calls
AC_USE_SYSTEM_EXTENSIONS, which effectively runs the compiler and sets
default CFLAGS at the beginning of OPENAFS_CONFIGURE_COMMON.

This means that if the user doesn't specify any CFLAGS, autoconf will
set our CFLAGS to the default of '-g -O2', which can break various
environments. (For example, --disable-optimize no longer works, because
that flag only controls the OPTMZ var, and doesn't touch CFLAGS.)

To fix this, move our logic for preventing default CFLAGS into
OPENAFS_PATH_CC, which is explicitly called before
OPENAFS_CONFIGURE_COMMON so we can set the compiler before autoconf sets
its defaults. This should ensure that we are setting CFLAGS before
autoconf does; otherwise, we're also probably not setting CC early
enough, either.

Change-Id: Ic64e46aee35ffd3b5ee4ad1241c4c7366d9ccb67
Reviewed-on: https://gerrit.openafs.org/15778
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-07-08 14:52:01 -04:00
Andrew Deason
dba6ec9548 cf: Set CC before calling AC_PROG_CC
On some platforms (HPUX, SOLARIS, AIX), we forcibly set CC or set a
default CC, because we must use a specific compiler to build kernel
modules, and we specify certain compiler-specific flags. But we do
this after AC_PROG_CC has run, which also searches for a compiler to
use, and runs a few tests against it. AC_PROG_CC often chooses a
different compiler (it prefers gcc if it's available).

As a result, some compiler-derived info may be wrong, which can yield
confusing results, even breaking the build depending on what the
user's PATH is, or what compilers are installed on the system.

We can avoid all of this if we move our CC-setting logic to before
AC_PROG_CC is called. This is a little tricky, because our logic to
set AFS_SYSNAME requires the C compiler, so we must do this before
OPENAFS_SYSNAME, and also before AC_USE_SYSTEM_EXTENSIONS, or any
other autoconf macro that uses the C compiler.

Move our CC-setting logic into a new macro, OPENAFS_PATH_CC, which is
separate from OPENAFS_CONFIGURE_COMMON and must be called before
OPENAFS_CONFIGURE_COMMON. Add some safeguards to try to detect if
AC_PROG_CC is already called to try to prevent future changes from
breaking this; this isn't perfect, but it's better than nothing.

Change-Id: I7c327df5acc5d1ff701b70825eecaaaab4aa44a8
Reviewed-on: https://gerrit.openafs.org/15456
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Ben Huntsman <ben@huntsmans.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2024-07-02 13:13:45 -04:00
Mark Vitale
e2ec16cf94 dir: Introduce struct DirEntryFlex
The directory package as implemented in AFS-2 allocates space for each
directory entry as a DirEntry struct followed by 0-8 contiguous
DirXEntry structs, as needed. This is implemented by:

 - afs_dir_NameBlobs    calculates the number of blocks needed
 - FindBlobs		allocates and returns index of entry
 - afs_dir_GetBlob	returns pointer to 1st DirEntry struct

After this, we populate DirEntry (and any contiguous DirXEntry blocks)
with open code.  Most existing code writes the entry's name via a string
copy operation to DirEntry->name, which is only 16 bytes long.
Therefore, for dir entry names that are 16 bytes or longer, OpenAFS
routinely does string copies that look like buffer overruns.  This has
not previously caused problems because the OpenAFS code has arranged for
a sufficiently large amount of contiguous memory to be available.
However, this remains undefined behavior in the C abstract virtual
machine; thus compilers are not required to produce safe operation.

Recent changes in the OpenAFS build chain have made this approach no
longer viable:

1) Linux 6.5 commit df8fc4e934c12b 'kbuild: Enable
-fstrict-flex-arrays=3' modified the hardening of several kernel
string operations when running with CONFIG_FORTIFY_SOURCE=y.

2) gcc 13 commit 79a89108dd352cd9288f5de35481b1280c7588a5
'__builtin_dynamic_object_size: Recognize builtin' provides some
enhancements to _builtin_object_size.  The Linux commit above will now
use these when the kernel is built with gcc 13.

When OpenAFS is built under Linux 6.5 or higher and gcc 13 or higher,
the hardened strlcpy will BUG for directory entry names longer than 16
characters.

Since there are multiple places where OpenAFS writes directory names,
there are several symptoms that may manifest.  However, the first one is
usually a kernel BUG at cache manager initialization if running with
afsd -dynroot _and_ there are any cell names 15 characters or longer in
the client CellServDB.  (A 15-character cellname reaches the 16
character limit when -dyrnoot adds the RW mountpoint ".<cellname>".)

Address this by using flexible arrays (standardized with C99). A
flexible array is a variable-length array that is declared with no size
at all, e.g., name[].

Create an autoconf test to determine whether the compiler supports
flexible arrays.

Create a new struct DirEntryFlex.  If the compiler supports
flexible arrays, define name[]; otherwise retain the name[16]
definition.

Whenever we write a directory name, use DirEntryFlex so that any
hardening will be satisfied that there is sufficient space for the name.

However, the actual guarantee that this is true is still provided by the
OpenAFS directory routines mentioned above - all of these remain
unchanged.

The DirEntry struct remains unchanged for continued use in OpenAFS, as
well as for any out-of-tree users of the directory package.

Change-Id: I6da5c6c295f051be90017084e5b3a3ef24d1271f
Reviewed-on: https://gerrit.openafs.org/15573
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2023-11-09 12:24:58 -05:00
Cheyenne Wills
2a659ba160 autoconf: Remove/update obsolete autoconf macros
Autoconf 2.70 (released in 2020-12) produces warning messages about
obsolete constructs by default.

Running regen.sh with autoconf 2.70 installed produces the following
warnings:

..
 configure.ac:7: warning: The macro `AC_CONFIG_HEADER' is obsolete.
 configure.ac:21: warning: AC_PROG_LEX without either yywrap or noyywrap
   is obsolete
 configure.ac:21: warning: The macro `AC_HEADER_STDC' is obsolete.
 configure.ac:21: warning: The macro `AC_HEADER_TIME' is obsolete.
..

Replace AC_CONFIG_HEADER with AC_CONFIG_HEADERS

Add the noyywrap parameter to AC_PROG_LEX.  Use the noyywrap option
since we already provide a yywrap function in the .l sources.

Remove AC_HEADER_STDC.  There are no references to the the autoconf
variable set by this macro.  This macro was marked as obsolete prior to
autoconf 2.64 with the following note:
 "This macro is obsolescent, as current systems have conforming header
 files. New programs need not use this macro."

AC_HEADER_TIME was marked as obsolete prior to autoconf 2.64 with the
following note:
 "This macro is obsolescent, as current systems can include both files
  when they exist. New programs need not use this macro."

The only reference that requires AC_HEADER_TIME is within the external
roken code pulled from heimdal. Compiles that use the external upstream
heimdal packages result in a build error if TIME_WITH_SYS_TIME is not
defined:
  building src/crypto/hcrypto
    src/external/heimdal/hcrypto/camellia.c
      include/roken.h:803:58: error: ‘struct tm’ declared inside

Update autoheader.m4 so a define for TIME_WITH_SYS_TIME is created. This
avoids modifying the external heimdal/roken code.

Change-Id: If4d6c0650aac617f535b35f81994b54a3b8ac021
Reviewed-on: https://gerrit.openafs.org/14838
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2021-12-02 11:57:47 -05:00
Pat Riehecky
ec45ae6053 configure.ac: Add missing double include guard
This is primarily a sanity check (identified by clang-tidy).

Change-Id: I92d05fdfed0e32c0e39cc2f8ce412b613c0a38fc
Reviewed-on: https://gerrit.openafs.org/13333
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2021-02-25 21:18:00 -05:00
Michael Meffie
db38561dea autoconf: remove unnecessary mkdir during configure
Remove an uneeded mkdir command to create the JAVA/libjafs object
directory, since this directory is automatically created by the
config.status when generating the JAVA/libjafs/Makefile.

Change-Id: Ib02a38c5c23790cb07e5c2433fd4870e8763c3a3
Reviewed-on: https://gerrit.openafs.org/12994
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2018-10-19 00:16:48 -04:00
Michael Meffie
b1b3322a68 autoconf: fix pio checks name
The autoconf macro to perform the positional i/o checks was misnamed as
hpux checks (since there happens to be a specific check for hpux at the
top of the macro).  Change the macro name and m4 file name to be more
accurately named.

Change-Id: Ib85728fbfe67930cb5f9f1f0e34f7aa1195fdfc6
Reviewed-on: https://gerrit.openafs.org/12992
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2018-10-18 23:47:23 -04:00
Peter Foley
2e23fceec8 autoconf: autoupdate macros
Run autoupdate on macros.

[mmeffie@sinenomine.net: re-run autoupdate, no other edits]

Change-Id: I8b45edea97cf2e065f23f02d2d7f6a0e7adcb8a5
Reviewed-on: https://gerrit.openafs.org/12202
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-08-11 12:31:51 -04:00
Marcio Barbosa
88cb536f99 autoconf: detect ctf-tools and add ctf to libafs
CTF is a reduced form of debug information similar to DWARF and stab. It
describes types and function prototypes. The principal objective of the
format is to shrink the data size as much as possible so that it could
be included in a production environment. MDB, DTrace, and other tools
use CTF debug information to read and display structures correctly.

This commit introduces a new configure option called --with-ctf-tools.
This option can be used to specify an alternative path where the tools
can be found. If the path is not provided, the tools will be searched
in a set of default directories (including $PATH). The CTF debugging
information will only be included if the corresponding --enable-debug /
--enable-debug-kernel is specified.

Note: at the moment, the Solaris kernel module is the only module
benefited by this commit.

Change-Id: If0a584377652a573dd1846eae30d42697af398d0
Reviewed-on: https://gerrit.openafs.org/12680
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-02-05 23:31:18 -05:00
Michael Meffie
c72622a244 autoconf: refactor acinclude.m4
The acinclude.m4 is very large and often requires to be changed for
unrelated commits.  Divy up the large acinclude.m4 into a number of
smaller files to avoid so many contentions and to make the autoconf
system easier to maintain.

This is a non-functional change. Care has been taken preserve the
ordering of the autoconf tests. Except for whitespace, the generated
configure file has not been changed by this refactoring.  This has been
verified with a 'diff -u -w -B' comparison of the generated configure
file before and after applying this commit.

Change-Id: I70e7f846dea0055d00a60a47422aa73bff25c4c6
Reviewed-on: https://gerrit.openafs.org/12842
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2018-01-09 00:22:06 -05:00
Stephan Wiesand
fb1f14d8ee Linux 4.15: check for 2nd argument to pagevec_init
Linux 4.15 removes the distinction between "hot" and "cold" cache
pages, and pagevec_init() no longer takes a "cold" flag as the
second argument. Add a configure test and use it in osi_vnodeops.c .

Change-Id: Ia5287b409b2a811d2250c274579e6f15fd18fdbb
Reviewed-on: https://gerrit.openafs.org/12824
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-12-22 23:22:17 -05:00
Marcio Barbosa
804c9cbf50 macos: add support for MacOS 10.13
This commit introduces the new set of changes / files required to
successfully build the OpenAFS source code on OS X 10.13 "High Sierra".

Change-Id: I51928279d97c9d86c67db7de5eb7fc9d317fd381
Reviewed-on: https://gerrit.openafs.org/12741
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2017-12-17 15:31:31 -05:00
Marcio Barbosa
3ce55426ee afs: fix kernel_write / kernel_read arguments
The order / content of the arguments passed to kernel_write and
kernel_read are not right. As a result, the kernel will panic if one of
the functions in question is called.

[kaduk@mit.edu: include configure check for multiple kernel_read()
variants, per linux commits bdd1d2d3d251c65b74ac4493e08db18971c09240
and e13ec939e96b13e664bb6cee361cc976a0ee621a]

FIXES 134440

Change-Id: I4753dee61f1b986bbe6a12b5568d1a8db30c65f8
Reviewed-on: https://gerrit.openafs.org/12769
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-11-27 22:14:21 -05:00
Damien Diederen
5ee516b378 Linux: Use kernel_read/kernel_write when __vfs variants are unavailable
We hide the uses of set_fs/get_fs behind a macro, as those functions
are likely to soon become unavailable:

> Christoph Hellwig suggested removing all calls outside of the core
> filesystem and architecture code; Andy Lutomirski went one step
> further and said they should all go.

    https://lwn.net/Articles/722267/

Change-Id: Ib668f8fdb62ca01fe14321c07bd14d218744d909
Reviewed-on: https://gerrit.openafs.org/12729
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-10-04 11:27:49 -04:00
Damien Diederen
929e77a886 Linux: Test for __vfs_write rather than __vfs_read
The following commit:

    commit eb031849d52e61d24ba54e9d27553189ff328174
    Author: Christoph Hellwig <hch@lst.de>
    Date:   Fri Sep 1 17:39:23 2017 +0200

        fs: unexport __vfs_read/__vfs_write

unexports both __vfs_read and __vfs_write, but keeps the former in
fs.h--as it is is still being used by another part of the tree.

This situation results in a false positive in our Autoconf check,
which does not see the export statements, and ends up marking the
corresponding API as available.

That, in turn, causes some code which assumes symmetry with
__vfs_write to fail to compile.

Switch to testing for __vfs_write, which correctly marks the API as
unavailable.

Change-Id: I392f2b17b4de7bd81d549c84e6f7b5ef05e1b999
Reviewed-on: https://gerrit.openafs.org/12728
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-10-02 20:10:47 -04:00
Seth Forshee
962f4838dc Linux: Include linux/uaccess.h rather than asm/uaccess.h if present
Starting with Linux 4.12 there is a module build error on s390
due to asm/uaccess.h using a macro defined in the common header.
The common header has been around since 2.6.18 and has always
included asm/uaccess.h, so switch to using the common header
whenever it is present.

Change-Id: Iaab0d7652483a2a2b1f144f3e90b6d3b902c146d
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Reviewed-on: https://gerrit.openafs.org/12714
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2017-08-28 23:04:18 -04:00
Joe Gorse
63e530e7df LINUX: Switch to new bdi api for 4.12.
super_setup_bdi() dynamically allocates backing_dev_info structures
for filesystems and cleans them up on superblock destruction.

Appears with Linux commit fca39346a55bb7196888ffc77d9e3557340d1d0b
Author: Jan Kara <jack@suse.cz>
Date:   Wed Apr 12 12:24:28 2017 +0200

Change-Id: I67eed0fcb8c96733390579847db57fb8a4f0df3e
Reviewed-on: https://gerrit.openafs.org/12614
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-05-29 23:32:37 -04:00
Stephan Wiesand
6b7b4239ab Linux: only include cred.h if it exists
Commit c89fd17df1 introduced an explicit
include of linux/cred.h since the latest kernel no longer includes it
implicitly in sched.h. Alas, older kernels (like 2.6.18) don't have this
file. Add a configure test for the existence of cred.h and only include
it if actually present.

Change-Id: Ia7e38160492b1e03cdb257e4b2bef4d18c4a28fb
Reviewed-on: https://gerrit.openafs.org/12593
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2017-04-11 20:43:36 -04:00
Mark Vitale
ad00155094 Linux v4.11: signal stuff moved to sched/signal.h
In Linux commit c3edc4010e9d102eb7b8f17d15c2ebc425fed63c, signal_struct
and other signal handling declarations were moved from sched.h to
sched/signal.h.

This breaks existing OpenAFS autoconf tests for recalc_sigpending() and
task_struct.signal->rlim, so that the OpenAFS kernel module can no
longer build.

Modify OpenAFS autoconfig tests to cope.

Change-Id: Ic9f174b92704eabcbd374feffe5fbeb92c8987ce
Reviewed-on: https://gerrit.openafs.org/12573
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
2017-04-05 10:17:38 -04:00
Joe Gorse
de5ee1a67d Linux v4.11: getattr takes struct path
With Linux commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f

    statx: Add a system call to make enhanced file info available

The Linux getattr inode operation is altered to take two additional
arguments: a u32 request_mask and an unsigned int flags that indicate
the synchronisation mode.  This change is propagated to the
vfs_getattr*() function.

-   int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
+   int (*getattr) (const struct path *, struct kstat *,
+                     u32 request_mask, unsigned int sync_mode);

The first argument, request_mask, indicates which fields of the statx
structure are of interest to the userland call. The second argument,
flags, currently may take the values defined in
include/uapi/linux/fcntl.h and are optionally used for cache coherence:

 (1) AT_STATX_SYNC_AS_STAT tells statx() to behave as stat() does.

 (2) AT_STATX_FORCE_SYNC will require a network filesystem to
     synchronise its attributes with the server - which might require
     data writeback to occur to get the timestamps correct.

 (3) AT_STATX_DONT_SYNC will suppress synchronisation with the server in
     a network filesystem.  The resulting values should be considered
     approximate.

This patch provides a new autoconf test and conditional compilation to
cope with the changes in our getattr implementation.

Change-Id: Ie4206140ae249c00a8906331c57da359c4a372c4
Reviewed-on: https://gerrit.openafs.org/12572
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-04-05 10:17:29 -04:00
Mark Vitale
22d841a45f SOLARIS: prevent BAD TRAP panic with Studio 12.5
Starting with Solaris Studio 12.3, it is documented that Solaris kernel
modules (such as libafs) must not use any floating point, vector, or
SIMD/SSE instructions on x86 hardware.  However, each new Studio
compiler release (12.4 and especially 12.5) is more likely to use these
types of instructions by default.

If the libafs kernel module includes any forbidden kernel instructions,
Solaris will panic the system with:
  BAD TRAP:  type=7 (#nm Device not available)

Provide a new autoconfig test to specify the required compiler options
(-xvector=%none -xregs=no%float) when building the OpenAFS kernel module
for Solaris, so that no invalid x86 instructions are used.

In addition, reinstate default kernel module optimization for Solaris.
It had been disabled in commit 80592c53cb
to address this same issue in Studio 12.3 and 12.4.  However, Studio
12.5 started using some SSE instructions even with no optimization.

This commit has been tested with OpenAFS master and Studio 12.5 at all
optimization levels (none, -xO1 through -xO5) and verified to contain no
XMM register instructions via the following command:
  $ gobjdump -dlr libafs64.o | grep xmm | wc -l

Change-Id: Ic3c7860f7d524162fd9178a1dab5dd223722ee43
Reviewed-on: https://gerrit.openafs.org/12558
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-03-11 14:14:23 -05:00
Michael Meffie
69aadea298 build: update search paths for solaris cc
Move the macros to search for the solaris cc to a separate macro and
update the search paths to keep up with released versions.

Change-Id: Iaba816f1acf5f45d4e147ae517e73949eb8fe949
Reviewed-on: https://gerrit.openafs.org/12528
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2017-02-26 20:28:03 -05:00
Sergio Gelato
6ea6c182c7 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 <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2017-02-25 21:09:26 -05:00
Marcio Barbosa
0bdf750a96 macos: add support for MacOS 10.12
This commit introduces the new set of changes / files required to
successfully build the OpenAFS source code on OS X 10.12 "Sierra".

Change-Id: I42326cd271d84735188f9e3003e292afe5ee34be
Reviewed-on: https://gerrit.openafs.org/12419
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-10-27 19:56:09 -04:00
Mark Vitale
8aeb711eea Linux 4.9: inode_change_ok() becomes setattr_prepare()
Linux commit 31051c85b5e2 "fs: Give dentry to inode_change_ok() instead
of inode" renames and modifies inode_change_ok(inode, attrs) to
setattr_prepare(dentry, attrs).

Modify OpenAFS to cope.

Change-Id: I72f8dfbdbd25d7c775e9c35116e323ea4359e95c
Reviewed-on: https://gerrit.openafs.org/12418
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-10-25 21:37:33 -04:00
Mark Vitale
f21e3ef8ce Linux 4.9: inode_operation rename now takes flags
In Linux 3.15 commit 520c8b16505236fc82daa352e6c5e73cd9870cff,
inode_operation rename2() was added.  It takes the same arguments as
rename(), with an added flags argument supporting the following values:

RENAME_NOREPLACE: if "new" name exists, fail with -EEXIST.  Without
this flag, the default behavior is to replace the "new" existing file.

RENAME_EXCHANGE: exchange source and target; both must exist.

OpenAFS never implemented a .rename2() routine because it was optional
when introduced at Linux v3.15.

In Linux 4.9-rc1 the following commits remove the last in-tree uses of
.rename() and converts .rename2() to .rename().
aadfa8019e81 vfs: add note about i_op->rename changes to porting
2773bf00aeb9 fs: rename "rename2" i_op to "rename"
18fc84dafaac vfs: remove unused i_op->rename
1cd66c93ba8c fs: make remaining filesystems use .rename2
e0e0be8a8355 libfs: support RENAME_NOREPLACE in simple_rename()
f03b8ad8d386 fs: support RENAME_NOREPLACE for local filesystems

With these changes, it is now mandatory for OpenAFS afs_linux_rename()
to accept a 5th flag argument.

Add an autoconfig test to determine the signature of .rename().  Use this
information to implement afs_linux_rename() with the appropriate number
of arguments.  Implement "toleration support" for the flags option by
treating a zero flag as a normal rename; if any flags are specified,
return -EINVAL to indicate the OpenAFS filesystem does not yet support
any flags.

Change-Id: I165d2b7956942446d97beda8504ac1ed5185a036
Reviewed-on: https://gerrit.openafs.org/12391
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-10-25 21:33:25 -04:00
Mark Vitale
8e81b182e3 Linux 4.9: deal with demise of GROUP_AT
Linux commit 81243eacfa40 "cred: simpler, 1D supplementary groups"
refactors the group_info struct, removing some members (which OpenAFS
references only through the GROUP_AT macro) and adding a gid member.
The GROUP_AT macro is also removed from the tree.

Add an autoconfigure test for the new group_info member gid and define a
replacement GROUP_AT macro to do the right thing under the new regime.

Change-Id: I85a52c0ae0d91fc141a523f443a4ffc05eb72a2b
Reviewed-on: https://gerrit.openafs.org/12390
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-10-25 21:28:14 -04:00
Marcio Barbosa
8b57f9fc42 build-sys: do not capitalize value of HAVE_PAM
The value assigned to HAVE_PAM should not be capitalized.
If so, the PAM source files will not be compiled.

To fix this problem, convert to lowercase one of the values
assigned to HAVE_PAM.

Change-Id: I4973394f8d398bbea0f578fadb04aedee6fd1fc0
Reviewed-on: https://gerrit.openafs.org/12296
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-07-06 12:30:37 -04:00
Michael Meffie
c5b52c8159 vlserver: --enable-ubik-read-while-write configure option
Commit a0f416e350 unconditionally turned
on the new ubik_BeginTransReadAnyWrite functionality for the vlserver,
which allows us to read data from ubik during a conflicting ubik write
lock.

This feature is not ready for production use. Make it a build time
option, marked as experimental, until more testing can be done.

Change-Id: If64702e7a7ed2340066df5faf82ce8b0875fc610
Reviewed-on: https://gerrit.openafs.org/12240
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-07-06 00:08:59 -04:00
Benjamin Kaduk
360f4ef53c Linux 4.5: don't access i_mutex directly
Linux commit 5955102c, in preparation for future work, introduced
wrapper functions to lock/unlock inode mutexes.  This is to
prepare for converting it to a read-write semaphore, so that
lookup can be done with only the shared lock held.

Adopt the afs_linux_*lock_inode() functions accordingly, and
convert afs_linux_fsync() to using those wrappers, since the
FOP_FSYNC_TAKES_RANGE case appears to be the current case.

Amusingly, afs_linux_*lock_inode() already have a branch to
handle the case when inode serialization is protected by a
semaphore; it seems that this is going to come full-circle.

Change-Id: Ia5a194acc559de21808655ef066151a0a3826364
Reviewed-on: https://gerrit.openafs.org/12268
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-06-10 16:21:42 -04:00
Chaskiel Grundman
2ef27ea1bb Linux 4.5: get_link instead of follow_link+put_link
In linux commit 6b255391, the follow_link inode operation was
replaced by the get_link operation, which is basically the same
but takes the inode and dentry separately, allowing for the
possibility of staying in RCU mode.

For now, only support this if page_get_link is available and we are
using the USABLE_KERNEL_PAGE_SYMLINK_CACHE

The previous test for USABLE_KERNEL_PAGE_SYMLINK_CACHE used a bogus,
undefined configure variable (ac_cv_linux_kernel_page_follow_link).
Remove it, as it was not needed

Change-Id: I2d7851d31dd4b1b944b16fad611addb804930eca
Reviewed-on: https://gerrit.openafs.org/12265
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-06-10 16:21:05 -04:00
Benjamin Kaduk
d9cfc1f3f5 Linux 4.5: no highmem in symlink ops
Symlink bodies in the pagecache should not be in highmem, as
upstream converted in commit 21fc61c73.

Change-Id: I1e4c3c51308df096cdfa4d5e7b16279e275e7f41
Reviewed-on: https://gerrit.openafs.org/12264
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Joe Gorse <jhgorse@gmail.com>
Tested-by: Joe Gorse <jhgorse@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-06-10 16:19:34 -04:00
Michael Meffie
b0e6dd60b7 afs: retire HAVE_LINUX_COMPLETION_H conditionals
Now that support for linux 2.4 has been sunset, as of commit
ccf353ede6, it is no longer necessary to
put conditional compilation checks around the linux wait-for-completion
functions, which were introduced sometime during the linux 2.4 series
and have been available since.

Also, remove the remnant LINUX_COMPLETION_H_EXISTS autoconf macro, which
was removed from use in commit ef8bd5a29b.

Change-Id: Iea974236f73eef8c567a897d6a473254edf95379
Reviewed-on: https://gerrit.openafs.org/12278
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-05-05 20:19:36 -04:00
Michael Meffie
ad455347bc Remove server logging globals
Remove the global variables used to setup server logging and replace
with an argument to OpenLog.

Keep the LogLevel variable as a global for use by the logging macros,
but provide an inline function for applications which check the log
level to dump more information when the log level is increased.

Provide consistency by adding syslog tags to processes that did not
previously set one (salvageserver, salvager, and volserver).

[kaduk@mit.edu: update commit message, use old-style log rotation for
kalog, minor commenting fixes]

Change-Id: I11cffbdd1418304d33f0be02dd7e600955c4a8bb
Reviewed-on: https://gerrit.openafs.org/12168
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2016-04-25 00:47:15 -04:00
Jonathon Weiss
9c6e6d4c34 Find Tivoli TSM headers in 64 bit location
When building with --enable-tivoli-tsm locate the Tivoli TSM headers
if they are installed in the path used by the 64 bit Tivoli TSM
installation.

Change-Id: I4f114a4ada1babcbe1e52f451f10e78d861b7fd0
Reviewed-on: https://gerrit.openafs.org/12258
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-04-18 12:01:00 -04:00
Stephan Wiesand
ae5f411c3b Linux 4.4: Do not use splice()
splice() may return -ERESTARTSYS if there are pending signals, and
it's not even clear how this should be dealt with. This potential
problem has been present for a long time, but as of Linux 4.4
(commit c725bfce7968009756ed2836a8cd7ba4dc163011) seems much more
likely to happen.

Until resources are available to fix the code to handle such errors,
avoid the riskier uses of splice().

If there is a default implementation of file_splice_{write,read},
use that; on somewhat older kernels where it is not available,
use the generic version instead.

[kaduk@mit.edu: add test for default_file_splice_write]

Change-Id: Ib4477cdfb2cd0f49f516da75edc3cb9d1a8817dc
Reviewed-on: https://gerrit.openafs.org/12217
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2016-03-21 13:33:08 -04:00
Michael Laß
58d82226a5 Linux 4.4: Use locks_lock_file_wait
The locks API was changed in Linux 4.4, introducing locks_lock_file_wait
(e55c34a66f87e78fb1fc6b623b78c5ad74b475af) and removing
flock_lock_file_wait (616fb38fa7a9599293e05ae1fa9acfaf73922434).

locks_lock_file_wait can be used as a drop-in replacement so define
flock_lock_file_wait as an alias for it.

Change-Id: Iba89a43c651737c86cbf519a933289d97c25a467
Reviewed-on: https://gerrit.openafs.org/12170
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2016-03-21 13:00:16 -04:00
Michael Laß
5067ee3ae1 Linux 4.4: key_payload has no member 'value'
In Linux 4.4 (146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc) type-specific and
payload data have been merged. The payload is now accessed directly and has
no 'value' member anymore.

FIXES 132677

Change-Id: Id26c40c80314a0087ecc0735029412787058ef07
Reviewed-on: https://gerrit.openafs.org/12169
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-03-21 12:19:04 -04:00
Chas Williams
04661c4139 opr: Disable some warnings during opr assertions
Detect _Pragma(), a C99 extension for inline #pragma's, and use it to
disable to certain warnings during the use of opr_Verify() and
opr_Assert().

Because some versions of clang support _Pragma, do not have support
for -Wtautological-pointer-compare, and do set -Werror and -Wunknown-pragmas,
we must explicitly check for pragma support for -Wtautological-pointer-compare
as well.

Change-Id: Id3d5ee347f320a366a0571572b58414aa7044bf7
Reviewed-on: http://gerrit.openafs.org/11852
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2016-01-24 22:46:56 -05:00
Dave Botsch
bf3707ccbf Initial set of changes for El Capitan OS X 10.11 .
Mainly new El Capitan specific config files and defitions of
Darwin 15 variables and config tests/etc.

Change-Id: I87b926109561f41ee95a2f3f94fbdbcf2903691a
Reviewed-on: http://gerrit.openafs.org/12072
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2016-01-24 18:39:50 -05:00
Benjamin Kaduk
f7c6915358 Update extra-iput configure argument description
Commit 15260c7fdc did not function
as advertised, since the conditional which attempted to make
the configure option --(en|dis)able-linux-d_splice_alias-extra-iput
mandatory on linux checked a variable for the system type which
was not set at the time the check ran.

Subsequent discussion of this behavior produced a consensus that
there is not a need to make the configure option mandatory,
due to the narrow range of kernels affected by the bug in question,
so this follow-up commit just fixes the documentation and removes
the ineffective code.

Change-Id: I36d1f8801d355f33c3132fcab166ea76faab8e87
Reviewed-on: http://gerrit.openafs.org/11710
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
2015-12-25 14:03:44 -05:00
Brandon S Allbery
b800f7d9bd gtx: use getmaxyx() with sensible fallbacks
configure now checks for the standard getmaxyx() macro; failing that,
it looks for the older but pre-standardization getmaxx() and getmaxy(),
then falls back to the 4.2BSD curses _maxx and _maxy fields; if all
else fails, gtx building is disabled.

gtx now defines getmaxyx() itself if necessary, based on the above.

This also fixes a bug in gtx with all ncurses versions > 1.8.0 on
platforms other than NetBSD and OS X: gtx was using the _maxx and
_maxy fields, which starting with ncurses 1.8.1 were off by 1 from
the expected values. As such, behavior of scout and/or afsmonitor
may change on most ncurses-using platforms.

Change-Id: I49778e87adacef2598f0965e09538dfc3d840dcc
Reviewed-on: http://gerrit.openafs.org/12107
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2015-12-02 23:26:50 -05:00
Anders Kaseorg
8f78afa65b Add XBSA_XLIBS to XLIBS after it’s computed
Commit 353aa7ef2c (after 1.6 was
branched) reordered things such that XBSA_XLIBS was being added to
XLIBS before it was computed, which caused link failures with
--enable-tivoli-tsm.

Change-Id: I791add1b916c845d975d1ee21652c13244c50736
Reviewed-on: http://gerrit.openafs.org/11959
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
2015-08-01 23:11:42 -04:00
Marc Dionne
6c3ac6dc1e Linux 4.2: Changes in link operation APIs
The follow_link and put_link operations are revised.
Test for the new signature and adapt the code.

Change-Id: I2834589cbe36c41924ab0505e6ca4ecd797a57fd
Reviewed-on: http://gerrit.openafs.org/11928
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2015-07-23 10:54:31 -04:00
Marc Dionne
89aeb71a3e Linux 4.2: total_link_count is no longer accessible
The value is now stored in the nameidata structure which
is private to fs/namei.c, so we can't modify it here.

The effect is that using a path that contains 40+ directories
may fail with ELOOP, depending on which directories in the
path were previously used.  After a directory is accessed once
its D_AUTOMOUNT flag is reset and it will no longer count
against the symlink limit in later path lookups.

Change-Id: I90e4cb0e9004b075bff2330d165c67b7a923193f
Reviewed-on: http://gerrit.openafs.org/11926
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2015-07-23 10:54:00 -04:00
Marc Dionne
e597b87967 Linux 4.2: Pass namespace to sock_create_kern
sock_create_kern gains an additional network namespace
argument.

Pass in the default system namesapce.

Change-Id: I640e9497510242788e5060759779785ffb563a81
Reviewed-on: http://gerrit.openafs.org/11925
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2015-07-23 10:53:39 -04:00
Marc Dionne
5c1237432e Linux 4.1: Don't define or use ->write directly
We no longer have to define a ->write operation, and we can't
expect the underlying disk cache filesystem to have one.  Use
the new __vfs_read/write helpers that will select the operation
to use based on what's available for that particular filesystem.

Change-Id: Iab923235308ff57348ffc2dc6d718dd64040656b
Reviewed-on: http://gerrit.openafs.org/11849
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2015-05-20 08:56:36 -04:00
Benjamin Kaduk
ccf353ede6 Mark Linux 2.4 as unsupported
The Linux 2.4 series (and older) will not be supported platforms
for OpenAFS 1.8 and later.  Detect these systems at configure time
and direct users of those systems to the OpenAFS 1.6 series of releases.

These systems are believed to not be in common use with OpenAFS,
and retaining support for the LinuxThreads threading implementation
they require presents a maintenance burden that the project is
not equipped to deliver.  The project will be able to move forward
more quickly by desupporting these systems.

Code conditional on these old systems can be removed in subsequent
commits.

Change-Id: I679fc2390b35851f3b0457a846047c812bc03dba
Reviewed-on: http://gerrit.openafs.org/11799
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>
2015-04-15 10:44:54 -04:00
Anders Kaseorg
5cca05d1a1 Linux 4: struct address_space no longer has backing_dev_info
The backing_dev_info is only stored in the super_block now.

Change-Id: I57e147100bd47a8d1f5e97224ceb3322ea102a48
Reviewed-on: http://gerrit.openafs.org/11756
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2015-02-25 01:04:33 -05:00