On 14 July 2018 at 13:41, Lukas Wunner <lukas@xxxxxxxxx> wrote: > On Fri, Jul 13, 2018 at 03:54:29PM +0200, Ard Biesheuvel wrote: >> Did you have any thoughts about how we could at least detect >> situations where we are invoking protocols that are not mixed-mode >> safe (i.e., they pass 64-bit quantities by value, which our current >> thunking routine does not take into account) > > efi_thunk_64.S only supports five arguments AFAICS, we'd have to check > for each argument passed to efi_call_early() or efi_call_proto() if > the corresponding argument in the *_32_t protocol struct has sizeof(u64), > and BUILD_BUG_ON() if so. > > Is it possible to retrieve the n-th element of a struct without knowing > its name? Basically offsetof() but with a number instead of a name? > We have to check the size of the struct element, not the argument passed > in to efi_call_early() / efi_call_proto() because we pass in 64-bit > pointers (and possibly also integers) and fully expect that the upper > 32-bit are disregarded. > > Difficult. :-( > Yeah. I think a GCC plugin is the only way to achieve this. -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html