diff --git a/fs/Kconfig b/fs/Kconfig
index 83eab52fb3f6..18ce4032e177 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -173,6 +173,7 @@ config TMPFS_POSIX_ACL
 config TMPFS_XATTR
 	bool "Tmpfs extended attributes"
 	depends on TMPFS
+	depends on XATTR_SYSCALLS
 	default n
 	help
 	  Extended attributes are name:value pairs associated with inodes by
diff --git a/fs/Makefile b/fs/Makefile
index 7bbaca9c67b1..1645965883bc 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -9,7 +9,7 @@ obj-y :=	open.o read_write.o file_table.o super.o \
 		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
 		ioctl.o readdir.o select.o dcache.o inode.o \
 		attr.o bad_inode.o file.o filesystems.o namespace.o \
-		seq_file.o xattr.o libfs.o fs-writeback.o \
+		seq_file.o libfs.o fs-writeback.o \
 		pnode.o splice.o sync.o utimes.o \
 		stack.o fs_struct.o statfs.o fs_pin.o nsfs.o
 
@@ -32,6 +32,7 @@ obj-$(CONFIG_AIO)               += aio.o
 obj-$(CONFIG_FS_DAX)		+= dax.o
 obj-$(CONFIG_FS_ENCRYPTION)	+= crypto/
 obj-$(CONFIG_FILE_LOCKING)      += locks.o
+obj-$(CONFIG_XATTR_SYSCALLS)	+= xattr.o
 obj-$(CONFIG_COMPAT)		+= compat.o compat_ioctl.o
 obj-$(CONFIG_BINFMT_AOUT)	+= binfmt_aout.o
 obj-$(CONFIG_BINFMT_EM86)	+= binfmt_em86.o
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig
index 034f00f21390..3352f6b3efed 100644
--- a/fs/cifs/Kconfig
+++ b/fs/cifs/Kconfig
@@ -94,6 +94,7 @@ config CIFS_UPCALL
 config CIFS_XATTR
         bool "CIFS extended attributes"
         depends on CIFS
