Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp644485imm; Fri, 28 Sep 2018 04:36:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60LzUMmx93iVRZU1yNIiOLKRVgS6rZuD+6WYrNYDwroigMzqLHejczyENT2FN8PECQNk+vs X-Received: by 2002:a63:3cc:: with SMTP id 195-v6mr14901324pgd.262.1538134599127; Fri, 28 Sep 2018 04:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538134599; cv=none; d=google.com; s=arc-20160816; b=PtvjnNfw5uwr+mMeFrvZ+INq7r+nWvJaRA93lgZQ7MbzxJ03xtiehYh4xodJQdtb8Z NReAjPa2bgMcASW2LxkSAmlgKESwPdKDhC2k8lNOKxHuB2KsIuku6V6yaX3c3+URuJ8y bDrl++pg+9afNkMb+o7C0fucEvjYpAJ8WrOy75U563xYnXTzRVEaUidgJRxNS75bmooz k7c64INV3Mdh4LEv96rAmpu2CdA/HVeQvD1MAXHRvgEWJQhf33cC5jg7mVdPD7Qt1kOo 99voZuNbOWPLragfOQipBKyEow0zHtLcUBHu1h5ODa24MCjMqiqafzhPZ7B650WkNLdU R6VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zRPAcBZ0jXExz0b9Z/2xy54NjiQ4uqpuPp/PL1Sdyig=; b=SMgd3rVfOc8/BGaSIPl5XvfG7S1jwMb3LNNwchS/O9Y/Ne7cF6CqJChTzMzeRgRz9/ aaVLmjS6ACgQ6naIu4MQO6KTNLLpLBohKxZlQOhkAfpex6plElT9LtLBupHt+Ly9WmLI eQDcyADIxp+uU4+M6SH/mKCliIW7UKBp7S51GRxWP9Tnd2kibPeMnmysvjbt92yJtM0T lxCl8k9OebHefNnjW4SUn9c4Smf7iYSzjSiQ+BXfBjYW6frJarr9tWJt7iBZAXCCp8lK H92InCbaGKqbd4gQF0QvVc0jX/omgcNCR3zZp8Caob6MZvZJ9nP0Et7wi/WDPTDwd55u 47BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=b4ZSXKT6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13-v6si4345861pgd.280.2018.09.28.04.36.23; Fri, 28 Sep 2018 04:36:39 -0700 (PDT) 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=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=b4ZSXKT6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729480AbeI1R7L (ORCPT + 99 others); Fri, 28 Sep 2018 13:59:11 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39663 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729232AbeI1R7L (ORCPT ); Fri, 28 Sep 2018 13:59:11 -0400 Received: by mail-qt1-f194.google.com with SMTP id c25-v6so6192713qtp.6 for ; Fri, 28 Sep 2018 04:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zRPAcBZ0jXExz0b9Z/2xy54NjiQ4uqpuPp/PL1Sdyig=; b=b4ZSXKT6F2jUh2N/0+0f6amJx8k2m1O5JtT77YQ7ndzKzALwp8nwiLjkht1KzsLmNJ thVrca3Y2SVtQ6zK0fKryDP/yTToKNa1ndHX3x4ISz8rSPsWchMUFd5AItMpLME3DQEn fGykCCt46WE37QDcIcdHs0GxU9GgVMolER9ZDP2qoue7Lj6m1mWRmofOBvBX0YqU/vp6 r/6/K0QD1ZwGa+WGksCWNTvlsNCQpraLKEb4sE6ucvDN1v47A9OVmN+pkwDwxFmncPND 0RhhWT9fQYUmSXXA7gxkNFyOcLioXqBI4r0Q8vh0UazsWo34vX6ukOA1LXQx/GhFQDYU cQ4A== 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=zRPAcBZ0jXExz0b9Z/2xy54NjiQ4uqpuPp/PL1Sdyig=; b=ghc6TG7+NGyvJohwsDzhOz0Ywa/ncmNu61Yj4SDdP8e5+NHXeZXofJIcYtx6JevfNH xi0NML4oBXsFpbNPB/a2QH8Yw/4oznWWWvChB76b+2N8nRH8ep4XO/VMGJ+cVhkyhzQW d5VkXgJ1cEyhNbBJ4xqiekPnE3UuJZ/R+gNzSYyh+MaSDim4gLPo/Q4WpqPg8rJepxEw XO5TfLMNUgSNBkbFHS30xfgnqqFP6C+AKBmm3a5kI2CZzmoVokt5tZpTBSfBrTIIz962 25qfr7/SzmIYUu0I/6IIyIhtj/OGSOTr1o5tO4wSF4uPXMFPy9eBnmlbUau1Sqey5Zf1 EQzA== X-Gm-Message-State: ABuFfogDFF5cNaOeo7MZWV1gfH9LojdFlu38/8L0rxz/5f7x/f4b2t2a RP9tqL6MLoFoSlMNfLQ+2CcGWQ== X-Received: by 2002:a0c:8748:: with SMTP id 8-v6mr11630332qvi.223.1538134549862; Fri, 28 Sep 2018 04:35:49 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id i14-v6sm2991116qta.53.2018.09.28.04.35.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 04:35:48 -0700 (PDT) Date: Fri, 28 Sep 2018 07:35:48 -0400 From: Josef Bacik To: Kirill Tkhai Cc: akpm@linux-foundation.org, gorcunov@openvz.org, mhocko@suse.com, aryabinin@virtuozzo.com, hannes@cmpxchg.org, penguin-kernel@I-love.SAKURA.ne.jp, shakeelb@google.com, jbacik@fb.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: Fix int overflow in callers of do_shrink_slab() Message-ID: <20180928113546.sc7cztwsja4advli@destiny> References: <153813407177.17544.14888305435570723973.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <153813407177.17544.14888305435570723973.stgit@localhost.localdomain> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 28, 2018 at 02:28:32PM +0300, Kirill Tkhai wrote: > do_shrink_slab() returns unsigned long value, and > the placing into int variable cuts high bytes off. > Then we compare ret and 0xfffffffe (since SHRINK_EMPTY > is converted to ret type). > > Thus, big number of objects returned by do_shrink_slab() > may be interpreted as SHRINK_EMPTY, if low bytes of > their value are equal to 0xfffffffe. Fix that > by declaration ret as unsigned long in these functions. > > Reported-by: Cyrill Gorcunov > Signed-off-by: Kirill Tkhai Reviewed-by: Josef Bacik Thanks, Josef