License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 21:07:57 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* linux/net/sunrpc/auth_null.c
|
|
|
|
*
|
|
|
|
* AUTH_NULL authentication. Really :-)
|
|
|
|
*
|
|
|
|
* Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/sunrpc/clnt.h>
|
|
|
|
|
2014-11-18 04:58:04 +07:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
|
2005-04-17 05:20:36 +07:00
|
|
|
# define RPCDBG_FACILITY RPCDBG_AUTH
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static struct rpc_auth null_auth;
|
|
|
|
static struct rpc_cred null_cred;
|
|
|
|
|
|
|
|
static struct rpc_auth *
|
2018-07-05 23:48:50 +07:00
|
|
|
nul_create(const struct rpc_auth_create_args *args, struct rpc_clnt *clnt)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
2018-10-14 21:40:29 +07:00
|
|
|
refcount_inc(&null_auth.au_count);
|
2005-04-17 05:20:36 +07:00
|
|
|
return &null_auth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
nul_destroy(struct rpc_auth *auth)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup NULL creds for current process
|
|
|
|
*/
|
|
|
|
static struct rpc_cred *
|
|
|
|
nul_lookup_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
|
|
|
|
{
|
2014-07-14 08:28:20 +07:00
|
|
|
if (flags & RPCAUTH_LOOKUP_RCU)
|
|
|
|
return &null_cred;
|
2005-04-17 05:20:36 +07:00
|
|
|
return get_rpccred(&null_cred);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy cred handle.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
nul_destroy_cred(struct rpc_cred *cred)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Match cred handle against current process
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
nul_match(struct auth_cred *acred, struct rpc_cred *cred, int taskflags)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Marshal credential.
|
|
|
|
*/
|
2006-09-27 12:29:38 +07:00
|
|
|
static __be32 *
|
|
|
|
nul_marshal(struct rpc_task *task, __be32 *p)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
*p++ = htonl(RPC_AUTH_NULL);
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = htonl(RPC_AUTH_NULL);
|
|
|
|
*p++ = 0;
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Refresh credential. This is a no-op for AUTH_NULL
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
nul_refresh(struct rpc_task *task)
|
|
|
|
{
|
2010-08-01 01:29:08 +07:00
|
|
|
set_bit(RPCAUTH_CRED_UPTODATE, &task->tk_rqstp->rq_cred->cr_flags);
|
2005-04-17 05:20:36 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-09-27 12:29:38 +07:00
|
|
|
static __be32 *
|
|
|
|
nul_validate(struct rpc_task *task, __be32 *p)
|
2005-04-17 05:20:36 +07:00
|
|
|
{
|
|
|
|
rpc_authflavor_t flavor;
|
|
|
|
u32 size;
|
|
|
|
|
|
|
|
flavor = ntohl(*p++);
|
|
|
|
if (flavor != RPC_AUTH_NULL) {
|
|
|
|
printk("RPC: bad verf flavor: %u\n", flavor);
|
2013-08-14 22:59:17 +07:00
|
|
|
return ERR_PTR(-EIO);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
size = ntohl(*p++);
|
|
|
|
if (size != 0) {
|
|
|
|
printk("RPC: bad verf size: %u\n", size);
|
2013-08-14 22:59:17 +07:00
|
|
|
return ERR_PTR(-EIO);
|
2005-04-17 05:20:36 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2007-06-24 07:17:58 +07:00
|
|
|
const struct rpc_authops authnull_ops = {
|
2005-04-17 05:20:36 +07:00
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.au_flavor = RPC_AUTH_NULL,
|
|
|
|
.au_name = "NULL",
|
|
|
|
.create = nul_create,
|
|
|
|
.destroy = nul_destroy,
|
|
|
|
.lookup_cred = nul_lookup_cred,
|
|
|
|
};
|
|
|
|
|
|
|
|
static
|
|
|
|
struct rpc_auth null_auth = {
|
2016-03-02 01:06:02 +07:00
|
|
|
.au_cslack = NUL_CALLSLACK,
|
|
|
|
.au_rslack = NUL_REPLYSLACK,
|
sunrpc: move NO_CRKEY_TIMEOUT to the auth->au_flags
A generic_cred can be used to look up a unx_cred or a gss_cred, so it's
not really safe to use the the generic_cred->acred->ac_flags to store
the NO_CRKEY_TIMEOUT flag. A lookup for a unx_cred triggered while the
KEY_EXPIRE_SOON flag is already set will cause both NO_CRKEY_TIMEOUT and
KEY_EXPIRE_SOON to be set in the ac_flags, leaving the user associated
with the auth_cred to be in a state where they're perpetually doing 4K
NFS_FILE_SYNC writes.
This can be reproduced as follows:
1. Mount two NFS filesystems, one with sec=krb5 and one with sec=sys.
They do not need to be the same export, nor do they even need to be from
the same NFS server. Also, v3 is fine.
$ sudo mount -o v3,sec=krb5 server1:/export /mnt/krb5
$ sudo mount -o v3,sec=sys server2:/export /mnt/sys
2. As the normal user, before accessing the kerberized mount, kinit with
a short lifetime (but not so short that renewing the ticket would leave
you within the 4-minute window again by the time the original ticket
expires), e.g.
$ kinit -l 10m -r 60m
3. Do some I/O to the kerberized mount and verify that the writes are
wsize, UNSTABLE:
$ dd if=/dev/zero of=/mnt/krb5/file bs=1M count=1
4. Wait until you're within 4 minutes of key expiry, then do some more
I/O to the kerberized mount to ensure that RPC_CRED_KEY_EXPIRE_SOON gets
set. Verify that the writes are 4K, FILE_SYNC:
$ dd if=/dev/zero of=/mnt/krb5/file bs=1M count=1
5. Now do some I/O to the sec=sys mount. This will cause
RPC_CRED_NO_CRKEY_TIMEOUT to be set:
$ dd if=/dev/zero of=/mnt/sys/file bs=1M count=1
6. Writes for that user will now be permanently 4K, FILE_SYNC for that
user, regardless of which mount is being written to, until you reboot
the client. Renewing the kerberos ticket (assuming it hasn't already
expired) will have no effect. Grabbing a new kerberos ticket at this
point will have no effect either.
Move the flag to the auth->au_flags field (which is currently unused)
and rename it slightly to reflect that it's no longer associated with
the auth_cred->ac_flags. Add the rpc_auth to the arg list of
rpcauth_cred_key_to_expire and check the au_flags there too. Finally,
add the inode to the arg list of nfs_ctx_key_to_expire so we can
determine the rpc_auth to pass to rpcauth_cred_key_to_expire.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
2016-06-08 02:14:48 +07:00
|
|
|
.au_flags = RPCAUTH_AUTH_NO_CRKEY_TIMEOUT,
|
2005-04-17 05:20:36 +07:00
|
|
|
.au_ops = &authnull_ops,
|
2006-06-09 20:34:34 +07:00
|
|
|
.au_flavor = RPC_AUTH_NULL,
|
2018-10-14 21:40:29 +07:00
|
|
|
.au_count = REFCOUNT_INIT(1),
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static
|
2007-06-24 07:17:58 +07:00
|
|
|
const struct rpc_credops null_credops = {
|
2005-04-17 05:20:36 +07:00
|
|
|
.cr_name = "AUTH_NULL",
|
|
|
|
.crdestroy = nul_destroy_cred,
|
2008-03-13 03:21:07 +07:00
|
|
|
.crbind = rpcauth_generic_bind_cred,
|
2005-04-17 05:20:36 +07:00
|
|
|
.crmatch = nul_match,
|
|
|
|
.crmarshal = nul_marshal,
|
|
|
|
.crrefresh = nul_refresh,
|
|
|
|
.crvalidate = nul_validate,
|
|
|
|
};
|
|
|
|
|
|
|
|
static
|
|
|
|
struct rpc_cred null_cred = {
|
2007-06-24 06:45:36 +07:00
|
|
|
.cr_lru = LIST_HEAD_INIT(null_cred.cr_lru),
|
2007-06-07 21:14:14 +07:00
|
|
|
.cr_auth = &null_auth,
|
2005-04-17 05:20:36 +07:00
|
|
|
.cr_ops = &null_credops,
|
2018-10-14 21:34:31 +07:00
|
|
|
.cr_count = REFCOUNT_INIT(2),
|
2007-06-25 21:15:15 +07:00
|
|
|
.cr_flags = 1UL << RPCAUTH_CRED_UPTODATE,
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|