Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1669379pxb; Wed, 9 Feb 2022 01:44:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxr1GAo/S2AgbHDR/KcWD0boOmqngr9FldHp1UeCkORXQEbf3zmzuT1JPbTTHj7RYm3nw/i X-Received: by 2002:a17:902:d503:: with SMTP id b3mr1470583plg.4.1644399844345; Wed, 09 Feb 2022 01:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644399844; cv=none; d=google.com; s=arc-20160816; b=wUajr4dUUmOhm/E7GbZ4D+DiMPe4QntNjQwvO3MzoaOEHSgB2xgNu8/6vLehefu9Hf GUES22q+gFcUK5ojux7NaxkH8XaGT+N2aRL0+XSMNuhuJdlo6Xw8hi4R8bT9+9HxEMtf qJ3WSQLBAYqz6vf3urBPYxZRhJrPsvE+Gnk2wSdYAq6UngChS4iBoCSD3b6OLDJmrMiI tyQx/zPt9pT3ETV+mJIQ3nBh8iy33BzwFmKsxgJCNBQstHpX5EojnkSQ88GOeRC2K8i3 i4iDkGoTj1cqspLWRdTmWFh2f1K6isCJCQuibKEwo8l2+z3Os/IAubeF5hoiCUZ2opFu SMrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W6vWO5phbqbJOK15XWRuJznkX1ivVtRshDIXGjGnpb4=; b=dxGpPZYjTHweyRct1Btn57uGzJ6C9Q03O6DFmQGIeaGq2e0zLTGj38N/G8UHMllgWv CP9EVvkYEcdkli6stQTvCzp1GMBQFdgUbjSL0CRSO7iNN3LjjgAotbBPboUweDsajN+W 0AxffnQV1BW36JS4pgiofdwXK3bXAV+XFmQx0PacgzI5++SE39Q1sdR/DHRuZ+usGpcm Vn3TRiM9w9UX9/Kn5Z1ZYc/2g5ztOv+vYF1U7edWpRN8TXZiXuNNTmPENU6Tec3H5wDs 5hh1SJalUNPwe6B7sZNCrSrUBQMFPYUpndmqXZlZgTZnxgXbkyrEldzkbwjwoCloKfc8 8l+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=O8w4WotJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n3si2536733pfa.303.2022.02.09.01.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:44:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=O8w4WotJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 68D18E0385E9; Wed, 9 Feb 2022 01:06:08 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355955AbiBDAA3 (ORCPT + 99 others); Thu, 3 Feb 2022 19:00:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbiBDAA1 (ORCPT ); Thu, 3 Feb 2022 19:00:27 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66922C061714 for ; Thu, 3 Feb 2022 16:00:27 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id t7so6217773ljc.10 for ; Thu, 03 Feb 2022 16:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=W6vWO5phbqbJOK15XWRuJznkX1ivVtRshDIXGjGnpb4=; b=O8w4WotJ2b6rKmKKBJUWufCSv8dzfdHoarzVcOzZdSr+s/PqUwLyF3Ue2tY/unRIz2 t8ScfVaD++YGalUdIVCUijauCnQxT2Mi26HFXWtPcjhBkU/TVYHOxnr3tl4N2OGO+Yzk IYURFJ2SWm7yedjm+OHMjip0qE7cQcTs5iUiaWTI/sImxJIq4tcF/BJN0aCYjL1vSwIM RHLlA6mde4MueRj/hCeQCZwH3riRVeC/F4XnG2hp0lSgf3KXJJzpD2OQNb3uLhbTvuvH /SWuQvQKnSfBpeuhsfmzTs3/rzdpHv3m9h0wwbaUJMzkg60K5QzAfDUsbsJgpL2GrV++ lIQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W6vWO5phbqbJOK15XWRuJznkX1ivVtRshDIXGjGnpb4=; b=wVaeCvA/I/D0y3i3oBaCObuk96Zw1THjYiPmvtSlCbMF2nM6S3Y3Q9j6rYZsP2nVhO ryfzNm3zbepmVnAmN1REy8tsZ7h1wYH3djFIPuLGMwRkN+R92t2bP/eALcCk3196tax6 KCwhx4IUPzZBfu+FZN4pUfa/gOqVq0Bj6FK1bFEfvmaPFw5bZY0wuAXWluN8CwAhLH79 hclFOOZTRn17cbqYEL3tamlxEQ9eZh4r9zCmeEiRiSfebnSR3LuFjdetjqqxfC9kfXv7 5a6M2AbwHZwXLc1mHJGGk69g9rWhNfyaC9Of4rNu63i1d2dZPQ4wNWG6j/3HlG/A5dY/ D/Uw== X-Gm-Message-State: AOAM532y/1npFXiieOTbZwoBSsvFBDbIP2rd+Kw1MWxZlphCNUErvvbx z/RQ/4t0QbDPINsMJMhjSn7OfVyJIP109b0PF2CCXA== X-Received: by 2002:a05:651c:1249:: with SMTP id h9mr234541ljh.375.1643932825587; Thu, 03 Feb 2022 16:00:25 -0800 (PST) MIME-Version: 1.0 References: <20220126025739.2014888-1-jannh@google.com> <87czk5l2i6.fsf@email.froward.int.ebiederm.org> In-Reply-To: From: Jann Horn Date: Fri, 4 Feb 2022 00:59:59 +0100 Message-ID: Subject: Re: [PATCH] coredump: Also dump first pages of non-executable ELF libraries To: "Eric W. Biederman" Cc: Andrew Morton , linux-kernel@vger.kernel.org, Bill Messmer , Al Viro , Randy Dunlap , stable@vger.kernel.org, Kees Cook Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net On Wed, Feb 2, 2022 at 6:43 PM Jann Horn wrote: > > On Wed, Feb 2, 2022 at 4:19 PM Eric W. Biederman wrote: > > > > Jann Horn writes: > > > > > When I rewrote the VMA dumping logic for coredumps, I changed it to > > > recognize ELF library mappings based on the file being executable instead > > > of the mapping having an ELF header. But turns out, distros ship many ELF > > > libraries as non-executable, so the heuristic goes wrong... > > > > > > Restore the old behavior where FILTER(ELF_HEADERS) dumps the first page of > > > any offset-0 readable mapping that starts with the ELF magic. > > > > > > This fix is technically layer-breaking a bit, because it checks for > > > something ELF-specific in fs/coredump.c; but since we probably want to > > > share this between standard ELF and FDPIC ELF anyway, I guess it's fine? > > > And this also keeps the change small for backporting. > > > > In light of the conflict with my other changes, and in light of the pain > > of calling get_user. > > > > Is there any reason why the doesn't unconditionally dump all headers? > > Something like the diff below? > > > > I looked in the history and the code was filtering for ELF headers > > there already. I am just thinking this feels like a good idea > > regardless of the file format to help verify the file on-disk > > is the file we think was mapped. > > Yeah, I guess that's reasonable. The main difference will probably be > that the starting pages of some font files, locale files and python > libraries will also be logged. Are you planning to turn that into a proper patch and take it through your tree, or something like that? If so, we should tell akpm to take this one back out...