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=-5.5 required=3.0 tests=MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 32997C33CB1 for ; Wed, 15 Jan 2020 15:04:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2BDE24671 for ; Wed, 15 Jan 2020 15:04:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2BDE24671 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 725D38E0007; Wed, 15 Jan 2020 10:04:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D2F18E0003; Wed, 15 Jan 2020 10:04:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E9F08E0007; Wed, 15 Jan 2020 10:04:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0113.hostedemail.com [216.40.44.113]) by kanga.kvack.org (Postfix) with ESMTP id 468DB8E0003 for ; Wed, 15 Jan 2020 10:04:25 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 03E044DCA for ; Wed, 15 Jan 2020 15:04:25 +0000 (UTC) X-FDA: 76380189690.29.82AC765 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 38B3A1802EB18 for ; Wed, 15 Jan 2020 15:03:19 +0000 (UTC) X-HE-Tag: pigs78_5718e8c8d4a06 X-Filterd-Recvd-Size: 4127 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 15:03:18 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id t14so176463wmi.5 for ; Wed, 15 Jan 2020 07:03:18 -0800 (PST) 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:user-agent; bh=S/ouc2MXlGxf8UxOAl84uHXMGJR02tyST/oeJfnJMFY=; b=BYyq8ONd7kmLxNI/OuVYJn7mMuHI4TvJxyKv2QFJrdrS5XLha6f/TSs0dDW/gYKsl0 hChInZkkV3Zvgb/D1Ey747MQZOks+w8gG9s0f8df6KcD7dEBfACJgsn4PQ4Ofyf92tIQ GuxN/pXEsxkPQeaLEmoe0jKAbN9PviJHr6QUmvFjLgjxniecsaJk015chrIFbs9HpQtw yBfm9qL7TrdXPnxjz0bCUefUzgc5fsh46a/AxaxF8nNf8HU0NNa9VBXkjUNFutOdRS1I xQsd7IsWfMgtsJqGhc8g9nfEcamgJu0IhiYJbQwLqQauXZHn104Flt3W4bu9npLsmSw5 EYlA== X-Gm-Message-State: APjAAAUYC8+futKR0Ca/zSKSdlJYAediJyzYI6Ie49kuOeUg+EHrUy1X sQs89pzUndIMy3fWcBQ48Ew= X-Google-Smtp-Source: APXvYqzAVHygrGoNV/p3sqwpqXELKzU9BAFm5zX1t/aq6Hw6nJqv5hcOWlmnEUJPYPR7P+hxgHTFQA== X-Received: by 2002:a1c:cc06:: with SMTP id h6mr197947wmb.118.1579100597451; Wed, 15 Jan 2020 07:03:17 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id d8sm25548532wre.13.2020.01.15.07.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 07:03:16 -0800 (PST) Date: Wed, 15 Jan 2020 16:03:15 +0100 From: Michal Hocko To: Dmitry Vyukov Cc: Vlastimil Babka , Dan Carpenter , Andrew Morton , Lee Schermerhorn , Linux-MM , LKML , syzbot , Andrea Arcangeli , Hugh Dickins , syzkaller-bugs , Al Viro , yang.shi@linux.alibaba.com Subject: Re: [PATCH] mm/mempolicy.c: Fix out of bounds write in mpol_parse_str() Message-ID: <20200115150315.GH19428@dhcp22.suse.cz> References: <20200115055426.vdjwvry44nfug7yy@kili.mountain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) 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: On Wed 15-01-20 13:57:47, Dmitry Vyukov wrote: > On Wed, Jan 15, 2020 at 1:54 PM Vlastimil Babka wrote: > > > > On 1/15/20 6:54 AM, Dan Carpenter wrote: > > > What we are trying to do is change the '=' character to a NUL terminator > > > and then at the end of the function we restore it back to an '='. The > > > problem is there are two error paths where we jump to the end of the > > > function before we have replaced the '=' with NUL. We end up putting > > > the '=' in the wrong place (possibly one element before the start of > > > the buffer). > > > > Bleh. > > > > > Reported-by: syzbot+e64a13c5369a194d67df@syzkaller.appspotmail.com > > > Fixes: 095f1fc4ebf3 ("mempolicy: rework shmem mpol parsing and display") > > > Signed-off-by: Dan Carpenter > > > > Acked-by: Vlastimil Babka > > > > CC stable perhaps? Can this (tmpfs mount options parsing AFAICS?) become > > part of unprivileged operation in some scenarios? > > Yes, tmpfs can be mounted by any user inside of a user namespace. Huh, is there any restriction though? It is certainly not nice to have an arbitrary memory allocated without a way of reclaiming it and OOM killer wouldn't help for shmem. -- Michal Hocko SUSE Labs