Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1218636imm; Fri, 28 Sep 2018 14:17:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62OyzXllksscO8Q+ux5dpxIW1m4iX5FEu7ydQ/Ek5FW36s15sif83mtmVsBWZ51jJtGeTEv X-Received: by 2002:a63:d84a:: with SMTP id k10-v6mr374054pgj.314.1538169428123; Fri, 28 Sep 2018 14:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538169428; cv=none; d=google.com; s=arc-20160816; b=peEZh7mt6fK+jChbUV3QB13QnW8KX9CE43aJPHbYZ9CfftrQ7uem8U7ZZqd6dnkXNk Y8gtLfoWjihCtPkqESfv/+9H04xMwDG4zl4JJ6N6yuhg+iSp3wbGJQhtw9wFiz9FmxFE PP9T9DDMyIFFeE59d170UqUkEeuDzDJqUFiUM+HB4b4mIKsXOJlvcpydQQz6eGmpu+J3 KLWtdMx/IFy45MUjhvb4iDaDNjo/KImS7uXcRTfphuMT4Jpxu0g6hWEDU39FrFu7n01u u5fgMJMjb6CFpdu+0ujK65TVrFAiQcibtqeOuC0lLlUph7uixlchzYvqUXwXO7Qw7zx5 gxCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Pw4yKyGUxbsS4ccgpClvfptyeKC74ILNrSnv6X4nK2Y=; b=e80j4N6I9vYLBgFTEC/AFDEzkDaU9ER8B0bPaJf+9tJFFAsPqkRVH2wgUw7ySftfXy NpSpde6upUbHBu8O80uJBDkPC773Njc+VpwSvBjd4UBAsGD/vd9jlWfoIAfPc7EYBLms prNW5TW61yshUgC5SfxP7Aei9uEUbggSvD1v170kzfcvO9WlbUgExKQW0L3gD9nwfT+r kY5kxp1JgH6IWFwXRWzR3/5Bk1PSf4yuWJRos4XNC09ajLj+Or6MQfsQC4lKUgBlVKjq 0NMa1fXXmKVcfOW5FKsIAzJT/SCnC4zWmsLnw04Uh6FLZFOFiGV/SE+DovkNxq7fdyQa ZSQw== ARC-Authentication-Results: i=1; mx.google.com; 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 f19-v6si5748781pgb.465.2018.09.28.14.16.53; Fri, 28 Sep 2018 14:17:08 -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; 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 S1727265AbeI2Dkp (ORCPT + 99 others); Fri, 28 Sep 2018 23:40:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33942 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbeI2Dkp (ORCPT ); Fri, 28 Sep 2018 23:40:45 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4DF09D1E; Fri, 28 Sep 2018 21:15:10 +0000 (UTC) Date: Fri, 28 Sep 2018 14:15:09 -0700 From: Andrew Morton To: Kirill Tkhai Cc: 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: <20180928141509.fd8f8ac8c0ea61f0cb79d494@linux-foundation.org> In-Reply-To: <153813407177.17544.14888305435570723973.stgit@localhost.localdomain> References: <153813407177.17544.14888305435570723973.stgit@localhost.localdomain> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Sep 2018 14:28:32 +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. Sigh. How many times has this happened. > Reported-by: Cyrill Gorcunov What did he report? Was it code inspection? Did the kernel explode? etcetera. I'm thinking that the fix should be backported but to determine that, we need to understand the end-user runtime effects, as always. Please.