Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp642722imm; Fri, 28 Sep 2018 04:34:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV61v04joNKNHKh5NtqluZgnZ8PQmhGMT4h7S0Z3dCW7G3oSWdOh7SSfIIrVljhWToCuRdqRI X-Received: by 2002:a62:6003:: with SMTP id u3-v6mr16572133pfb.114.1538134497334; Fri, 28 Sep 2018 04:34:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538134497; cv=none; d=google.com; s=arc-20160816; b=gjTpPOYb+m24ZmsMsrMJW0HicqMak5vrBT5pn62MUnuSXwitWdjFHIzq3zcweVcrR3 3n3c+jBWfmzvZgDd6HKUkC31BRwePnuR+QphzvY+xk7dwvXCLbiICkFw3GPYuC8s5CKx kZ7ldshokPJUnEqW8ORtrvvk8wlj3o3+ZRTAlu9d1DaLiwKXYWPz3nfNGeoUNKTA16cZ YnEg4Iw45nmLt3lW2LHWWPbQOm0GjPkcsUbc7jJOP/UNAp5je/c6hPh9w0BTos6SoCWu UImE/9wQ9lX7mrsBJFUdoR8oaWqC5ke+OnozX9NI9kZI9pBSNdRBbF/VBTE1a1x8j485 YJSw== 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=NtlxJJLat4KPRoSgywPh8BSygJ1ZYtWu3TCCHHkYSGU=; b=c+MIEUrK+RHt2Du8yWL6jEc0LaVAOgEsL75elg40ZAqwOE6TAR6J0EN512QHuARZJe MiAwqwLR/Ny3AjFBvjSnNYoZi17QS3GbppNPkKVmwoNAmx80T9GI/x5nf9I85/BvG8Oy iULIh1E4ZIPbcF5ca38iCMT5Oxb+Pk3kiXMTwVwb1DVloqjm3n31uMh2YUoWbQ2XPGfX IBLs5kb3kLtNuLkgMrGHCUbQ7zekV09oxjPNjeSz2EJBJT0JeOs74Ab9Srjf2QH+yG0y E10QMuEiJPozzlhsoZLUNmTb+JT12t5Yzav3Ld5Korv3ZGv6ChzuD+o1kQuvVZxIAQt9 JBUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h8NuHtWg; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si4344680pgg.330.2018.09.28.04.34.40; Fri, 28 Sep 2018 04:34:57 -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=@gmail.com header.s=20161025 header.b=h8NuHtWg; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729411AbeI1R5n (ORCPT + 99 others); Fri, 28 Sep 2018 13:57:43 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:36571 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729232AbeI1R5n (ORCPT ); Fri, 28 Sep 2018 13:57:43 -0400 Received: by mail-lf1-f65.google.com with SMTP id v17-v6so4741828lfe.3 for ; Fri, 28 Sep 2018 04:34:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NtlxJJLat4KPRoSgywPh8BSygJ1ZYtWu3TCCHHkYSGU=; b=h8NuHtWghjsnmxCFUY6HAaJVXDJNyLM8s8+DC1jCGSqpto34vZnXROcC5zWmqInapn 7O9yJIf80gRkrf0eNv4ru6QKod5rXC9YyQcmb3DyqR4qS4X9bp9a8ies48zztIsArj1U btyw57I49Rh5Ob1djpgUf19thNjEG4vdtRQeMkX5GCAfyC7Svdxq7fp0YwKUInKfq0Yz QWZonzBCnQBifkarwGrI+InO+9nwVZ/vRgBZ7SZGBNxRi68EAsnB+VU6zOunfFHf2GG3 8HNow5VMq++qG/7mImPT6merug/hdYJ7OdRbd3hvHwCWzcmt/DOHGjk3SBg+71d6Vv7N Z9AQ== 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=NtlxJJLat4KPRoSgywPh8BSygJ1ZYtWu3TCCHHkYSGU=; b=dLLPIdPp/aDjtwYUetn0xg6I2n2V4gUdw4fYO9kwlgBSWGhaegWS+/2eiivd9XWJpq YGvGSujKry4UQA4ogxkG/E76hyJEKzqlspdMRazDFLhtZhznN7Zl+NxZLgiNpw3lJ71t tAAAKc2/g0gHJRuTgUmby45fz573PImP5W8VwPvh5MUH/hkd9FuX1L5jUEdEzxI3w7Hn 5WZzqjPG4SBfeETG0CXtsnx07ADJ6LVQY+ktTmFxiyqiddIc1mc4iS/ByhAU4ib+ThYX /nKj890sr8Osb+V2XVCVPM+Uuta+wzZUUU+NxQZlXth/+gJO57BEjv4W4HWs2zcTeB4o EfiA== X-Gm-Message-State: ABuFfohgrcKUJF4IYQ0KFnZdIb/y/2TJJkZFYJqN/zYCTlQmeLC4NeLh xAe4JWtDSRKBvmmaObee+Ts= X-Received: by 2002:a19:7411:: with SMTP id v17-v6mr10494766lfe.49.1538134460657; Fri, 28 Sep 2018 04:34:20 -0700 (PDT) Received: from uranus.localdomain ([5.18.102.224]) by smtp.gmail.com with ESMTPSA id 197-v6sm396151ljj.17.2018.09.28.04.34.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Sep 2018 04:34:19 -0700 (PDT) Received: by uranus.localdomain (Postfix, from userid 1000) id 8CC9346065D; Fri, 28 Sep 2018 14:34:18 +0300 (MSK) Date: Fri, 28 Sep 2018 14:34:18 +0300 From: Cyrill Gorcunov To: Kirill Tkhai Cc: akpm@linux-foundation.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: <20180928113418.GR15710@uranus> 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: Mutt/1.10.1 (2018-07-13) 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 Acked-by: Cyrill Gorcunov Thank you!