Re: Changes to stat ABI

From: Floyd, Paul <paulf2718_at_gmail.com>
Date: Mon, 16 May 2022 07:59:29 UTC
On 2022-05-15 19: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.
>

Hi Warner

I'll do some tests on varions combinations of FreeBSD 13 / 13.1 and 
clang 11 / 13. I don't understand why optimization would affect stat 
family syscalls but not any other syscalls though.

One issue is whether system calls use a function prolog or not. Prior to 
FreeBSD 13.0, Valgrind assumed no prolog and looked directly for a 
return address at the top of the stack rather than saved RBP then the 
return address. This changed in FreeBSD 13.0. Actually I didn't see 
exactly what had changed in FreeBSD, but disabling the 
syscall-with-no-prolog check fixed a lot of test failures. It's also 
possible that the code that looks for CFI didn't work prior to FreeBSD 13.0.

I'll also do some tests on Valgrind so see if the no-prolog code is 
causing this.

A+

Paul