Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp367305lqj; Wed, 10 Apr 2024 12:54:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtWN63noO8DQJP4ltp16NcVenLCG1lkweYW9NJtiJk9OEc+ZlCPrNYvwPJl5wGARuawd5+gkAqlJWUOrff4vQ73z6RJyGA8lsselXpWg== X-Google-Smtp-Source: AGHT+IFQGdJ7FM+YMgFaHeCMyWKkNFV87uoHqBFPxB7mW8NZQRgs9BCj38hub7zi1XGteLAwYwXC X-Received: by 2002:a05:6820:1529:b0:5aa:4753:fcef with SMTP id ay41-20020a056820152900b005aa4753fcefmr5733122oob.5.1712778846786; Wed, 10 Apr 2024 12:54:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712778846; cv=pass; d=google.com; s=arc-20160816; b=zfwmA5XsKcwiP7KCBNafpfMzaDXgfvg6kI5PbYoV4hrYhb/40Hx/s0fVkrBVTByyhK UtAVFiOBoWVrTE6sL2wqIwdRnEpr0yan0soGQtlqr0X/xCnCcU3PUh9TmQPhmY/87slO dZzFhUFMCJ707qvoyBlt5YMM3NuPBcxvEYZjtu34NSQdqPtzE18ZAwfRI3jOTqHF4wrl ld73Al62CTmsCqK/LpvrTJHI0dJWTnP3O9Whef5/ZcX8Fkv+IqyrVg8A+Zb/rCyI7G90 Ootvizi+REJmOAjNrrA5lSYjs0kfGAmTA8SRE6p2aNDkdprN+0/7fyprU7rYEgoEmZg6 7G4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=9LLpYn6RY+9fmh/DEGHkQYLiUAYafku1LckmK98WH34=; fh=/PfdT8ZVTpj3GNVMxu+l2AkDJ8tV60+H+zysvi69GvM=; b=W/HoJFzcv0w7yDJc/SM5PVoEXln4RE4QF0WM/+4zV12y1qHwloYCOO1RrUIaeXOgtA zlBFDVazgWsfJQmvw6ZYQDPBd6bsmB62jBElD2ALZLHisfRgmv/D8O6vLky5YG875bcT qwtpizM81BxkansWjqK3XtI4UCxuVlHrRjrijRrMgJXkGYRyOhsL04ZWc0LLgUZrKrQk DrVQ+D6RcesaqycPdNtyXVLUadXt/BI4UNuCuUG0NgYln+trxgIlvWUyD4i+L0UQuHJJ 9kjSlve1+lr6CX3wk7thrVG+TcGkzhh6AK+CsjgBxvZqJ7N98cXvmL4uUQtp5Y8sz4fL AyOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yxgoha2k; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x17-20020ac85f11000000b00434613e62e0si12617447qta.453.2024.04.10.12.54.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 12:54:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yxgoha2k; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-139283-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139283-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7EF8E1C221BA for ; Wed, 10 Apr 2024 19:54:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A29A5181B8E; Wed, 10 Apr 2024 19:53:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yxgoha2k" Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C54428FD; Wed, 10 Apr 2024 19:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712778836; cv=none; b=iz07hoVR9Bp692Jm/F8e92CQiBaY5YeqbuNn1/SI1ATxP7mzPtQjx8IYh2Z2tfuIXflY84mWGJopFKcDDJZDfIxSFeq8pU+ksG5piZpha1ortoLzpIRFDVSiP2uSmYpie5SWVNe4rj1NcHxw7zOxKgqQ5wR187qWNnuzFCwIcpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712778836; c=relaxed/simple; bh=/gzrab9sjjLCDQ6VDRJrkCIVoiCcc5F44HEM5Lx1Wxs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fCcCaZgX8u5YKO7tXhbY62NEGQoQPC8vv2H5pA7AHXVMRZLVDSqBrqRjdL2t0oZwdPcb0/cNPcM+0Iuc8C+/vaUWBM6WZQ/jatxp93kQdPqEbAS+s+kRrEMj+w2wcvuv8s1M+nyZTigyhbmo34fSNd1VIhmBjoN0FpIM5ZMpEMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Yxgoha2k; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6ed20fb620fso3372588b3a.2; Wed, 10 Apr 2024 12:53:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712778835; x=1713383635; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=9LLpYn6RY+9fmh/DEGHkQYLiUAYafku1LckmK98WH34=; b=Yxgoha2kL19hmet5BgDig0Jsj/o9EeLXC5tei1ccue5csVlagoDOoM72hTr667GyWh +0y0epT3YSYL/TQWTCwO7l8cO0+77qXkSljm2MznB4yxlLJ1SCIhr4YjCfxoNYmyTpCb p24Y4qXaZ3iCdg0kLT+9Uayad0sf3jJyUd5V1/tzVaPAIzXk+o4xsg/PmhI+d632mnHB QnJJqSYMTQzfAUoF8iw3MGvjOJLbc1yoDY2DzVl61J6QRq3WpIECX3Ymxp/GsGpJsGG+ lHEYkvn7jhVcncwrgsPnetvn/cZIJqN8HXEUETuKbW/aRgfq0m7G5MoiXrbxUhQeR4ZL P8ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712778835; x=1713383635; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9LLpYn6RY+9fmh/DEGHkQYLiUAYafku1LckmK98WH34=; b=SECTIYH5Zo9gKnIVn2A+1+h0sSODWODnc9HYJ3LvTOlM8wUPIBuJcs9y/xIy9jwcl7 XXFsxPHw0Oi00J7ZPaUMhkwKiDMxwM3agnO/pP0YLNSVn4pwoMWQwqKot3uu4jWMj8Kd JfBF74lhvnjUMdRhRfG6gFcJ5pSMBbxNpNoeBBUDIOwms+o9tFYnhlBExAjrb9K16X0Q TLYXJTj6Y60rYv6olJHIwq7vpNMryABjNM7Tq1tsYSpAbQyZizeZXmLtTqWDflLy2mBP 0ehTnuxjbJtEFbVWbt9qx1SdpVDZoI3WKQUxN4ge6m4eM5QG1l/39DsrKYOnRt/1PlYy rB+Q== X-Forwarded-Encrypted: i=1; AJvYcCV0PhQ/i/CQ+Qqhs/N2EuRZtehGm7Slzii3i/aN4NJvy7mfYtrDpgzF6r/entqenHXu2dcrstIn6jvj7SppWARUVMp1NWmhSMK2TOlMip/ca4ftf0FhcltyX8ELrBePNmyDifqB81OgvbIy/o2mAfqNsbpOYg+SK2Ggm9lv09JVv5OI X-Gm-Message-State: AOJu0YxCl1sUJktteu4HJa8I+5BKu/YDSjrQ9wnGOhATfqZxzDRbaZEu Ety9PMPJzzYEnaGvwOJJZbfn8zu2Ly53eRjRsY/2tYu640wij70J X-Received: by 2002:a05:6a21:3e0c:b0:1a7:11bf:7b74 with SMTP id bk12-20020a056a213e0c00b001a711bf7b74mr3495432pzc.62.1712778834624; Wed, 10 Apr 2024 12:53:54 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:a5f4]) by smtp.gmail.com with ESMTPSA id gx15-20020a056a001e0f00b006e71aec34a8sm15295pfb.167.2024.04.10.12.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 12:53:54 -0700 (PDT) Sender: Tejun Heo Date: Wed, 10 Apr 2024 09:53:52 -1000 From: Tejun Heo To: Breno Leitao Cc: Josef Bacik , Jens Axboe , leit@meta.com, "open list:CONTROL GROUP - BLOCK IO CONTROLLER (BLKIO)" , "open list:CONTROL GROUP - BLOCK IO CONTROLLER (BLKIO)" , open list Subject: Re: [PATCH] blk-iocost: Fix shift-out-of-bounds in iocg_kick_delay() Message-ID: References: <20240410193642.1303741-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240410193642.1303741-1-leitao@debian.org> Hello, Breno. On Wed, Apr 10, 2024 at 12:36:41PM -0700, Breno Leitao wrote: > When running iocg_kick_delay(), iocg->delay_at could be way behind "now", > which causes a huge tdelta difference. > > The tdelta value is used to shift some bits around, raising the > following UBSAN splat: > > UBSAN: shift-out-of-bounds in block/blk-iocost.c:1366:23 > > Debugging this, these are some values I got in my machine with 6.9-rc3. > > now = 3626064295 > iocg->delay_at = 3275794093 > > Fix this by validating that the shift if valid, otherwise bail out, > similarly to commit 2a427b49d029 ("blk-iocost: Fix an UBSAN > shift-out-of-bounds warning") Rik alreaady sent a fix: http://lkml.kernel.org/r/20240404123253.0f58010f@imladris.surriel.com which got commited as beaa51b36012fad5a4d3c18b88a617aea7a9b96d. Thanks. -- tejun