From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEBE3C43334 for ; Wed, 6 Jul 2022 11:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-reply-to:Date:Subject:Cc: To:From:References:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ebP1jG39Q0MLFUidDa/vsdattHalFeVbxtp1a+h8z6Q=; b=2g52mgDPGRKL0wdlEpQPM0ZDFi aKIRgtrjdd5yCp/knPf8AWKTa5clzh1jMjVLU+ezPPIZeeVC/qHPNLWyXxZiSToftexxGALzCDxus mU1uUtgVv9qgnRZm/l6PpierTdO4gYIOt0G/cKiMHtJ0jsnJ9oeGjmo8dtjJ43ZQ+JDCcoZHrTYTt X0jAK4fv/AAfQh/dvk+n9NSeAW41RWrg4XzPhAXtytwDiP9hZ6X4fOQ1E8rrNb6ZCXiOqgTScPBWU c7B9zM5euOsMkYFUDnhIr2vkNEaDfd4J9hTkO8MwXADqRBDmmhSXxls+nzuOp+gsOcE4bqEy+hHuU /7rxryTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o93HA-009dq9-5d; Wed, 06 Jul 2022 11:33:00 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o93H7-009dp7-1G for linux-arm-kernel@lists.infradead.org; Wed, 06 Jul 2022 11:32:58 +0000 Received: by mail-pj1-x1034.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso9711508pjc.1 for ; Wed, 06 Jul 2022 04:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=djsBeJZau7lSlteYS5ExIsD/YzkbqOh5CqDcrItHqWo=; b=q2UJC5/Cnpc58uqNx0FCca8xGpc66+6rq2Xm8KGHbhU2M7vYmIRYGWLWgUdl5xYfVV fe10NqBZ5OARcmDRhDM5BORiXY7rYLbgJ8fF5EPIXa+n/Q+Xk6IweCvRJFlrsheIL6MM HtrPv11Up7KEulqIw7br/sztHfIiI/eN9oA27f3enPkpoizepbsKphwrxLu1dRR8F/QX k6DdPrexx7eo/gdavDTn7XZBzYMHheDXu5Ej/2JnWLFKyujh4uU5F0ATGn//VMnpEmHQ KoieRZjlTw3xngmhn36FxsZDfDu3xrOkWgBpL1YM11ZVHvUbHTDymrBKmvciUbEa6Mjs Bg0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=djsBeJZau7lSlteYS5ExIsD/YzkbqOh5CqDcrItHqWo=; b=LEeSsuayF1io7dkmY9/RlKL335ahpU2NudRpMwsGjlukcrkrmiDpXmX6UlPoABZQiX nWw4AsC1LTwLlL4r2zQtyM7JbzLcKIllpCa+kcjbGnLBSIcb/+z6BbmwV0Dt69HpB9ps BnAGYsTvizWy9m4eQvp/WC+eEY/to4SBzoD6Mn8mj8eKxv1G+YTa3l4tBxlI8jY4RYGa JvtC6K92WqhaQgNsDkPb/Y56dz+YG70xSGM743Kc/cQB0sMHjlBqBaSgl8VKh5UoPEzN NtnjllqL7lXoTBg8Nmz19rpeB9hLLyWppbtzcZ2GHzFsZF5GX/qIClCnHjaSRMSLtDcL 5njQ== X-Gm-Message-State: AJIora+yWWhAITFeTwl0jepZr0PI69wwtOazWsQgGsgzqgqEDXNGxrrf j9juh+1q5wNNY76IvZ99tZ8a6E50f4Z82Q== X-Google-Smtp-Source: AGRyM1tJvjoUduIGT5ixeVfZRRRPGpZ0t27INoMLuNKZT9DE21cIpoQrKzOjWiSXuzhcKSrrFCR0XA== X-Received: by 2002:a17:90a:4e05:b0:1ec:8de4:1dd5 with SMTP id n5-20020a17090a4e0500b001ec8de41dd5mr47976415pjh.242.1657107172707; Wed, 06 Jul 2022 04:32:52 -0700 (PDT) Received: from MBP ([39.170.101.209]) by smtp.gmail.com with ESMTPSA id b21-20020a170902b61500b0016b81679c2asm19849405pls.214.2022.07.06.04.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 04:32:52 -0700 (PDT) References: <20220630161220.53449-1-schspa@gmail.com> <87mtdu15ok.wl-maz@kernel.org> <87letd0wqm.wl-maz@kernel.org> <87edyyn2a5.wl-maz@kernel.org> User-agent: mu4e 1.6.10; emacs 27.2 From: Schspa Shi To: Marc Zyngier Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Fix 64 bit mmio handle Date: Wed, 06 Jul 2022 19:29:58 +0800 In-reply-to: <87edyyn2a5.wl-maz@kernel.org> Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220706_043257_137219_30969F83 X-CRM114-Status: GOOD ( 23.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Marc Zyngier writes: > On Fri, 01 Jul 2022 15:22:51 +0100, > Schspa Shi wrote: >> >> >> Marc Zyngier writes: >> >> >> >> >> I have running some static code analysis software upon >> >> Kernel code. >> >> Seeing there is possible overflow. >> >> >> >> maks << 1U << ((len * 8) -1); >> >> >> >> The AI don't know, len is only the value of 1, 2, 4, and >> >> make this >> >> a warnings >> >> >> >> I tring to analysis this, but didn't realize the real >> >> scenario of >> >> sign extension, and finally sent this problematic patch. >> >> >> >> I do see some uninitialized memory reads (the values are not >> >> used >> >> in the end, just as temporary space for API execution), >> >> do we need to fix these? >> > >> > You need to be more descriptive here. What uninitialised >> > reads? In >> > general, pointing at the code and providing a full >> > description of >> > what >> > you think is incorrect would really help... >> > >> > M. >> One example is >> int vgic_v3_has_attr_regs(struct kvm_device *dev, struct >> kvm_device_attr *attr) >> { >> ... >> case KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS: { >> u64 reg, id; >> >> id = (attr->attr & KVM_DEV_ARM_VGIC_SYSREG_INSTR_MASK); >> return vgic_v3_has_cpu_sysregs_attr(vcpu, 0, id, ®); >> } >> >> } >> >> The funcion vgic_v3_has_cpu_sysregs_attr will read reg's value >> to >> params without initialization. There should have no problems, >> because the register value never used. > > Thanks for pointing this out. > > I spent some time looking at this, and this is only the tip of > the > iceberg. The whole userspace interaction with the GIC sysregs is > ugly > (at best), and needs some love. > > I've written a small series[1] cleaning things up, which needs > testing > (I've just checked that it was compiling correctly). I'd > appreciate > you running your tool on it. > I have run static code analysis software upon this branch, and the warnings have gone. > M. > > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/sysreg-cleanup-5.20 -- BRs Schspa Shi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel