Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp96106pxb; Wed, 3 Nov 2021 00:18:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJya1SWSqdk8LR5prKizQAggl09kbG7WIWJj97H6OGLKiPG9V12Wpb+eM3HggjDeOn9huzGm X-Received: by 2002:a17:906:c301:: with SMTP id s1mr49846206ejz.56.1635923906756; Wed, 03 Nov 2021 00:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635923906; cv=none; d=google.com; s=arc-20160816; b=vulbPfymhXcMfvv2o5FdP3Nk1sqfQP7JRvcAcIWL8gM6QSgBK/d93gAEO17Oj6aSy8 S7qko37GoLcKawnhw9n4OrpxP0NWKFX1SXIMFO+371HTI9S3Zt+buTMaXfURHBjx2ccT 7mu/p0Mw2S7jKhBvL0EV+2+sjQonV6Y7f3erhuvLthWWjNEg7iTl17h8U/j3M0oPcdUI /d4rIYUzs/Q6SXlAhs60zMcObWVFRzp2CQfEeo1uyRpcN7usdRJ7pcb12qa11ec8LA6e Q/RKxCXbbfak9QLEoTZ5eFNYrPQRne7+JhvwH7G5XNpd68efUyeHUyUEI2dlQZiFZ1aj iR1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=vIcH6VSb3RqnkaS/PUnjKDu1+Sak6IV6g8yYKpiakmU=; b=vYyk6TaWbr60X2r405owEEkVkYkr5LchxU67ZMC7jevlE+qwk953Vp+JSm/HBDrdpW ILf2FuFboVL62YBnWCEcr36jgZVo3VIbPb/fOdTfmFzY9KPY6L6/cs/D9F6M7ybHRyi8 mi9uuqk8OjnrMfPydh2wiEQQfH3VeDdVQseqxthyr0sGP/45nCZ+s6ODJmE++9H4xZmK zNCea6gv0lwVmbiqvnzSaLYevbFYO51eIHaGhyZeqoN4wLqI09WIArAF6oYQ9zQN/FlT 7kKzjx93ZWcASGiOUsqX+/QjQe5CLBa+0Ur+2IVxH/81axClN1zwrFyumj8gNoTD5uGF 3AKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lq5t1Y4f; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si1854493ejb.361.2021.11.03.00.18.01; Wed, 03 Nov 2021 00:18:26 -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=@gmail.com header.s=20210112 header.b=Lq5t1Y4f; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231983AbhKCHRO (ORCPT + 99 others); Wed, 3 Nov 2021 03:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbhKCHRN (ORCPT ); Wed, 3 Nov 2021 03:17:13 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E52C061714; Wed, 3 Nov 2021 00:14:32 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id om14so658290pjb.5; Wed, 03 Nov 2021 00:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=vIcH6VSb3RqnkaS/PUnjKDu1+Sak6IV6g8yYKpiakmU=; b=Lq5t1Y4fLvypYia5nTI2xau1T/c6ci6WmenoecOI0/EYYq51iqq3ULJaR9RqbMMP8H LkJXe7eDNfl67/7SrsD3VSs9G+w+9woXU0ZAQvREk+QKm1xCeBDvkE7hxlL4E+aLvGf6 Cx3JWyauaKqkkf34sr7zHUa2LS2z8wHaO7mWt03pn3aCk6LDPX5bbsVhMfTiK8UJvNsw KlNP7JHgduTn2nGadl9EmWfhzsVAjGy84eyuI/7SgRu8Tps8dPRWJi9MrMwAzsetyBWB sL5n3s/d77wrYrgWtKvkbmNgIqYFxNUpck16KH0FoNCtwAQT0e2nHyzbs3u95ZroBpr+ 315A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=vIcH6VSb3RqnkaS/PUnjKDu1+Sak6IV6g8yYKpiakmU=; b=3MvplVEKaLOU0eMfQnyttOuyL3Vkwf4xcisM6/Rq/YNP1cG9rHcIfdqngLgngfk1pZ CXV4WA+llA7S2LlIzRr9psU6+APhUJnfZhH4TT6lIHGQjJSJEDdrmRcuGHINapAoROPa 8uL/38jBDnJfs8MCGysAqQGXx1OQ7rt7hSas5U0LtMvn1KEbtMpIPOd4nidlhS1g9jRB uzn3xCjYi/WH/N0OKIbblR3M2Jy+nIDDkUVqZmtT4fhwBFNhd89ACDKCggSwnQ73KPIs KlWDR5Hx/4agvRm5d+FgCMVT2NaRPURaN9Rh7L624HBepVP0HeGFa58hHeXsaL3Ys5Rl MU9A== X-Gm-Message-State: AOAM531YAdBcgCDVbU+Cj7N2uXapX8k3mFGki1IH3tIacPmelttXr+Xf 4FjWWB3lTQfHYyCBamTZaMP0MpCglRHeSg== X-Received: by 2002:a17:90b:3b4c:: with SMTP id ot12mr12699054pjb.196.1635923672440; Wed, 03 Nov 2021 00:14:32 -0700 (PDT) Received: from raspberrypi ([49.166.114.232]) by smtp.gmail.com with ESMTPSA id n9sm4387701pjk.3.2021.11.03.00.14.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 00:14:32 -0700 (PDT) Date: Wed, 3 Nov 2021 07:14:27 +0000 From: Austin Kim To: mic@digikod.net, serge@hallyn.com Cc: serge@hallyn.com, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, austindh.kim@gmail.com Subject: [PATCH] landlock: Initialize kernel stack variables properly Message-ID: <20211103071427.GA13854@raspberrypi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case kernel stack variables are not initialized properly, there might be a little chance of kernel information disclosure. So it is better for kernel stack variables to be initialized with null characters. Signed-off-by: Austin Kim --- security/landlock/syscalls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/landlock/syscalls.c b/security/landlock/syscalls.c index 32396962f04d..50a6f7091428 100644 --- a/security/landlock/syscalls.c +++ b/security/landlock/syscalls.c @@ -320,6 +320,8 @@ SYSCALL_DEFINE4(landlock_add_rule, if (rule_type != LANDLOCK_RULE_PATH_BENEATH) return -EINVAL; + memset(&path_beneath_attr, 0, sizeof(path_beneath_attr)); + /* Copies raw user space buffer, only one type for now. */ res = copy_from_user(&path_beneath_attr, rule_attr, sizeof(path_beneath_attr)); -- 2.20.1