lkml.org 
[lkml]   [2023]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH v2] x86: bring back rep movsq for user access on CPUs without ERMS
On Sun, 3 Sept 2023 at 11:49, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> So I have no idea why you claim that "currently they have no choice".
> glibc is simply being incredibly stupid, and using newfstatat() for no
> good reason.

Do you have any good benchmark that shows the effects of this?

And if you do, does the attached patch (ENTIRELY UNTESTED!) fix the
silly glibc mis-feature?

Linus
fs/stat.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/fs/stat.c b/fs/stat.c
index f19b124974f2..e187dc79a313 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -311,6 +311,15 @@ int vfs_fstatat(int dfd, const char __user *filename,
int statx_flags = flags | AT_NO_AUTOMOUNT;
struct filename *name;

+ /* Work around glibc being silly */
+ if (dfd >= 0 && flags == AT_EMPTY_PATH) {
+ char c;
+ if (!get_user(c, filename)) {
+ if (!c)
+ return vfs_fstat(dfd, stat);
+ }
+ }
+
name = getname_flags(filename, getname_statx_lookup_flags(statx_flags), NULL);
ret = vfs_statx(dfd, name, statx_flags, stat, STATX_BASIC_STATS);
putname(name);
\
 
 \ /
  Last update: 2023-09-03 22:09    [W:0.067 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site