+ /*
+ * Does the application expect PROT_READ to imply PROT_EXEC?
+ *
+ * (the exception is when the underlying filesystem is noexec
+ * mounted, in which case we dont add PROT_EXEC.)
+ */
+ if (!(reqprot & PROT_READ))
+ goto out;
+ if (!(current->personality & READ_IMPLIES_EXEC))
+ goto out;
+ if (!file) {
+ prot |= PROT_EXEC;
+ } else if (!(file->f_path.mnt->mnt_flags & MNT_NOEXEC)) {
+#ifndef CONFIG_MMU
+ unsigned long caps = 0;
+ struct address_space *mapping = file->f_mapping;
+ if (mapping && mapping->backing_dev_info)
+ caps = mapping->backing_dev_info->capabilities;
+ if (!(caps & BDI_CAP_EXEC_MAP))
+ goto out;
+#endif
+ prot |= PROT_EXEC;
+ }
+out: