From nobody Mon May 16 19:44:28 2022 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C4BD81B35B04 for ; Mon, 16 May 2022 19:44:31 +0000 (UTC) (envelope-from paulf2718@gmail.com) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4L28pQ6pxXz4typ for ; Mon, 16 May 2022 19:44:30 +0000 (UTC) (envelope-from paulf2718@gmail.com) Received: by mail-wm1-x32d.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso216221wma.0 for ; Mon, 16 May 2022 12:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=PkL50bRqUixDHjUY5xyRKQR1M0WkuDQjZn/7qZcViW4=; b=BHZnEWk3lpbQ7RfHwejTWtJvJeRgb2d2nW0j4hYITQKdII4Rz3xgNLOk/2WQkJy0SY 5wNIfhs5wlegv6ek5rOVzpOwsf4U+r3XVcB67KWzyArVP/0dqRirbyqBC671HacMuMbT I64UxK1vn3Afmv7C7pZ8itZTbi+2ob/xpbYVojQk4w6Gmg1t+oGcieHuVWvq48VrxNX2 3hj2+t9U8EAg8kFuisE9xKPrC4KYYSUj/cKeCB4yjilDpSRFZFfm0jgw/9EpWYz8yZpS 4rB0T/05Ok2p9OZjvO+jbvMvcMypIUEGzdC+R26+AW3eBzWHVC3MlAjDqJSIADbMLLkJ k0mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=PkL50bRqUixDHjUY5xyRKQR1M0WkuDQjZn/7qZcViW4=; b=exWeGOcqzpFlCcLztP0KUz3t9+ipJyoUIjHP4DIomLA3GbTAuC4BaZxP733WKF/faw /8ehGbUoNKhgN7N/b0T46VaS//bbfhyDnbrpcr3nNhFkaiHQW0RhooZ2ZyvWc4NPLGYW FBAlAmpwfIDabsE5rFgD9VGk4ByU+WI/BJn0oQAR7vmyz99FntXCiad6hkhNTPz4Bw8n 61LbtwQvozPOHwFQJgnOz5eWPADx7/OYXL46Wz1SjfUaLyd1jSeXbelRnEH0aiVAUjaT Tp9YnHb0uoIp7JW2EwvzuAAKxg9VcLzqGb6m05BwjAipHAcgN4VCsK+H5yEMmCa12zuO KDkg== X-Gm-Message-State: AOAM532V7Y3hBzaRAsFEmkl6fNN8Jc/UOZv9HrTY/yFzihtIPmcbfkA7 /qojXttjTXUpTP7q1/VSNP6jK2tEEjQsCA== X-Google-Smtp-Source: ABdhPJxLyvU9DWTwyIUZ6xPJsGuV1TUlywPWrjkyu9PnXupvgANmkufBGh0MKcAKlq1qWaNQ0om3RQ== X-Received: by 2002:a05:600c:a08:b0:392:a561:9542 with SMTP id z8-20020a05600c0a0800b00392a5619542mr18105816wmp.62.1652730269966; Mon, 16 May 2022 12:44:29 -0700 (PDT) Received: from [192.168.1.28] (lfbn-lyo-1-398-93.w2-7.abo.wanadoo.fr. [2.7.225.93]) by smtp.gmail.com with ESMTPSA id i13-20020adfb64d000000b0020ce1c1cf31sm10166546wre.21.2022.05.16.12.44.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 May 2022 12:44:29 -0700 (PDT) Message-ID: <3e009edb-727e-3160-2d67-500a263ece55@gmail.com> Date: Mon, 16 May 2022 21:44:28 +0200 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: Changes to stat ABI Content-Language: en-US To: FreeBSD Hackers References: From: Paul Floyd In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4L28pQ6pxXz4typ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=BHZnEWk3; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of paulf2718@gmail.com designates 2a00:1450:4864:20::32d as permitted sender) smtp.mailfrom=paulf2718@gmail.com X-Spamd-Result: default: False [-1.95 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[2.7.225.93:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.953]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_SPAM_SHORT(1.00)[1.000]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::32d:from]; MLMMJ_DEST(0.00)[freebsd-hackers]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On 5/15/22 17:31, Warner Losh wrote: > Scratch that, this is a clang 11 vs clang13 issue. > > Most likely clang 13 is more aggressively optimizing, so fstat is not > actually on the stack... Because > of LTO, you'll need to check the disassembled binary to know for sure. > It makes no difference which compiler I use, same results either way. The disassembler is slightly different clang 11 / FreeBSD 13   201ba1:       8b bd b4 f6 ff ff       mov    -0x94c(%rbp),%edi   201ba7:       48 8d b5 d0 f6 ff ff    lea    -0x930(%rbp),%rsi   201bae:       89 85 a4 f6 ff ff       mov    %eax,-0x95c(%rbp)   201bb4:       e8 f7 00 00 00          call   201cb0 clang 13 / FreeBSD 13.1   201b8d:       8b bd b4 f6 ff ff       mov    -0x94c(%rbp),%edi   201b93:       48 8d b5 d0 f6 ff ff    lea    -0x930(%rbp),%rsi clang 13 hasn't bothered emitting the mov %eax, which is passing an uninitialized local to deliberately generate a memcheck error. Looking at libc, I see for FreeBSD 13   1372c4:       e8 87 89 f5 ff          call   8fc50 <__getosreldate>   1372c9:       3d 9f 4f 12 00          cmp    $0x124f9f,%eax   1372ce:       7c 10                   jl     1372e0 <_fstatfs+0x40> HERE1   1372d0:       44 89 f7                mov    %r14d,%edi   1372d3:       48 89 de                mov    %rbx,%rsi   1372d6:       e8 85 d1 09 00          call   1d4460 <__sys_fstatfs@plt>   1372db:       e9 22 01 00 00          jmp    137402 <_fstatfs+0x162> TO EXIT SEQUENCE HERE1:   1372e0:       48 8d 95 08 fe ff ff    lea    -0x1f8(%rbp),%rdx   1372e7:       bf 8d 01 00 00          mov    $0x18d,%edi   1372ec:       44 89 f6                mov    %r14d,%esi   1372ef:       31 c0                   xor    %eax,%eax   1372f1:       e8 8a c5 09 00          call   1d3880   1372f6:       85 c0                   test   %eax,%eax   1372f8:       0f 85 04 01 00 00       jne    137402 <_fstatfs+0x162> and 13.1 2b4:       e8 a7 c1 f5 ff          call   90460 <__getosreldate>   1342b9:       3d 9f 4f 12 00          cmp    $0x124f9f,%eax   1342be:       7c 25                   jl     1342e5 <_fstatfs+0x55> HERE1   1342c0:       49 8b 07                mov    (%r15),%rax   1342c3:       48 3b 45 e0             cmp    -0x20(%rbp),%rax   1342c7:       0f 85 51 01 00 00       jne    13441e <_fstatfs+0x18e>   1342cd:       44 89 f7                mov    %r14d,%edi   1342d0:       48 89 de                mov    %rbx,%rsi   1342d3:       48 81 c4 e8 01 00 00    add    $0x1e8,%rsp   1342da:       5b                      pop    %rbx   1342db:       41 5e                   pop    %r14   1342dd:       41 5f                   pop    %r15   1342df:       5d                      pop    %rbp BINGO! TAIL CALL OPTIMIZATION   1342e0:       e9 bb a0 09 00          jmp    1ce3a0 <__sys_fstatfs@plt> HERE1   1342e5:       48 8d 95 08 fe ff ff    lea    -0x1f8(%rbp),%rdx   1342ec:       bf 8d 01 00 00          mov    $0x18d,%edi   1342f1:       44 89 f6                mov    %r14d,%esi   1342f4:       31 c0                   xor    %eax,%eax   1342f6:       e8 d5 94 09 00          call   1cd7d0   1342fb:       85 c0                   test   %eax,%eax   1342fd:       0f 85 04 01 00 00       jne    134407 <_fstatfs+0x177> I don't think that there is much that I can do about that in Valgrind. The stat family callstacks will be a little less clear, but still usable. And equally I don't suppose there's any chance that libc will get changed just for Valgrind. A+ Paul