Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3833554ybf; Tue, 3 Mar 2020 13:48:51 -0800 (PST) X-Google-Smtp-Source: ADFU+vtLKkrIrZhIoLHrsmRYw+OdcMT7G2NuAK+SV5xEGiWE8gBh4tZ6m5ze2E78Vta/IU0anoCy X-Received: by 2002:a05:6830:310a:: with SMTP id b10mr4941156ots.210.1583272131179; Tue, 03 Mar 2020 13:48:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583272131; cv=none; d=google.com; s=arc-20160816; b=B4WQF9WmGHh62RARRZ4YqtEUXat976iFp817Sm6VNWWCniADTceVf4iy9fftkij29L XFIg/8t+rP5P7LqJkvKnTwGItWuu5w2cJDxx3QJ3ULmT+bccN9JpKl7KCR9619P1Er4g 0aJ2WbK15GlbXkfId2SsWysRvumaFUC/RHtY5PU4wWbdMiJ+cxy/BR8L8BUiuzuCnNtE WRrvynEvjrE6C3AWXSn/FhfW+1rBkXjARsrVaXGyUFKsEv4WL9IHTp9hcM2OJDGq0jCR UmHNPnDTJp9KptDLDAbXykgFcA18WV1mRtDImCSFEhUxth+krEH1C8+mXPmawJdmu9xp KSsQ== 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=oW1Q93Cz5/1oipunUTCgm+h+ggYdq5iJCZAefRCHPRY=; b=MLqn3829DM9tguO34h2ITJkJZFNfmlgPnThyQbVW68FM8BQBOfiIhNHUXfXGoPA9O0 EJLiYdupNjztW70Crg64VBAKUYZYfEm4q5T/2Unl2COBK3hyg10wg9OSMVUbZ564crND factT1GZlBohtcyHsCCv+foUYwfcBX260pKuUH4tKboAGys6yh9zcfjKOvYhXCwW9Ubb 8TG3+u6+HagymAqVTrb9YsPABeehAYtXoEySCJB0KJsJ+Sig4uPsSm+L5W0JM2LovZx2 rVg/bqo4+xZahTTMfBffvMM1miL4fKUDFxl7XtzBlySinFi1II2YNt4pMbvxqN+hkA+m +I1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=iEomnEKB; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c83si42492oig.116.2020.03.03.13.48.39; Tue, 03 Mar 2020 13:48:51 -0800 (PST) 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=@chromium.org header.s=google header.b=iEomnEKB; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731991AbgCCUvX (ORCPT + 99 others); Tue, 3 Mar 2020 15:51:23 -0500 Received: from mail-vk1-f194.google.com ([209.85.221.194]:36547 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731320AbgCCUvX (ORCPT ); Tue, 3 Mar 2020 15:51:23 -0500 Received: by mail-vk1-f194.google.com with SMTP id y125so17450vkc.3 for ; Tue, 03 Mar 2020 12:51:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oW1Q93Cz5/1oipunUTCgm+h+ggYdq5iJCZAefRCHPRY=; b=iEomnEKBhquBub86A4qsjvpPTMpdF9h11IVjF8WbZPa8oljG9R8502kvXGsji0Vhky poyBNMxKdhRoIxueWBrNGTes7A3w0xZ6kvL5XbAu/VIgLoio6OjFamH7jOBSUQRuJzfc W/2ygkiIEse9DzXFAlP9QSTi9Dzrc2xGd1FbY= 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=oW1Q93Cz5/1oipunUTCgm+h+ggYdq5iJCZAefRCHPRY=; b=BWj3nTO3XPK1NuxeYqRWOVW8CzGiWLEYf6jCcQPHri33IdI4nJnIuzLxnJllLHPS8p UiI+q1o7An6NsV42nuWCUt9TPcqSw7ACbWaZyBY/I0nmii6Ye9em26nnKPdDegdkRtKJ WDvamP5PTyzN3JynEngoQ3bwgSD7yiYWQf3M8cRqGcR13uC0Vv8z2DvaiS7xO4GNFV9d Cfl6rW6w0iRFet+ADJpy6/OOR6YI+uTUk/cb6DRZAKlaQbBU9GTWvDAEnXnGOlKSldH8 f2JXK40BCWDbUiOEGG7HUTrwy1UbewjFdYVAVGl+T/vQZQ1ljSTJE9J7fWmuIsRDi4kV X/ZA== X-Gm-Message-State: ANhLgQ0Oirf1TrSKdIiITJQNEXc8uqgKgoUKQ98+jsp6Ikw0UvK8pHu4 3NM5GVRKR44+r+UpZ0AfG6ryyodDr+g= X-Received: by 2002:a1f:3613:: with SMTP id d19mr4075216vka.71.1583268681864; Tue, 03 Mar 2020 12:51:21 -0800 (PST) Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com. [209.85.217.41]) by smtp.gmail.com with ESMTPSA id y142sm3732045vsc.7.2020.03.03.12.51.20 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Mar 2020 12:51:20 -0800 (PST) Received: by mail-vs1-f41.google.com with SMTP id y204so3383008vsy.1 for ; Tue, 03 Mar 2020 12:51:20 -0800 (PST) X-Received: by 2002:a67:e342:: with SMTP id s2mr3570808vsm.198.1583268680084; Tue, 03 Mar 2020 12:51:20 -0800 (PST) MIME-Version: 1.0 References: <20200213164146.366251-1-daniel.thompson@linaro.org> In-Reply-To: <20200213164146.366251-1-daniel.thompson@linaro.org> From: Doug Anderson Date: Tue, 3 Mar 2020 12:51:08 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kdb: Censor attempts to set PROMPT without ENABLE_MEM_READ To: Daniel Thompson Cc: Jason Wessel , kgdb-bugreport@lists.sourceforge.net, LKML , Patch Tracking , Wang Xiayang 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 Hi, On Thu, Feb 13, 2020 at 8:42 AM Daniel Thompson wrote: > > Currently the PROMPT variable could be abused to provoke the printf() > machinery to read outside the current stack frame. Normally this > doesn't matter becaues md is already a much better tool for reading > from memory. > > However the md command can be disabled by not setting KDB_ENABLE_MEM_READ. > Let's also prevent PROMPT from being modified in these circumstances. > > Whilst adding a comment to help future code reviewers we also remove > the #ifdef where PROMPT in consumed. There is no problem passing an > unused (0) to snprintf when !CONFIG_SMP. > argument > > Reported-by: Wang Xiayang > Signed-off-by: Daniel Thompson > --- > kernel/debug/kdb/kdb_main.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) I can't say I'm an expert on the kdb permissions model since I wasn't really even aware of it before reading this patch, but your change seems reasonable to me. Reviewed-by: Douglas Anderson