# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/linux/hotfix-mount.patch.sparc64 # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- d563d678aa0 in 2020 causes some page table corruption ot TLB invalidation on sparc, revert for now until is further analyzed. --- b/fs/namespace.c +++ a/fs/namespace.c @@ -3075,7 +3075,7 @@ void *copy_mount_options(const void __user * data) { char *copy; + unsigned size; - unsigned left, offset; if (!data) return NULL; @@ -3084,27 +3084,16 @@ if (!copy) return ERR_PTR(-ENOMEM); + size = PAGE_SIZE - offset_in_page(data); - left = copy_from_user(copy, data, PAGE_SIZE); + if (copy_from_user(copy, data, size)) { - /* - * Not all architectures have an exact copy_from_user(). Resort to - * byte at a time. - */ - offset = PAGE_SIZE - left; - while (left) { - char c; - if (get_user(c, (const char __user *)data + offset)) - break; - copy[offset] = c; - left--; - offset++; - } - - if (left == PAGE_SIZE) { kfree(copy); return ERR_PTR(-EFAULT); } + if (size != PAGE_SIZE) { + if (copy_from_user(copy + size, data + size, PAGE_SIZE - size)) + memset(copy + size, 0, PAGE_SIZE - size); + } - return copy; }