+	depends on XATTR_SYSCALLS
         help
           Extended attributes are name:value pairs associated with inodes by
           the kernel or by users (see the attr(5) manual page, or visit
diff --git a/fs/ext2/Kconfig b/fs/ext2/Kconfig
index c634874e12d9..9b16a31785a1 100644
--- a/fs/ext2/Kconfig
+++ b/fs/ext2/Kconfig
@@ -11,6 +11,7 @@ config EXT2_FS
 config EXT2_FS_XATTR
 	bool "Ext2 extended attributes"
 	depends on EXT2_FS
+	depends on XATTR_SYSCALLS
 	help
 	  Extended attributes are name:value pairs associated with inodes by
 	  the kernel or by users (see the attr(5) manual page, or visit
diff --git a/fs/f2fs/Kconfig b/fs/f2fs/Kconfig
index 378c221d68a9..3594db075cce 100644
--- a/fs/f2fs/Kconfig
+++ b/fs/f2fs/Kconfig
@@ -32,6 +32,7 @@ config F2FS_STAT_FS
 config F2FS_FS_XATTR
 	bool "F2FS extended attributes"
 	depends on F2FS_FS
+	depends on XATTR_SYSCALLS
 	default y
 	help
 	  Extended attributes are name:value pairs associated with inodes by
diff --git a/fs/jffs2/Kconfig b/fs/jffs2/Kconfig
index d8bb6c411e96..c1646416c94f 100644
--- a/fs/jffs2/Kconfig
+++ b/fs/jffs2/Kconfig
@@ -65,6 +65,7 @@ config JFFS2_SUMMARY
 config JFFS2_FS_XATTR
 	bool "JFFS2 XATTR support"
 	depends on JFFS2_FS
+	depends on XATTR_SYSCALLS
 	default n
 	help
 	  Extended attributes are name:value pairs associated with inodes by
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
index 7cd46666ba2c..98adeaa2b312 100644
--- a/fs/reiserfs/Kconfig
+++ b/fs/reiserfs/Kconfig
@@ -55,6 +55,7 @@ config REISERFS_PROC_INFO
 config REISERFS_FS_XATTR
 	bool "ReiserFS extended attributes"
 	depends on REISERFS_FS
+	depends on XATTR_SYSCALLS
 	help
 	  Extended attributes are name:value pairs associated with inodes by
 	  the kernel or by users (see the attr(5) manual page, or visit
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index ffb093e72b6c..083de02a2ab5 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -100,6 +100,7 @@ endchoice
 config SQUASHFS_XATTR
 	bool "Squashfs XATTR support"
 	depends on SQUASHFS
+	depends on XATTR_SYSCALLS
 	help
 	  Saying Y here includes support for extended attributes (xattrs).
 	  Xattrs are name:value pairs associated with inodes by
diff --git a/fs/xattr.c b/fs/xattr.c
index 7e3317cf4045..c97ae8365775 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -784,30 +784,6 @@ generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
 }
 EXPORT_SYMBOL(generic_listxattr);
 
-/**
- * xattr_full_name  -  Compute full attribute name from suffix
- *
- * @handler:	handler of the xattr_handler operation
- * @name:	name passed to the xattr_handler operation
- *
- * The get and set xattr handler operations are called with the remainder of
- * the attribute name after skipping the handler's prefix: for example, "foo"
- * is passed to the get operation of a handler with prefix "user." to get
- * attribute "user.foo".  The full name is still "there" in the name though.
- *
- * Note: the list xattr handler operation when called from the vfs is passed a
- * NULL name; some file systems use this operation internally, with varying
- * semantics.
- */
-const char *xattr_full_name(const struct xattr_handler *handler,
-			    const char *name)
-{
-	size_t prefix_len = strlen(xattr_prefix(handler));
-
-	return name - prefix_len;
-}
-EXPORT_SYMBOL(xattr_full_name);
-
 /*
  * Allocate new xattr and copy in the value; but leave the name to callers.
  */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index e77605a0c8da..b1d8ec5b2003 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -37,8 +37,6 @@ struct xattr_handler {
 		   size_t size, int flags);
 };
 
-const char *xattr_full_name(const struct xattr_handler *, const char *);
-
 struct xattr {
 	const char *name;
 	void *value;
@@ -46,6 +44,9 @@ struct xattr {
 };
 
 ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
+
+#ifdef CONFIG_XATTR_SYSCALLS
+
 ssize_t __vfs_getxattr(struct dentry *, struct inode *, const char *, void *, size_t);
 ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
 ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
@@ -59,11 +60,97 @@ ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_siz
 ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
 			   char **xattr_value, size_t size, gfp_t flags);
 
+#else
+
+static inline ssize_t __vfs_getxattr(struct dentry *dentry, struct inode *inode,
+		const char *name, void *value, size_t size)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline ssize_t vfs_getxattr(struct dentry *dentry, const char *name,
+		void *value, size_t size)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline ssize_t vfs_listxattr(struct dentry *dentry, char *list, size_t size)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int __vfs_setxattr(struct dentry *dentry, struct inode *inode,
+		const char *name, const void *value, size_t size, int flags)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int __vfs_setxattr_noperm(struct dentry *dentry, const char *name,
+		const void *value, size_t size, int flags)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline ssize_t vfs_setxattr(struct dentry *dentry, const char *name,
+		const void *value, size_t size, int flags)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int __vfs_removexattr(struct dentry *dentry, const char *name)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int vfs_removexattr(struct dentry *dentry, const char *name)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline ssize_t generic_listxattr(struct dentry *dentry, char *buffer,
+		size_t buffer_size)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline ssize_t vfs_getxattr_alloc(struct dentry *dentry,
+		const char *name, char **xattr_value, size_t xattr_size,
+		gfp_t flags)
+{
+	return -EOPNOTSUPP;
+}
+
+#endif  /* CONFIG_XATTR_SYSCALLS */
+
+
 static inline const char *xattr_prefix(const struct xattr_handler *handler)
 {
 	return handler->prefix ?: handler->name;
 }
 
+/**
+ * xattr_full_name  -  Compute full attribute name from suffix
+ *
+ * @handler:	handler of the xattr_handler operation
+ * @name:	name passed to the xattr_handler operation
+ *
+ * The get and set xattr handler operations are called with the remainder of
+ * the attribute name after skipping the handler's prefix: for example, "foo"
+ * is passed to the get operation of a handler with prefix "user." to get
+ * attribute "user.foo".  The full name is still "there" in the name though.
+ *
+ * Note: the list xattr handler operation when called from the vfs is passed a
+ * NULL name; some file systems use this operation internally, with varying
+ * semantics.
+ */
+static inline const char *xattr_full_name(const struct xattr_handler *handler,
+		const char *name)
+{
+	size_t prefix_len = strlen(xattr_prefix(handler));
+
+	return name - prefix_len;
+}
+
 struct simple_xattrs {
 	struct list_head head;
 	spinlock_t lock;
@@ -98,6 +185,8 @@ static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
 	}
 }
 
