From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A09EC43331 for ; Tue, 31 Mar 2020 19:58:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F17D02080C for ; Tue, 31 Mar 2020 19:58:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="S+w7GqDb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbgCaT6d (ORCPT ); Tue, 31 Mar 2020 15:58:33 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:37653 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726947AbgCaT6d (ORCPT ); Tue, 31 Mar 2020 15:58:33 -0400 Received: by mail-pj1-f67.google.com with SMTP id o12so1572955pjs.2 for ; Tue, 31 Mar 2020 12:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iIE5XFM5K7QbE20yyDiZj6SZSyFq4hlwbNrIPIzU0gY=; b=S+w7GqDb769CQ8xv21FIHZaNTBTZm/T6OlidzROuKsDVAboV/EyN3Llh6Rz9mTZIft zotPnmEPIB8CQiPZpqd8ptbr4VcDp3TNcS1e4/py50PXxoyy27AenDHwc+9tWLcOub7S xUXQTmtjjTRF4Le26nz+prjPz5JX7fc6k5RGU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iIE5XFM5K7QbE20yyDiZj6SZSyFq4hlwbNrIPIzU0gY=; b=khRN5tGxH+I6SUHtWG1Vhye8QVz3jnpyeur+FZuXe+hTvkZZOvwbgjHhfeR8aic3Fx NY/Y9BRZrjdTP+mWL+KLQI5b+r55aHmAZbNjnF8kKr5RBNnUiasS+Z+Y3yYfLehEQVIx W7/v62fjz+m7OwUaX6dtGc7c+NmJkXhLX+GPJHNFpTcOYAJs9rr4Y+KoYUWoUJ551OuO fifoHUFUBW1I600mEo4vXwGYZ7GHbTpvmX/vMBhiKq5fM7/r0uuWr6muqMnVuuGtEMtM B2LBdYpIVFTXdBq6DK6UY2iDt/dHTTK4D/h3vK1PbEmCXCW2cV5fNvVSgY4xopqbVZ4Y swDw== X-Gm-Message-State: ANhLgQ0ao+l/7o5EvjdUqSS3JG9iUT/RmgXHlMTf2rZPE2SHM/h6qbRh eewADMnOYpRiSZvGQfeYwWIU3w== X-Google-Smtp-Source: ADFU+vthYqtijXEiYJ1M7gXE9t+NnabDok25352WJK4rM43tVjWFqpSgeiB1d/0wichYw3yjyVfreg== X-Received: by 2002:a17:902:8648:: with SMTP id y8mr18766618plt.153.1585684711969; Tue, 31 Mar 2020 12:58:31 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d8sm2553519pjx.12.2020.03.31.12.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Mar 2020 12:58:31 -0700 (PDT) Date: Tue, 31 Mar 2020 12:58:30 -0700 From: Kees Cook To: Andrii Nakryiko Cc: Daniel Borkmann , Jann Horn , Alexei Starovoitov , bpf , Kernel Hardening Subject: Re: CONFIG_DEBUG_INFO_BTF and CONFIG_GCC_PLUGIN_RANDSTRUCT Message-ID: <202003311257.3372EC63@keescook> References: <202003301016.D0E239A0@keescook> <202003311110.2B08091E@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Tue, Mar 31, 2020 at 12:50:07PM -0700, Andrii Nakryiko wrote: > On Tue, Mar 31, 2020 at 11:12 AM Kees Cook wrote: > > > > On Tue, Mar 31, 2020 at 12:41:04AM +0200, Daniel Borkmann wrote: > > > On 3/30/20 7:20 PM, Kees Cook wrote: > > > > On Mon, Mar 30, 2020 at 06:17:32PM +0200, Jann Horn wrote: > > > > > On Mon, Mar 30, 2020 at 5:59 PM Alexei Starovoitov > > > > > wrote: > > > > > > On Mon, Mar 30, 2020 at 8:14 AM Jann Horn wrote: > > > > > > > > > > > > > > I noticed that CONFIG_DEBUG_INFO_BTF seems to partly defeat the point > > > > > > > of CONFIG_GCC_PLUGIN_RANDSTRUCT. > > > > > > > > > > > > Is it a theoretical stmt or you have data? > > > > > > I think it's the other way around. > > > > > > gcc-plugin breaks dwarf and breaks btf. > > > > > > But I only looked at gcc patches without applying them. > > > > > > > > > > Ah, interesting - I haven't actually tested it, I just assumed > > > > > (perhaps incorrectly) that the GCC plugin would deal with DWARF info > > > > > properly. > > > > > > > > Yeah, GCC appears to create DWARF before the plugin does the > > > > randomization[1], so it's not an exposure, but yes, struct randomization > > > > is pretty completely incompatible with a bunch of things in the kernel > > > > (by design). I'm happy to add negative "depends" in the Kconfig if it > > > > helps clarify anything. > > > > > > Is this expected to get fixed at some point wrt DWARF? Perhaps would make > > > > No, gcc closed the issue as "won't fix". > > > > > sense then to add a negative "depends" for both DWARF and BTF if the option > > > GCC_PLUGIN_RANDSTRUCT is set given both would be incompatible/broken. > > > > I hadn't just to keep wider randconfig build test coverage. That said, I > > could make it be: depends COMPILE_TEST || !DWARF ... > > > > I can certainly do that. > > I've asked Slava in [0] to disable all three known configs that break > DWARF and subsequently BTF, I hope it's ok to just do it in one patch. > Currently all these appear to result in invalid BTF due to various > DWARF modifications: > > - DEBUG_INFO_REDUCED (see [1]) > - DEBUG_INFO_SPLIT (see [0] > - GCC_PLUGIN_RANDSTRUCT (this discussion). > > [0] https://lore.kernel.org/bpf/CAEf4BzadnfAwfa1D0jZb=01Ou783GpK_U7PAYeEJca-L9kdnVA@mail.gmail.com/ > [1] https://lore.kernel.org/bpf/CAEf4BzZri8KpwLcoPgjiVx_=QmJ2W9UzBkDqSO2rUWMzWogkKg@mail.gmail.com/ Sure! That'd by fine by me. I'd just like it to be a "|| COMPILE_TEST" for GCC_PLUGIN_RANDSTRUCT. Feel free to CC me for an Ack. :) -Kees > > > > > > -Kees > > > > [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84052 > > > > -- > > Kees Cook -- Kees Cook