On Fri, Mar 20, 2020 at 01:05:14PM +0000, Vincenzo Frascino wrote: > On 3/19/20 6:10 PM, Catalin Marinas wrote: > > On Thu, Mar 19, 2020 at 12:38:42PM +0000, Vincenzo Frascino wrote: > >> On 3/18/20 6:36 PM, Catalin Marinas wrote: > >>> On Wed, Mar 18, 2020 at 04:14:26PM +0000, Vincenzo Frascino wrote: > >>>> On 3/17/20 5:48 PM, Catalin Marinas wrote: > >>>>> So clock_gettime() on arm32 always falls back to the syscall? > >>>> > >>>> This seems not what you asked, and I think I answered accordingly. Anyway, in > >>>> the case of arm32 the error code path is handled via syscall fallback. > >>>> > >>>> Look at the code below as an example (I am using getres because I know this > >>>> email will be already too long, and I do not want to add pointless code, but the > >>>> concept is the same for gettime and the others): > >>>> > >>>> static __maybe_unused > >>>> int __cvdso_clock_getres(clockid_t clock, struct __kernel_timespec *res) > >>>> { > >>>> int ret = __cvdso_clock_getres_common(clock, res); > >>>> > >>>> if (unlikely(ret)) > >>>> return clock_getres_fallback(clock, res); > >>>> return 0; > >>>> } > >>>> > >>>> When the return code of the "vdso" internal function returns an error the system > >>>> call is triggered. > >>> > >>> But when __cvdso_clock_getres_common() does *not* return an error, it > >>> means that it handled the clock_getres() call without a fallback to the > >>> syscall. I assume this is possible on arm32. When the clock_getres() is > >>> handled directly (not as a syscall), why doesn't arm32 need the same > >>> (res >= TASK_SIZE) check? > >> > >> Ok, I see what you mean. > > > > I'm not sure. > > Thank you for the long chat this morning. As we agreed I am going to repost the > patches removing the checks discussed in this thread Great, thanks. > and we will address the syscall ABI difference subsequently with a > different series. Now I'm even less convinced we need any additional patches. The arm64 compat syscall would still return -EFAULT for res >= TASK_SIZE_32 because copy_to_user() will fail. So it would be entirely consistent with the arm32 syscall. In the vdso-only case, both arm32 and arm64 compat would generate a signal. As Will said, arguably, the syscall semantics may not be applicable to the vdso implementation. But if you do want to get down this route (tp = UINTPTR_MAX - sizeof(*tp) returning -EFAULT), please do it for all architectures, not just arm64 compat. However, I'm not sure anyone relies on this functionality, other than the vdsotest, so no real application broken. -- Catalin