+#ifdef CONFIG_XATTR_SYSCALLS
+
 struct simple_xattr *simple_xattr_alloc(const void *value, size_t size);
 int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
 		     void *buffer, size_t size);
@@ -108,4 +197,37 @@ ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs, cha
 void simple_xattr_list_add(struct simple_xattrs *xattrs,
 			   struct simple_xattr *new_xattr);
 
+#else
+
+static inline struct simple_xattr *simple_xattr_alloc(const void *value,
+		size_t size)
+{
+	return NULL;
+}
+
+static inline int simple_xattr_get(struct simple_xattrs *xattrs,
+		const char *name, void *buffer, size_t size)
+{
+	return -ENODATA;
+}
+
+static inline int simple_xattr_set(struct simple_xattrs *xattrs,
+		const char *name, const void *value, size_t size, int flags)
+{
+	return -ENODATA;
+}
+
+static inline ssize_t simple_xattr_list(struct inode *inode,
+		struct simple_xattrs *xattrs, char *buffer, size_t size)
+{
+	return -ERANGE;
+}
+
+static inline void simple_xattr_list_add(struct simple_xattrs *xattrs,
+		struct simple_xattr *new_xattr)
+{
+}
+
+#endif  /* CONFIG_XATTR_SYSCALLS */
+
 #endif	/* _LINUX_XATTR_H */
diff --git a/init/Kconfig b/init/Kconfig
index a92f27da4a27..bfb954adc1e6 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1460,6 +1460,17 @@ config SYSCTL_SYSCALL
 
 	  If unsure say N here.
 
+config XATTR_SYSCALLS
+	bool "Support for the xattr family of syscalls" if EXPERT
+	default y
+	help
+	  The xattr family of syscalls are used to access extended file
+	  attributes from userspace. If you are using a filesystem or
+	  userspace that does not use or require the system calls, they
+	  can be compiled out.
+
+	  If unsure say Y here.
+
 config POSIX_TIMERS
 	bool "Posix Clocks & timers" if EXPERT
 	default y
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 8acef8576ce9..6f6b8105545d 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -178,6 +178,18 @@ cond_syscall(sys_setfsgid);
 cond_syscall(sys_capget);
 cond_syscall(sys_capset);
 cond_syscall(sys_copy_file_range);
+cond_syscall(sys_setxattr);
+cond_syscall(sys_lsetxattr);
+cond_syscall(sys_fsetxattr);
+cond_syscall(sys_getxattr);
+cond_syscall(sys_lgetxattr);
+cond_syscall(sys_fgetxattr);
+cond_syscall(sys_listxattr);
+cond_syscall(sys_llistxattr);
+cond_syscall(sys_flistxattr);
+cond_syscall(sys_removexattr);
+cond_syscall(sys_lremovexattr);
+cond_syscall(sys_fremovexattr);
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read);
diff --git a/security/integrity/evm/Kconfig b/security/integrity/evm/Kconfig
index e825e0ae78e7..56f76bfd5cfb 100644
--- a/security/integrity/evm/Kconfig
+++ b/security/integrity/evm/Kconfig
@@ -28,6 +28,7 @@ config EVM_ATTR_FSUUID
 config EVM_EXTRA_SMACK_XATTRS
 	bool "Additional SMACK xattrs"
 	depends on EVM && SECURITY_SMACK
+	depends on XATTR_SYSCALLS
 	default n
 	help
 	  Include additional SMACK xattrs for HMAC calculation.
