Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp367162imm; Thu, 6 Sep 2018 03:51:42 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5thEZO8MX6IgzvIlATcMHEDObKMeEdGwZOKkzyjOA2LlPK2z3WJa5/wvN3ZtedUBjrL+t X-Received: by 2002:a63:170b:: with SMTP id x11-v6mr2038140pgl.364.1536231102137; Thu, 06 Sep 2018 03:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536231102; cv=none; d=google.com; s=arc-20160816; b=fdepekjwzYhydbMht3V0AkzDN9ET8p977HKmgdwRE8T0Jt+oJHicG5d0Fs+4FPOoj9 S93eTEesgD3HhnWouf8hdIdtIetxjgajYjEcgH9o7Ssl+pPtEvj6S1TM6JMYyQD+Gy5S I+6ZYbFLetk2y7IWqRAido678R5xdxkWayUSoMHWGtSS54w786DamrWzPQKNZWua72DY +JNUXUq+YlY3eCGCxVKNiGEHlSNl8fenTuRSyJipFvQCBVu9R9Ptl0mhKJX7P+38vZyR Zddqsl5ixlG7oylCIfx3IkoDpzJPAbiqE9uC9koa4BkvcwrbRZQTSxeAcB6zLhSf8Rl9 JaZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=GdDoGGGCnDzwoVBcTkzvGUgTIWTGiOZCABgdNN8twlc=; b=m6yK0diKvIsDC7xDh832L65Q8vfns20cP5Twf97npwyf/it1cWzDpaVMQgunfNJFN2 B5kSMwFBd3ga82+29qhmXvqUDxCQjOeF3/HIH5ejFJC1RaprpTDFs39/Q7y+inDXSADS JN+CEjeyMcdOV8J73ERVSudid7AJFP115OG5tkBgM+CnjoQDsCgmR/dFrOaUSg1Xaiu+ i8Zyjf03lwo9TS7dcYQEHJTSKsiFLfRLs5ndjGVUrw/DT9HAR1S+IzAFAkiCgRI+DSXg t55yJpytQ6Z3aW7HZZlPTpihkkd17TLOIgxJqwyY1qpqYqRBCD19JABOFBd6A7FPWhFf ohGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=fAZ8awyf; 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 17-v6si4860731pgl.166.2018.09.06.03.51.26; Thu, 06 Sep 2018 03:51:42 -0700 (PDT) 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; dkim=pass header.i=@sifive.com header.s=google header.b=fAZ8awyf; 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 S1728419AbeIFOT5 (ORCPT + 99 others); Thu, 6 Sep 2018 10:19:57 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33597 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728041AbeIFOTz (ORCPT ); Thu, 6 Sep 2018 10:19:55 -0400 Received: by mail-wm0-f67.google.com with SMTP id r1-v6so13909808wmh.0 for ; Thu, 06 Sep 2018 02:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=GdDoGGGCnDzwoVBcTkzvGUgTIWTGiOZCABgdNN8twlc=; b=fAZ8awyfPTfYxIfY7+BEHeT1wILEQ9TmvGEp9CxcokFhDQoIDe3UwPVyWDOP0NA7AQ fDLNWgWUM+OG0W02LjAcUeXUTulZk6idxbEcCX00vHfKe98cD+c/9T9qUsw7vxLhK1AL U39FBX5uXWukCQ9qNYN2cqlBm+EWjL6w4NZwMi9bY+GhqeVxQYorTJPiApkL/sVHUbFi QZrCf1arub5zkIN439iPg5PgZzgRjXH/4gTWWV+GHL72/WtYlNmgCGjE6OKmtxZD1Zxq NPfF9Sl90NTL2mcpME0bBoXBDFEdCUOPqQzVV16C5AeZC/xE7wSoHpQTZGbuPo5MH1iI g1vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=GdDoGGGCnDzwoVBcTkzvGUgTIWTGiOZCABgdNN8twlc=; b=LCdNSCM8VNANc+FujzYDwa3wrdqFWRAx5kL5B9lAK4GLM7SLKBovkS0KTrT6YB9J8E Zwy+DHd6Dcj29lmeJnSug4E5vrdzzvS6tvr01IY8l4ucVy2IGdhPqRgwXzsUQhEnlQjw U7buoouzvxPWOc9s4Q2vYLNBcL4ubTKBVXEM72oabJGRTqpbpnEDWWtjcQwNZGUFlzQk kM1QNkF88Jb4FEN6EjIcQpBdVpN16G3WY/f0/QPZN+4kQBtLC4LjFY1FiDcD8w2nC2tA Cuj/0bmIs4PxSD+3hk9PNN6HcaKleFvVEpfgs+fdEANbjHdbaBukJxzeD3kj0NXdzHwC BZCw== X-Gm-Message-State: APzg51De4nwgRN0TcBsEJr95MhgspkXaptehqOkJUnMvKcUlki5WGS5j 3uX3tZDKQ3Q4SOhgym1E5pcmjLDNUR/3Nw== X-Received: by 2002:a1c:b157:: with SMTP id a84-v6mr1521959wmf.18.1536227116047; Thu, 06 Sep 2018 02:45:16 -0700 (PDT) Received: from localhost (smb-adpcdg1-01.hotspot.hub-one.net. [213.174.99.129]) by smtp.gmail.com with ESMTPSA id k13-v6sm3425599wrq.7.2018.09.06.02.45.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 02:45:15 -0700 (PDT) Date: Thu, 06 Sep 2018 02:45:15 -0700 (PDT) X-Google-Original-Date: Wed, 05 Sep 2018 22:27:13 PDT (-0700) Subject: Re: [PATCH] y2038: Remove newstat family from default syscall set In-Reply-To: <20180901174353.GA14271@roeck-us.net> CC: Arnd Bergmann , aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: linux@roeck-us.net Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 01 Sep 2018 10:43:53 PDT (-0700), linux@roeck-us.net wrote: > Hi Arnd, > > On Fri, Apr 13, 2018 at 11:50:12AM +0200, Arnd Bergmann wrote: >> We have four generations of stat() syscalls: >> - the oldstat syscalls that are only used on the older architectures >> - the newstat family that is used on all 64-bit architectures but >> lacked support for large files on 32-bit architectures. >> - the stat64 family that is used mostly on 32-bit architectures to >> replace newstat >> - statx() to replace all of the above, adding 64-bit timestamps among >> other things. >> >> We already compile stat64 only on those architectures that need it, >> but newstat is always built, including on those that don't reference >> it. This adds a new __ARCH_WANT_NEW_STAT symbol along the lines of >> __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 to control compilation of >> newstat. All architectures that need it use an explict define, the >> others now get a little bit smaller, and future architecture (including >> 64-bit targets) won't ever see it. >> > > This patch causes my riscv boot tests to crash in -next Ah, thanks for running these! > sbin/init: error while loading shared libraries: libc.so.6: cannot stat shared object: Error 38 > Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 > > The following change fixes the problem for me, but of course I have no idea > if it is correct. Copying RISC-V maintainers for input. > > Guenter > > --- > diff --git a/arch/riscv/include/asm/unistd.h b/arch/riscv/include/asm/unistd.h > index 0caea01d5cca..eff7aa9aa163 100644 > --- a/arch/riscv/include/asm/unistd.h > +++ b/arch/riscv/include/asm/unistd.h > @@ -16,6 +16,7 @@ > * be included multiple times. See uapi/asm/syscalls.h for more info. > */ > > +#define __ARCH_WANT_NEW_STAT > #define __ARCH_WANT_SYS_CLONE > #include > #include I'm afraid I'm not sure what the right thing to do here is either, but from the patch description it does seem like we should have this guarded by an "#ifdef CONFIG_32BIT" so we can keep it out of our 32-bit ABI (which isn't in glibc yet, so isn't stable) in favor of statx() (or maybe stat64()?). The one problem here is that I can't find "newstat" anywhere in glibc to verify it's actually supposed to be part of our 64-bit ABI, though I can find a bunch of references to "statx" that seem to indicate it's meant to be present. That said, assuming you don't have anything wacky going on in userspace if this breaks the ABI then it breaks the ABI, so however newstat got into a binary we still need to keep it around. Poking around my Fedora glibc image I see 000000000009b040 <__xstat>: 9b040: e51d bnez a0,9b06e <__xstat+0x2e> 9b042: 04f00893 li a7,79 9b046: f9c00513 li a0,-100 9b04a: 4681 li a3,0 9b04c: 00000073 ecall which seems to coorespond with sys_newfstatat, which indicates to me we should have it in the 64-bit ABI.