Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4432072imm; Mon, 15 Oct 2018 14:54:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV62JhmXb7SNIUy6oOjVNoldvjSLCUtXUC3y4lvAJUkUCYGAJ44PBe1kC3JOqhAAkXVuJje4U X-Received: by 2002:a17:902:d704:: with SMTP id w4-v6mr19026612ply.230.1539640484084; Mon, 15 Oct 2018 14:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539640484; cv=none; d=google.com; s=arc-20160816; b=vFICDIDIaitfEFKo5Yj0iKoWu1McQTf7I+NXU88RmD7tlPA6iM2XEj817FGOylqz4E QX0fkeM7YC5dyNfTwHLZ6v/59V7yTW7nRYcFqDcTiNLf59WlShwASESVHQX1fl+Mc6uj Og6VNsRBrchGccovUxLjhQASfunm2PkYE4ZFQQBvZhNaT5WFauxJjpFB49tqs5o2N+zD TfAX3xCT8xbzNa9dJ+LrjoOYX4npFZpbifz5vKPS3MKt45kr3HzBx6SYjzVTfLghFGNJ KP5htkYHGNRsIGM9DWOS9RxEZqiV/Ch+gXadjfGv8CDbmT63MWLvi8/x+0g0FpMUjfIR BGsQ== 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:dkim-signature; bh=9/90pkrnEVMR461DnsdHg2gnOJuyWG/ZciqdVhYl+uQ=; b=sExLC3TYJ6h7WD6jnxYLIQisQsAMg8Bl/GujTUKJ41AKDe6DTh3bbOLCHwONLYkKN6 xzrEqI7r2lKyFWBjxpGv4S0YSVHjew1ZbqpDoUH/sJ9ts3vPlnz8LJQqZZeMGJEtrIB9 l7XUxeVDJI/NjfdglPCNKxXwkPx6ELT3CgZ2J9FDfkiS4FWVjV3E00lmuYWXMZL+1cZ3 +H7uabEjHtOyUL6QPKwC/Mts4l0lT8niw7NrsbtStn7AudtD4HEElwHba7wszxQE16fl /rFNtOO0gFb7CGp01uTlkPn9dP7jphsJNy75ueKdRop2HrSw82spcZ4ecv2ildyBqb6a c4KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Q9xvzow8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si13374415plk.350.2018.10.15.14.54.28; Mon, 15 Oct 2018 14:54:44 -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=@google.com header.s=20161025 header.b=Q9xvzow8; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbeJPFlI (ORCPT + 99 others); Tue, 16 Oct 2018 01:41:08 -0400 Received: from mail-pf1-f180.google.com ([209.85.210.180]:46753 "EHLO mail-pf1-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726185AbeJPFlH (ORCPT ); Tue, 16 Oct 2018 01:41:07 -0400 Received: by mail-pf1-f180.google.com with SMTP id r64-v6so10331704pfb.13 for ; Mon, 15 Oct 2018 14:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9/90pkrnEVMR461DnsdHg2gnOJuyWG/ZciqdVhYl+uQ=; b=Q9xvzow8NI9z00XfehNf2cFtby3pf1Yy9smEVoO7hIqjKfMGaa8CQuEbTgwYZzpCE3 y34DuDhv/arDPmKUbmV+kLlfuXqJ2q6XFI0+KJbmGCp1hKF49g+PVXrgU4u0mIth0wod Eyzonr+YDmCFlZ/xXR0nMwqj/R7NEBaZ2UcZBQ4x59Mehj1Pe/xq0U6A3CkMgKm54PpZ oBxYLaKC52kGxOPh+XwpZfIp8PJmBqzZ2v0lIbBcqlWrS9OcRpBCOFsHPMJ0ro3Z8I8y bZAlcIuEbRSd+m7HttSDsOd1e556EgQ3JecdHzkFlCIKoAmNRej6x78ePCv/vg8PVZGl ZqpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9/90pkrnEVMR461DnsdHg2gnOJuyWG/ZciqdVhYl+uQ=; b=bMVh7UOuTzNoK6zI9AqXd5tvkZspX+gJYf5hMC72n1Y+ytMk/iJJOuIN5zlL/ett8P VmkFpRSUOZmxcq1SNvSjtFBwOh5bc5OBT94714eYdXvhHzkOGTGkEEFuNujE6DURztX0 fMjwCfhP8buuCF2Pt8usEj4dKMSRnc1jnrks+kOGCUJhb6tKg5l3B77DvwB5evkxl6cW 2uswA8viodw20NQHWcWcbWfXXt0A+gn1ytLffVZhgyeeSmHnPfpJ7RATMKKhDj0yUMmb fKvvVrWynaZ1vL8X0RlGjIzvI+TIk3W15YvqA+RawuRi+VkRofxw8pcVns6EVHXsnjRZ BxGA== X-Gm-Message-State: ABuFfoj11YWT334Ejp5OWAwttFFMHmHiZ7y+3ITbHw0WQbXj6mEiUcYC Yz2+lDVAUlf0LrytkKx+h5+7i3j3M3yZRrWcUvMh8Q== X-Received: by 2002:a63:2f42:: with SMTP id v63-v6mr3515716pgv.202.1539640441007; Mon, 15 Oct 2018 14:54:01 -0700 (PDT) MIME-Version: 1.0 References: <1539274203.2623.56.camel@linux.vnet.ibm.com> <20181011203126.15338-1-ndesaulniers@google.com> <0180360cfcb5458d8ff099744e8884d4@AcuMS.aculab.com> In-Reply-To: <0180360cfcb5458d8ff099744e8884d4@AcuMS.aculab.com> From: Nick Desaulniers Date: Mon, 15 Oct 2018 14:53:49 -0700 Message-ID: Subject: Re: [PATCH] KEYS: trusted: fix -Wvarags warning To: David.Laight@aculab.com Cc: "James E.J. Bottomley" , dhowells@redhat.com, Nathan Chancellor , Eric Biggers , zohar@linux.vnet.ibm.com, jmorris@namei.org, serge@hallyn.com, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 15, 2018 at 2:26 AM David Laight wrote: > > From: ndesaulniers@google.com > > Sent: 11 October 2018 21:31 > ... > > by swapping h2 and h3. > > > > security/keys/trusted.c:146:17: warning: passing an object that > > undergoes default > > argument promotion to 'va_start' has undefined behavior [-Wvarargs] > > va_start(argp, h3); > > ^ > > security/keys/trusted.c:126:37: note: parameter of type 'unsigned > > char' is declared here > > unsigned char *h2, unsigned char h3, ...) > > ^ > > Specifically, it seems that both the C90 (4.8.1.1) and C11 (7.16.1.4) > > standards explicitly call this out as undefined behavior: > > I guess that problems arise when all the arguments are stacked > and va_start/va_arg use naive pointer manipulation. > In that case &h3 might be 4n+3 aligned so va_arg() will access > misaligned stack locations. > > I doubt any modern compilers (where va_start and va_arg are builtins) > will get this 'wrong' even when all arguments are stacked. > > Seems clang is being over cautious. Yes; did you have feedback on the Denis' proposed fix, or another? > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales) -- Thanks, ~Nick Desaulniers