Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2371754pxb; Fri, 5 Feb 2021 16:46:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzn6HTXfmBfkijtZJQHAfTs+xUhURXMUOer+sSjTRQnUQC0g5rbpMeVU4ozNRn5Cw/nzSH X-Received: by 2002:aa7:de14:: with SMTP id h20mr6104850edv.95.1612572411273; Fri, 05 Feb 2021 16:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612572411; cv=none; d=google.com; s=arc-20160816; b=uwS7NNuQAjT6a8yDDcqXTZ1hRWOKbxmH3bnZuskVKu1wQhucMlj2nCX5QDc2KJWb+u rudFbx1a/pt8wMdP5rY7xw9O9dzDFkYPzRsgxHKSrA79F4N1NLQ/ZaNR5pBx2FcMz7xS t0jjFsvBWTJUPM4GuGaeaiHkdFv+vbgCRgwRhFnvrNFwrl2HUq4RjQAkAknPq5vO5fFE yLVaJWgu9jLIk+tStSucVlgLrUXcsX/1LvVH03jDQAK7pznvWlv/8QAeaWfC66/6qZa7 y4YXA5fLPUhVMpGWUarOV7nqMikCDABLJnJv9gXxmrfOulacjMbEeT2MslBMYoE243zJ nbtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MIfUaXpzVunU5zh1KjtH6JOxXNPGKR6YK2lz8hVjUyQ=; b=eO0z8F+bkhUw65jsocwSXpJgOJ63Uer42kEVqvloq8DFUXJbxaMjdRvreSZe7knsCM QAo305DMlKGOWhZ/EbjRm8xQfzkgSoXNPPJiR2hTwBGv05e/Qy/YW2PQfe23nHj7saHp +G1w4bp64H88NWY3DHaoh7zoAwk88VBMDxV2z/aM98zM+MnR/NMHu8tzW/6LxsFQlKP7 siiGOIzHRzhhp/5QzH4CFbejY0hKcH3nvS8G87F1QhWMu/TUBrMypUhkCP1fcKSyEHlU Z9o7cJeH40HHWoUxHEd+4r3cKEI72Q0Lejk662UcuZlq9bRzQ+zIt5XhOqrHtvSPptEG Rc0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MbIfqWAX; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si6171739edd.337.2021.02.05.16.46.27; Fri, 05 Feb 2021 16:46:51 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=MbIfqWAX; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229766AbhBFApx (ORCPT + 99 others); Fri, 5 Feb 2021 19:45:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:52788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbhBEKHB (ORCPT ); Fri, 5 Feb 2021 05:07:01 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE67964FF1; Fri, 5 Feb 2021 10:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612519551; bh=bs0XNM8gkt3RASjOhVZFNWk8DM7IhwKfz2bXsbWngbY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MbIfqWAXQsPNyAuKIieIdtVLPMHJ4NI+F0LTN+UJt9FrMnXbzvB3pKdCfS/t5MwSl AK9Nuslo3MM1WLO3kiQenPY8+z6owyOWKcAu6jPwAgua3mIbi4ZH5luM6FwFl61tsH qTu+hDP9uUVP1Zduw88mqpxLB8Okw811bmSy6tMU= Date: Fri, 5 Feb 2021 11:05:48 +0100 From: Greg KH To: Lakshmi Ramasubramanian Cc: zohar@linux.ibm.com, bauerman@linux.ibm.com, dmitry.kasatkin@gmail.com, ebiederm@xmission.com, sashal@kernel.org, tyhicks@linux.microsoft.com, linux-integrity@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] ima: Free IMA measurement buffer after kexec syscall Message-ID: References: <20210204174951.25771-1-nramas@linux.microsoft.com> <20210204174951.25771-2-nramas@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210204174951.25771-2-nramas@linux.microsoft.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 09:49:51AM -0800, Lakshmi Ramasubramanian wrote: > IMA allocates kernel virtual memory to carry forward the measurement > list, from the current kernel to the next kernel on kexec system call, > in ima_add_kexec_buffer() function. This buffer is not freed before > completing the kexec system call resulting in memory leak. > > Add ima_buffer field in "struct kimage" to store the virtual address > of the buffer allocated for the IMA measurement list. > Free the memory allocated for the IMA measurement list in > kimage_file_post_load_cleanup() function. > > Signed-off-by: Lakshmi Ramasubramanian > Suggested-by: Tyler Hicks > Reviewed-by: Thiago Jung Bauermann > Reviewed-by: Tyler Hicks > Fixes: 7b8589cc29e7 ("ima: on soft reboot, save the measurement list") > --- > include/linux/kexec.h | 5 +++++ > kernel/kexec_file.c | 5 +++++ > security/integrity/ima/ima_kexec.c | 2 ++ > 3 files changed, 12 insertions(+) This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html for how to do this properly.