Summary: | kernel: get_timespec64 does not ignore padding in compat syscalls | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Florian Weimer <fweimer> | |
Component: | kernel | Assignee: | Waiman Long <llong> | |
kernel sub component: | Kernel-Core | QA Contact: | Qiao Zhao <qzhao> | |
Status: | CLOSED ERRATA | Docs Contact: | ||
Severity: | urgent | |||
Priority: | urgent | CC: | brdeoliv, cye, honli, llong, rdma-dev-team, smeisner, tagoh, tkopecek, vondruch | |
Version: | 8.4 | Keywords: | Triaged, ZStream | |
Target Milestone: | beta | |||
Target Release: | 8.5 | |||
Hardware: | x86_64 | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | kernel-4.18.0-313.el8 | Doc Type: | No Doc Update | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | Red Hat2003569 (view as bug list) | Environment: | ||
Last Closed: | 2021-11-09 19:20:33 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Bug Depends On: | ||||
Bug Blocks: | 1963934, Red Hat2003569 |
Description
Florian Weimer
2021-05-27 14:25:00 UTC
Reproducer that can be built with gcc -m32 on Red Hat Enterprise Linux 8: #include <errno.h> #include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <sys/syscall.h> #include <unistd.h> int main (void) { errno = 0; uint64_t times[4] = { 1, 2 | (3ULL << 32), 4, 5 | (6ULL << 32) }; long ret = syscall (412, AT_FDCWD, "/proc/self/exe", times, 0); printf ("%ld, %m\n", ret); } “/opt/rh/gcc-toolset-10/root/usr/bin/strace ./a.out” shows: utimensat_time64(AT_FDCWD, "/proc/self/exe", [{tv_sec=1, tv_nsec=12884901890}, {tv_sec=4, tv_nsec=25769803781}], 0) = -1 EINVAL (Invalid argument) strace does not mask the padding, either, so the tv_nsec values are expected, but the EINVAL result is not. The system call should succeed. *** Bug 1965078 has been marked as a duplicate of this bug. *** (In reply to Florian Weimer from comment #0) > I'm looking at kernel-4.18.0-305.el8.x86_64. > > get_timespec64 in kernel/time/time.c does not clear the padding, I think: > > /* Zero out the padding for 32 bit systems or in compat mode */ > if (IS_ENABLED(CONFIG_64BIT_TIME) && (!IS_ENABLED(CONFIG_64BIT) || > in_compat_syscall())) > kts.tv_nsec &= 0xFFFFFFFFUL; > > In our kernels IS_ENABLED(CONFIG_64BIT_TIME) is false, so this code is not > compiled in, I think: Another side effect of the backport of time related patches to support time namespace. I will remove CONFIG_64BIT_TIME from the kernel source. Thanks for looking into this problem. -Longman Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: kernel security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2021:4356 |