Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2739337pxb; Tue, 24 Aug 2021 06:33:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4395Nmq79Al0/NPs0GhV3rBWcCjQhu5ATFjJun5feiA4x7reo+XC4Fi8Ii5eGAcb1rcbL X-Received: by 2002:a19:2d0e:: with SMTP id k14mr28276701lfj.409.1629812001363; Tue, 24 Aug 2021 06:33:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629812001; cv=pass; d=google.com; s=arc-20160816; b=Nd6O/xHH6DYFeq0bkrAK54IeI0pxrQlOBJsvFSl5kA/4vaU+9fiyUYO4FZSG5dXrl/ plbBblRJql2HWbrH9dIYDiGzxKenkOCBScKvbdNsLqxKYEcUTybVnwqwwtz7lx6/695m zXUhzQLBf6Ub50DHgxOdZmGfPUyzHJ+1LC0LASvBw0Q/Y9cfObDh7Rm97hYcV0Tpxzb2 ZGVQQziVQ0CPDu7DQPanKiV3h24z7FhkEoIW+r4wVwg0Qdzw8ZozGPHaEXPSbb0OIbl2 GpvUhMpaV3FbySgf5hWRVXDG7wAdiscByEGRthH+R22yKRelY9WBvK9Y45SFZaToOSzy 7/CQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=SiixubQU2GjAepNOdhPr42fUO0OWV2GBDyBz0wYJeU8=; b=EQMcEMG4UUsHPUNbGrjfmL0mwDqekk+Kh+T74eqJJCeH+txiWeKIHVDjCJWF0VI7WO vHdwE956exFaJlaVmojX/FUpBY5J5HXXVW/POL6+J3+k0ztqX6BsEguSLvns303pP3sv xZ3nUQ3pJU6Aksoyy46ngAvrLo+2XgTiuzzQmz2l/SqH7RM/oVUfY931LY50jrC1bE4F VwOYOHnYlMQeOBG800aJ2KjQqwa9KeXvAmEWe3+HkY54hr5z9GKsmivU/FNYuCHo6BB7 E/FL1/tJV7ZMiF4B1uVh/VVS19IK+TFuCTsRbi9Dsg76Wn74t1yX4ChcEk6xz7yGhBzT 3RgA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=s+JR9xGF; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt43si4248077ejc.5.2021.08.24.06.32.55; Tue, 24 Aug 2021 06:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=s+JR9xGF; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237485AbhHXNbl (ORCPT + 99 others); Tue, 24 Aug 2021 09:31:41 -0400 Received: from mail-bn8nam11on2088.outbound.protection.outlook.com ([40.107.236.88]:6112 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229601AbhHXNbk (ORCPT ); Tue, 24 Aug 2021 09:31:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GdqR2cS1PSc/BvfTMkAdPT4xBv/BWZzbNFY/BHQ4CLG4+tX1ssJ/JAVQxR5a3omxRrTuFHlwsb5aJ7SuNOwwePnduPJBCEWWiAJGkku3rXZaEX/91KWJyDpyshU/TgdJdXL0xomTa2LirOgz1MxNDaSYJo2higse58heeOQFAbC1Doqqr5R1ekjXTQC4N3EhDJYCzOYkQ6eXhBmKvfoQLnAhgG8bJFfa2Hul5ez9ZiLKyGVFtbwE55C3/mcipdSQJin7RRBDW5OX89h8C/1OdAaoEMxj3PSMqH/UKnDxzTiVY14G4i+xrWBmvLHiqyYjnCGrrIfrS0AdX36MbaHeUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SiixubQU2GjAepNOdhPr42fUO0OWV2GBDyBz0wYJeU8=; b=MiS/fWCliem7h+E7uXAJTQxahQ4on7BEJXnqohlt86xILRTHt80hXKDYi4JVrioWDABALdg4yvptYNw+8mmAEc7rLJygMXwED+eugMvCmP/9D7NCAKfR12VS+9XPXgf/Xl3/7qwAd2CIo3Hlb+Nl9M6vCZ3sh59yJufsO4ZOPAO44Ga1WPKzbjdG+MP7D0d4AlIBu6gDLLShYLRQWjtQjr6lZKXu49aYm0hE7UsndJmUvLqsTk47zceklLegJ2e0C3VPWVxKFGQDAM+W/+1B7uHyPrfSfFZesJuYi/NoZSCHejXuWA1w/2rg5tvSDBUVU90nGMwKkzxntg/YrzBg1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SiixubQU2GjAepNOdhPr42fUO0OWV2GBDyBz0wYJeU8=; b=s+JR9xGFfigJG8F8Byc6UQBmpMX20giOC/XZW57I+KUVadPExsejkEt9FTZdGlz29BVD3seqiIQoBD+WDCLeHTgRlQs1HP9pyGP36Mxayf8wdSz1qZxoiTDBeYHQL35oUIB09Vo3iMLX+OPHf6qDPeDj5QIaEutDVIWDTAcqkGAQV09wrHFTn0C0fc1v3FXf67sFv1NzbcC6ssXG+Bfi6ACn9po5U+vjMsBetItSXy94+2ywMgQOt+XdUY8YnEtTchBzsNX+sG/RsoaxX++mT5g0J5gsC+rbQ3mKIyY01l0x3kPCvmt7TynDTLYidt4N3yQVtvADK6iEZPDc0foIVg== Received: from BN9PR03CA0726.namprd03.prod.outlook.com (2603:10b6:408:110::11) by DM5PR12MB2503.namprd12.prod.outlook.com (2603:10b6:4:b2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.22; Tue, 24 Aug 2021 13:30:54 +0000 Received: from BN8NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:408:110:cafe::54) by BN9PR03CA0726.outlook.office365.com (2603:10b6:408:110::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 13:30:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT053.mail.protection.outlook.com (10.13.177.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 13:30:54 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 24 Aug 2021 13:30:53 +0000 Received: from [172.27.13.92] (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 24 Aug 2021 13:30:51 +0000 Subject: Re: [PATCH v5] virtio-blk: Add validation for block size in config space To: Yongji Xie CC: Jason Wang , "Michael S. Tsirkin" , Stefan Hajnoczi , virtualization , , linux-kernel References: <20210809101609.148-1-xieyongji@bytedance.com> <06af4897-7339-fca7-bdd9-e0f9c2c6195b@nvidia.com> <6d6154d7-7947-68be-4e1e-4c1d0a94b2bc@nvidia.com> <7f0181d7-ff5c-0346-66ee-1de3ed23f5dd@nvidia.com> <20210823080952-mutt-send-email-mst@kernel.org> From: Max Gurtovoy Message-ID: Date: Tue, 24 Aug 2021 16:30:48 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5d2d7630-49c5-4b13-64ac-08d967036606 X-MS-TrafficTypeDiagnostic: DM5PR12MB2503: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SxWs7H40Re6ktutVLj+f7RgiQCcF5OT0j/lSpPtqJ0uBTkxC20uAnqqQvoDO2nh63JTHFINEQ6WxHBzs/vS2ui4kgkozkbVRABOI/cCvY1YDgrGzRBBX7doghtBjQuENncaSSAlAQpfz9kFYT/ytUn1j43Fzf2TSYXfzBhyonnDc4xdt0WPYyhPYCl4KoubwfCBOPQ2IUQyFTwHG8Bw3enWIRj3dKsIwv91RHmfWpZAYIBxTMVNvG0YZ+q7mxFBIzBegonUaFjzd5NJocsvr5uQvcMFPaH8zBn/w+7WbxaX12a5rppv0az64Wbo2uQb1FyxjDqnXld8qzoX8Pe6MWiuqcBAxhiufQVV2T2ifz+/OX2Qf+IudAZPKgJmuDpsu0lULROr/u/+J2Bxr+ndv57PW+3nOpMX1HZVcWsSKILS0rg/i2ZTEWRdo+mknan6eohbeCzNk4J5bujMGjUcZ4QSHdmWQ7uJoTELScrokWUnkBFEZ7XZKISFn2cd97o7kZOsRWDJrGEuHiquC4Rslv0ZvDMyPvwt6P8WapdUZdeCu5AovtN6CEI7qYTLKs8quYy20RK3YruT7TacCSMB1LX/61kgWy/s8BE2zKQYZe8gITRFeIw0Pds5BcO37IdUa8qXMAcipPSZnnKsxhT4RHQ502YOXmyzPh/seLqVeq8rkJFWzKgp31PxfZgL3F9sR1jrbBGM36P/ZqTYTq+QXJegD/m3xJxD39Tp9IZ+njVR7902K/KNKGrT2AqJ2qU8xVif7yydQqhDpE7TYEeW126nyAHYpnYelyAE0dE+2ywM5C4gSCnO/DpDkLZPzJjXK X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(6666004)(4326008)(7636003)(36756003)(8676002)(8936002)(2616005)(86362001)(6916009)(82310400003)(70206006)(31696002)(83380400001)(5660300002)(47076005)(26005)(336012)(966005)(508600001)(53546011)(356005)(70586007)(36906005)(16576012)(186003)(54906003)(16526019)(31686004)(36860700001)(426003)(316002)(2906002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 13:30:54.1025 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2d7630-49c5-4b13-64ac-08d967036606 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2503 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/24/2021 3:52 PM, Yongji Xie wrote: > On Tue, Aug 24, 2021 at 6:11 PM Max Gurtovoy wrote: >> >> On 8/24/2021 5:47 AM, Jason Wang wrote: >>> On Tue, Aug 24, 2021 at 6:31 AM Max Gurtovoy wrote: >>>> On 8/23/2021 3:13 PM, Michael S. Tsirkin wrote: >>>>> On Mon, Aug 23, 2021 at 01:45:31PM +0300, Max Gurtovoy wrote: >>>>>> It helpful if there is a justification for this. >>>>>> >>>>>> In this case, no such HW device exist and the only device that can cause >>>>>> this trouble today is user space VDUSE device that must be validated by the >>>>>> emulation VDUSE kernel driver. >>>>>> >>>>>> Otherwise, will can create 1000 commit like this in the virtio level (for >>>>>> example for each feature for each virtio device). >>>>> Yea, it's a lot of work but I don't think it's avoidable. >>>>> >>>>>>>>>>> And regardless of userspace device, we still need to fix it for other cases. >>>>>>>>>> which cases ? Do you know that there is a buggy HW we need to workaround ? >>>>>>>>>> >>>>>>>>> No, there isn't now. But this could be a potential attack surface if >>>>>>>>> the host doesn't trust the device. >>>>>>>> If the host doesn't trust a device, why it continues using it ? >>>>>>>> >>>>>>> IIUC this is the case for the encrypted VMs. >>>>>> what do you mean encrypted VM ? >>>>>> >>>>>> And how this small patch causes a VM to be 100% encryption supported ? >>>>>> >>>>>>>> Do you suggest we do these workarounds in all device drivers in the kernel ? >>>>>>>> >>>>>>> Isn't it the driver's job to validate some unreasonable configuration? >>>>>> The check should be in different layer. >>>>>> >>>>>> Virtio blk driver should not cover on some strange VDUSE stuff. >>>>> Yes I'm not convinced VDUSE is a valid use-case. I think that for >>>>> security and robustness it should validate data it gets from userspace >>>>> right there after reading it. >>>>> But I think this is useful for the virtio hardening thing. >>>>> https://lwn.net/Articles/865216/ >>>> I don't see how this change is assisting confidential computing. >>>> >>>> Confidential computingtalks about encrypting guest memory from the host, >>>> and not adding some quirks to devices. >>> In the case of confidential computing, the hypervisor and hard device >>> is not in the trust zone. It means the guest doesn't trust the cloud >>> vendor. >> Confidential computing protects data during processing ("in-use" data). >> >> Nothing to do with virtio feature negotiation. >> > But if a misbehaving device can corrupt the guest memory, I think it > should be avoided. So don't say it's related to confidential computing, and fix it in the VDUSE kernel driver in the hypervisor. If this is existing device and we want to add a quirk to it, so be it. But it's not the case. > Thanks, > Yongji