Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17335572ybl; Thu, 2 Jan 2020 03:30:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz1Pmb+MYKPZi4VB4Sk3z01apMQTHcV9JadXqVZlcp+qZ9fuvSah3WJA324qwPFY+P4pSZc X-Received: by 2002:a05:6830:18ed:: with SMTP id d13mr27479145otf.208.1577964632260; Thu, 02 Jan 2020 03:30:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577964632; cv=none; d=google.com; s=arc-20160816; b=DNs2hyXtnfonYRF5bSY8wfBbFLDe46gS6TCi7/VMkwo+knz8ZEazmyB7zIlqIWx7ka VscXILpobUL3aDZvPeIoGNMImzx86/4WPyfG99caiJADDo7B6fq0k/69BqLMqdiAcrIR 7hNGf4YR5SIUr+XN5BHb77ssgwLb+VdPBit9YE5smog9yIBf6utIftf+q5mdDFi7mpnj GqWVfSyhb3OSFbUAcTm29oxGGF4WTaQWv+KthmaY1rXMJLLyI3LqPEPczlIj8eJGv0Or jEoG1UAgZTK4WFp3MQbC6bD4Lim2x3s4mZ63yzGJjfvoO9G+5vasD+QIkojJJiRQ9bVM CWvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=FBBB88tSHmls6FLgW9Bs5WGzNU2swMStjG6z5VlbNRY=; b=so/kjgwLB4+XOqCHcXmDJbliZM4II1Z9mJxwQ8KOzdqMV3dhH3LN51cfP/uhbqsfTZ raW2onZGOqYXUV6iUnugaBBPlGkzztleIbMFMubMLtJEdGwNteOBuL58Z3vXXY3c60Iv sWh25VKN1MBLID2ZDNQ6Nvm4LRIHEPASLtG3tRxls9Eb9uptmCZEoSwcHE/IYJwjhR6m adY9YBJ6d8ewSDK4ZE9jQmwKPTmSduOo22C5emsm/S5rtpcgLgrz+q3wiRj/hL3KlGSL x6Alf7/0bFnqTwajCoV600eXA6ms2hksXYKTMZ8Wgmh77Z2SV0dCeckyDaZ0PValZISS 6abg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si25302277otn.110.2020.01.02.03.30.17; Thu, 02 Jan 2020 03:30:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbgABL3c (ORCPT + 99 others); Thu, 2 Jan 2020 06:29:32 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:36751 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728135AbgABL3c (ORCPT ); Thu, 2 Jan 2020 06:29:32 -0500 Received: from mail-qv1-f41.google.com ([209.85.219.41]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPSA (Nemesis) id 1M8k65-1ir5Oi3qUL-004kBN; Thu, 02 Jan 2020 12:29:30 +0100 Received: by mail-qv1-f41.google.com with SMTP id o18so14908036qvf.1; Thu, 02 Jan 2020 03:29:29 -0800 (PST) X-Gm-Message-State: APjAAAV8BPCiPeSM5KLBV8looieXCZJ+AERsxfoByh6+uGLNrvTlX40e +kxY54zq4crDG3UnOveQ51eqVxno9qnKf53g+K4= X-Received: by 2002:a0c:bd20:: with SMTP id m32mr63056221qvg.197.1577964568705; Thu, 02 Jan 2020 03:29:28 -0800 (PST) MIME-Version: 1.0 References: <47701b5fb73cf536db074031db8e6e3fa3695168.1577111365.git.christophe.leroy@c-s.fr> In-Reply-To: From: Arnd Bergmann Date: Thu, 2 Jan 2020 12:29:12 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 01/10] lib: vdso: ensure all arches have 32bit fallback To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Thomas Gleixner , Vincenzo Frascino , Andy Lutomirski , "linux-kernel@vger.kernel.org" , linuxppc-dev , Linux ARM , "open list:BROADCOM NVRAM DRIVER" , "the arch/x86 maintainers" Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:6xdXzRg9VpWyJjPDxnqKeILf/1Ib2ZdGGXZNLurLjP1YEaW9OWX MBiMEpDPhR0rFp3y+Qfy0qhY+rWB7mBAVqv9yjoypUyhUUebq/Ee2R9xbqIe9aC7sJxOZ9X FXabUM+WPC7UfbKyu6lS0M1ye8+6WCteZ/4RD28MC52NMdEbJ7cmiA0F4Yura0ipln20ceE AiITv0xUUHFzWnCanJKLQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:/iddvcBU3ds=:geESGrCH9H7D8+t0Jy+RCb JqS2xbP93oTlRsxVSlcuv+KBl1MfH8lIYs/3ZbNXXxbjAn0K6O4GWvbToDuba7Pmw9KLVqGya w43Ogf9yMZZJoSxGFGS5enGKShS+uYNkzmreDQgOUyuGIlownURMOLD+DMrqNScOIK/bFMpxs Z+0omHEibdO696axuGji7OV1SxEswIr18PZgt/mFCF6UYnNzX9StuuzaYX+Qnq561DslNVxHT WiYNVHMZqiG42tmE7aqNebW5na+fT1lLFX1XLH6QMLdO+RQlUdCJuzX21CkQOpEmisypokgXb sruWQ5ZWqlJumxfiRqurYiXz00m+JTivdvDr9KkljXkppPQvZZKa6wTq/k5xcyiJ56/dM87ze A6hcpdYgf+7u5jE8hlqryV/2XGxJlicHR796F87buGuYqBBrTP7TZM6Rw+v3ufvQCMyN5Co3n VuZTcGcU/2I34NA2W+TM4TWZOmuo138AXFAzHaUzUnZpILM2sbjbAujh5dUpPH587cgZZibRD EP74gEOpUHyhjvNWKDFMeV3HLEks19KFwT0H7CnxsfIqCZkUFvc+MEWnUmSPRfwnEaAsfAw6r zxrwz+qIogRj1BYVSycbXtJChz1JSP1xoy3vwZC298Sn4hJTNOOde3maLPlHYWUCWTrjghKM2 czEB32vXGz4qCxkvQW3+MQ5qU7s5evoc3P1Z2LoiC1mC9VKn8xiaUrKEVH108cVw9aFOuI7GY Fc6Pjn47kP1kUdke54vCQRGVVXqRTo/2kkVIxQinNCi5DSORVuRHOdNaGJnwUbcFIxp/BXsAU OMvngzLJd5v5w2rzOC9eSGUx30qoi190SdFnCbdPFJ7xgnEI0XGSRWqJsZ8b8OT5yGfuc9n3c WRZhzr+pDef76AKC8jvg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 30, 2019 at 1:27 PM Arnd Bergmann wrote: > On Mon, Dec 23, 2019 at 3:31 PM Christophe Leroy wrote: > > +static __always_inline > > +long clock_getres32_fallback(clockid_t _clkid, struct old_timespec32 *_ts) > > +{ > > + struct __kernel_timespec ts; > > + int ret = clock_getres_fallback(clock, &ts); > > + > > + if (likely(!ret && _ts)) { > > + _ts->tv_sec = ts.tv_sec; > > + _ts->tv_nsec = ts.tv_nsec; > > + } > > + return ret; > > +} > > Please change these to call __NR_clock_gettime and __NR_clock_getres_time > instead of __NR_clock_gettime64/__NR_clock_getres_time64 for multiple reasons. > > - When doing migration between containers, the vdso may get copied into > an application running on a kernel that does not support the time64 > variants, and then the fallback fails. > > - When CONFIG_COMPAT_32BIT_TIME is disabled, the time32 syscalls > return -ENOSYS, and the vdso version should have the exact same behavior > to avoid surprises. In particular an application that checks clock_gettime() > to see if the time32 are in part of the kernel would get an incorrect result > here. > > arch/arm64/include/asm/vdso/compat_gettimeofday.h already does this, > I think you can just copy the implementation or find a way to share it. There was a related discussion on this after a vdso regression on mips, and I suggested to drop the time32 functions completely from the vdso when CONFIG_COMPAT_32BIT_TIME is disabled, such as diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S index 00c025ba4a92..605f259fa24c 100644 --- a/arch/powerpc/kernel/vdso32/vdso32.lds.S +++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S @@ -145,10 +145,12 @@ VERSION __kernel_get_syscall_map; #ifndef CONFIG_PPC_BOOK3S_601 +#ifdef CONFIG_COMPAT_32BIT_TIME __kernel_gettimeofday; __kernel_clock_gettime; __kernel_clock_getres; __kernel_time; +#endif __kernel_get_tbfreq; #endif __kernel_sync_dicache; Any opinions on this? If everyone agrees with that approach, I can send a cross-architecture patch to do this everywhere. It's probably best though if Christophe adds that to his series as it touches a lot of the same files and I would prefer to avoid conflicting changes. Arnd