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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E70D711D1 for ; Wed, 20 Nov 2024 17:34:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A8646B0093; Wed, 20 Nov 2024 12:34:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 159A86B00A1; Wed, 20 Nov 2024 12:34:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3C0E6B00A2; Wed, 20 Nov 2024 12:33:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D28CD6B0093 for ; Wed, 20 Nov 2024 12:33:59 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5DED3120EB9 for ; Wed, 20 Nov 2024 17:33:59 +0000 (UTC) X-FDA: 82807169844.26.4A5C68C Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.174]) by imf11.hostedemail.com (Postfix) with ESMTP id 572BB40007 for ; Wed, 20 Nov 2024 17:32:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="MuG4/SKi"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of yosryahmed@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732123946; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tYCCxRwoo4/e9pvHHukibz0lUEYL/K5Rpqldo2LsKi0=; b=gyogwC2GTNA0Ilo9ERyAFaB7grEozjEToG/5hapKhnnICWBR7x98dQSOl8eTq5x3DHzwow iVPGGAHFcZ3w2DocR9bMGrY9WxcMelT1KYPptBcZLMLSBeodGYf3Fqq61Z+MUZuYupk2Rf HRNGTSDDsogFe+8UyWSdWEnCNtQKr7A= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="MuG4/SKi"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf11.hostedemail.com: domain of yosryahmed@google.com designates 209.85.128.174 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732123946; a=rsa-sha256; cv=none; b=gZ0Ni6I/qI9kVNvyhEu9c+ERhWwzk1Zn2Ww0LIh4AFYr05vvMjJ4NdXIYBcpA9T20d7sXZ +1tCeypD3I8Dq/y1m40LL+G+8VJoV1wPVMk6y/RZk9ChhGThi90kyW3upsugvBqCZ/dyVo Iwyk8Ghnw6khtVdnTRGkNBMSy/ioUtA= Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-6eebb54fc48so13675797b3.1 for ; Wed, 20 Nov 2024 09:33:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732124036; x=1732728836; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tYCCxRwoo4/e9pvHHukibz0lUEYL/K5Rpqldo2LsKi0=; b=MuG4/SKioIfIMb2D2WpUNJuhwGYemEMC+UJg1xR+s3io7mUCtKlfvJ5Q6WVUmBXu/2 Z1GwaAetiHtU7evJDbDDRzx+ppjGk5Rm7irq0GWxBZYs1xKPrAJhwO6cazK7hOEXu5u3 GfrTHDj3q4aAKnbwgTo/D8HgKZW32zph7Bvtt4X1hdStidRwu4dBgS0rMQkx/dolw+R4 JZ1CndqT/wTLE+lOd4xTWeTIzVXEXkfSlphKlQmarJzuR+Gz+SwuWrZJXmbUUP0NvhRd niyXX0XipxasKP74vNlm738sgXWU09nsWNcieIrX5N0lOEV2yPh7Jh5M6DuojpCnSOoL YY9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732124036; x=1732728836; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tYCCxRwoo4/e9pvHHukibz0lUEYL/K5Rpqldo2LsKi0=; b=bH2b1gzbR8hkDJkPCSIt/Ckh3cpzBvv67IpsX988SucX/SnZ480Cyz/KwthX9eHf6c Wu5TsSJ/CBlECwBU4FVLmG0rtyaezh0CUXNuIuroLwjse9TAyxSWdNDaTSGmr9Mp4Zdv RFnQy2OnpB+I61LKZfm0HtJYQSL/LDWR8VcleLqzATfWHmk/TG1INc0AVr/2NX3LkpOk H8URhYRCzLkaC3b6jh88qwG/+lCaLWC5H5n4kXkr7i+hs//4LGGyam85aCY60+L9y1NZ ciTiXQnIveAya59pzMVFfUab1Yv+unYQHJgIrtRQmMuX88ukyd5sORRjQhirbSIKdir7 6FWQ== X-Forwarded-Encrypted: i=1; AJvYcCU4i8mP+e4G3tVexGaQfQSjLwee4bmg8PdjY8ClNjTXlVjGA/GtKv457kaIu5I30elAL3pS7f/jjA==@kvack.org X-Gm-Message-State: AOJu0Ywx35ddZ2aCN4DDEDjC3gMvGoMs6Tz91FqeJuB0Xrc3UfZJLScV ZmGzGL/aTkgve7tq1S83XP2/pEtm4hOjsTpMW3PHkG1lhnHj6T/FJzHNoOJsSlVLauAHP/vzuyN dYyuyNd25+JLWLC+yf6QpKUdZ7iTVv0IydiCG X-Google-Smtp-Source: AGHT+IHXzlZzV1HDFKFSLMAjhmGRty1hJSXHMpkrUSLDMTXo54lPb8SEMTegLCJ8chntFke9JfMyqGqm2lxUKSFEZ3Y= X-Received: by 2002:a05:690c:4911:b0:6ea:5da9:34cc with SMTP id 00721157ae682-6eebd141ed6mr33197707b3.7.1732124034964; Wed, 20 Nov 2024 09:33:54 -0800 (PST) MIME-Version: 1.0 References: <20241116175922.3265872-1-pasha.tatashin@soleen.com> <2024111938-anointer-kooky-d4f9@gregkh> In-Reply-To: From: Yosry Ahmed Date: Wed, 20 Nov 2024 09:33:18 -0800 Message-ID: Subject: Re: [RFCv1 0/6] Page Detective To: Pasha Tatashin Cc: Roman Gushchin , Greg KH , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, akpm@linux-foundation.org, corbet@lwn.net, derek.kiernan@amd.com, dragan.cvetic@amd.com, arnd@arndb.de, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, tj@kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeel.butt@linux.dev, muchun.song@linux.dev, Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com, vbabka@suse.cz, jannh@google.com, shuah@kernel.org, vegard.nossum@oracle.com, vattunuru@marvell.com, schalla@marvell.com, david@redhat.com, willy@infradead.org, osalvador@suse.de, usama.anjum@collabora.com, andrii@kernel.org, ryan.roberts@arm.com, peterx@redhat.com, oleg@redhat.com, tandersen@netflix.com, rientjes@google.com, gthelen@google.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 572BB40007 X-Stat-Signature: bxjz75pgt17kpfy418qji9c4gkofz1m4 X-HE-Tag: 1732123973-673103 X-HE-Meta: U2FsdGVkX1/uEYPX0oG2i0gMkE1TroI5OUBwcWm7DI4yd3y5YNOFaNlaocGm8z8pzIPNi6T0SMjM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DKZfMPaDKhm8yhB3RHvaC/0s9ic6Ow3BPxzkKdgBGYnFpcSCefvaKNmZJ9jzbQ9uqsiWVbuG4ypUmIGi2T5HrC3iIHUl2QV9rdcWyclmdNjCuvH/p6C9RPVdxvtb70UJhNMg5WLVrCE6mcpfUTBZl7xtqiF3hCUhDbpXDJXgCruGBgQE4oAWIrMg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Nov 20, 2024 at 8:14=E2=80=AFAM Pasha Tatashin wrote: > > On Tue, Nov 19, 2024 at 2:36=E2=80=AFPM Yosry Ahmed wrote: > > > > On Tue, Nov 19, 2024 at 11:30=E2=80=AFAM Pasha Tatashin > > wrote: > > > > > > On Tue, Nov 19, 2024 at 1:23=E2=80=AFPM Roman Gushchin wrote: > > > > > > > > On Tue, Nov 19, 2024 at 10:08:36AM -0500, Pasha Tatashin wrote: > > > > > On Mon, Nov 18, 2024 at 8:09=E2=80=AFPM Greg KH wrote: > > > > > > > > > > > > On Mon, Nov 18, 2024 at 05:08:42PM -0500, Pasha Tatashin wrote: > > > > > > > Additionally, using crash/drgn is not feasible for us at this= time, it > > > > > > > requires keeping external tools on our hosts, also it require= s > > > > > > > approval and a security review for each script before deploym= ent in > > > > > > > our fleet. > > > > > > > > > > > > So it's ok to add a totally insecure kernel feature to your fle= et > > > > > > instead? You might want to reconsider that policy decision :) > > > > > > > > > > Hi Greg, > > > > > > > > > > While some risk is inherent, we believe the potential for abuse h= ere > > > > > is limited, especially given the existing CAP_SYS_ADMIN requirem= ent. > > > > > But, even with root access compromised, this tool presents a smal= ler > > > > > attack surface than alternatives like crash/drgn. It exposes less > > > > > sensitive information, unlike crash/drgn, which could potentially > > > > > allow reading all of kernel memory. > > > > > > > > The problem here is with using dmesg for output. No security-sensit= ive > > > > information should go there. Even exposing raw kernel pointers is n= ot > > > > considered safe. > > > > > > I am OK in writing the output to a debugfs file in the next version, > > > the only concern I have is that implies that dump_page() would need t= o > > > be basically duplicated, as it now outputs everything via printk's. > > > > Perhaps you can refactor the code in dump_page() to use a seq_buf, > > then have dump_page() printk that seq_buf using seq_buf_do_printk(), > > and have page detective output that seq_buf to the debugfs file? > > Good idea, I will look into modifying it this way. > > > We do something very similar with memory_stat_format(). We use the > > void mem_cgroup_print_oom_meminfo(struct mem_cgroup *memcg) > { > /* Use static buffer, for the caller is holding oom_lock. */ > static char buf[PAGE_SIZE]; > .... > seq_buf_init(&s, buf, sizeof(buf)); > memory_stat_format(memcg, &s); > seq_buf_do_printk(&s, KERN_INFO); > } > > This is a callosal stack allocation, given that our fleet only has 8K > stacks. :-) That's a static allocation though :)