aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2019-01-17 06:35:45 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2019-01-17 06:35:45 +0000
commit88640c0e8b6f503426cce9ea1337098c241d3801 (patch)
treef2ee08193db32edc9d3c8929e21ec8dceea54e32 /sys
parent0a34fc885b57ead048ff45433be268dc2ca48f8c (diff)
downloadsrc-88640c0e8b6f503426cce9ea1337098c241d3801.tar.gz
src-88640c0e8b6f503426cce9ea1337098c241d3801.zip
Create new EINTEGRITY error with message "Integrity check failed".
An integrity check such as a check-hash or a cross-correlation failed. The integrity error falls between EINVAL that identifies errors in parameters to a system call and EIO that identifies errors with the underlying storage media. EINTEGRITY is typically raised by intermediate kernel layers such as a filesystem or an in-kernel GEOM subsystem when they detect inconsistencies. Uses include allowing the mount(8) command to return a different exit value to automate the running of fsck(8) during a system boot. These changes make no use of the new error, they just add it. Later commits will be made for the use of the new error number and it will be added to additional manual pages as appropriate. Reviewed by: gnn, dim, brueffer, imp Discussed with: kib, cem, emaste, ed, jilles Differential Revision: https://reviews.freebsd.org/D18765
Notes
Notes: svn path=/head/; revision=343111
Diffstat (limited to 'sys')
-rw-r--r--sys/bsm/audit_errno.h1
-rw-r--r--sys/compat/cloudabi/cloudabi_errno.c1
-rw-r--r--sys/compat/linux/linux_errno.inc3
-rw-r--r--sys/security/audit/bsm_errno.c7
-rw-r--r--sys/sys/errno.h3
5 files changed, 13 insertions, 2 deletions
diff --git a/sys/bsm/audit_errno.h b/sys/bsm/audit_errno.h
index 81cfc3548e8e..9342dcd6f962 100644
--- a/sys/bsm/audit_errno.h
+++ b/sys/bsm/audit_errno.h
@@ -208,6 +208,7 @@
#define BSM_ERRNO_EKEYREJECTED 222 /* Linux-specific. */
#define BSM_ERRNO_ENOTCAPABLE 223 /* FreeBSD-specific. */
#define BSM_ERRNO_ECAPMODE 224 /* FreeBSD-specific. */
+#define BSM_ERRNO_EINTEGRITY 225 /* FreeBSD-specific. */
/*
* In the event that OpenBSM doesn't have a file representation of a local
diff --git a/sys/compat/cloudabi/cloudabi_errno.c b/sys/compat/cloudabi/cloudabi_errno.c
index 38520b9c262c..10304bad4af5 100644
--- a/sys/compat/cloudabi/cloudabi_errno.c
+++ b/sys/compat/cloudabi/cloudabi_errno.c
@@ -63,6 +63,7 @@ cloudabi_convert_errno(int error)
[EIDRM] = CLOUDABI_EIDRM,
[EILSEQ] = CLOUDABI_EILSEQ,
[EINPROGRESS] = CLOUDABI_EINPROGRESS,
+ [EINTEGRITY] = CLOUDABI_EINVAL,
[EINTR] = CLOUDABI_EINTR,
[EINVAL] = CLOUDABI_EINVAL,
[EIO] = CLOUDABI_EIO,
diff --git a/sys/compat/linux/linux_errno.inc b/sys/compat/linux/linux_errno.inc
index 4f9a6dae2e76..c2d4877e6f56 100644
--- a/sys/compat/linux/linux_errno.inc
+++ b/sys/compat/linux/linux_errno.inc
@@ -142,7 +142,8 @@ const int linux_errtbl[ELAST + 1] = {
-1, /* ECAPMODE -> EPERM */
-131, /* ENOTRECOVERABLE */
-130, /* EOWNERDEAD */
+ -22, /* EINTEGRITY -> EINVAL */
};
-_Static_assert(ELAST == 96,
+_Static_assert(ELAST == 97,
"missing errno entries in linux_errtbl");
diff --git a/sys/security/audit/bsm_errno.c b/sys/security/audit/bsm_errno.c
index fc069a7568f8..4e952870f672 100644
--- a/sys/security/audit/bsm_errno.c
+++ b/sys/security/audit/bsm_errno.c
@@ -243,6 +243,13 @@ static const struct bsm_errno bsm_errnos[] = {
ERRNO_NO_LOCAL_MAPPING,
#endif
ES("Process died with the lock") },
+ { BSM_ERRNO_EINTEGRITY,
+#ifdef EINTEGRITY
+ EINTEGRITY,
+#else
+ ERRNO_NO_LOCAL_MAPPING,
+#endif
+ ES("Integrity check failed") },
{ BSM_ERRNO_ENOTRECOVERABLE,
#ifdef ENOTRECOVERABLE
ENOTRECOVERABLE,
diff --git a/sys/sys/errno.h b/sys/sys/errno.h
index ad140ab14778..6994c0612f79 100644
--- a/sys/sys/errno.h
+++ b/sys/sys/errno.h
@@ -180,10 +180,11 @@ __END_DECLS
#define ECAPMODE 94 /* Not permitted in capability mode */
#define ENOTRECOVERABLE 95 /* State not recoverable */
#define EOWNERDEAD 96 /* Previous owner died */
+#define EINTEGRITY 97 /* Integrity check failed */
#endif /* _POSIX_SOURCE */
#ifndef _POSIX_SOURCE
-#define ELAST 96 /* Must be equal largest errno */
+#define ELAST 97 /* Must be equal largest errno */
#endif /* _POSIX_SOURCE */
#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)