Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp342442pxb; Wed, 3 Nov 2021 05:15:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx88WW4VLFHp1f28AFkcHtzN9kThyn3BSCAbYFmx/dp1NtmsYKlkZlvA/Ag2L2X5aINbsGr X-Received: by 2002:a05:6e02:8b4:: with SMTP id a20mr30048085ilt.315.1635941746773; Wed, 03 Nov 2021 05:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635941746; cv=none; d=google.com; s=arc-20160816; b=a1fHzJIr9tacVix+qLUdjG0U5jqvu0r/N8spQ3wIwAxlmM+jNyibzutvugSjGoDfzp xMKCHQaQC3LRNkFc8XCE9eB7halsssjV8RGNZrmIT5az9g65EtYW1RltXYW3GA7fwtzx IxZlunRDM0dWJQuXpG76HMxh2rCrl12kKYWxLArlXvdg1kQLNQd9f8zQb0FyKzChL38V UGdbMWmcfDIE4kb3rqScOLY09JrpGovDskWwFQSurPalvBJPsdw/mfdpNS7jxuiLUy9D h+0Kzi7CPQZNyElqkPUxRdTA2Qts4XJzjsTky2IMrWgt1A8+10Vs4q1dZ4A/DwnHNgA5 YHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=l9ebvC5McOKBVkEvBFiRrgdGKyiMIz2sJq38aDnsqus=; b=CpoUiayuJwv5Q5Oz+1m9U0xFMAe24X6QQGrLpa/IrM5Ltvq/MFbLCIxAsaimBSty8k RKHt7MzCS2f17i7s71IIU0Hwu8m81Px3R3tezldTWYzz22tSbiZd4L7v3/lFemK5kymf 9l+ItsjC2ZC65koUOEQ61NtnQb4/3/6axLfQbyk0YEDe3Ybv5EdpcWign9+xPZaNBKNC a2MaBXgYJ8gJJy4+8C/9GFKFSnSBHd3rWYdFSiDu+MA4fJkQBIkGA0CRBSQcbVhOKy6J ePvOekZZo9iV/VbHim1thgDVqY1jzMofg+0ZjgyPbDObc4rcS5AcfaDJeezVp3k3DYaM Iz6w== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si3616247ilx.88.2021.11.03.05.15.32; Wed, 03 Nov 2021 05:15:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230304AbhKCMRK (ORCPT + 99 others); Wed, 3 Nov 2021 08:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbhKCMRK (ORCPT ); Wed, 3 Nov 2021 08:17:10 -0400 Received: from smtp-42aa.mail.infomaniak.ch (smtp-42aa.mail.infomaniak.ch [IPv6:2001:1600:4:17::42aa]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D65E8C061714 for ; Wed, 3 Nov 2021 05:14:33 -0700 (PDT) Received: from smtp-2-0000.mail.infomaniak.ch (unknown [10.5.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4Hkm0m1xDpzMq3Fn; Wed, 3 Nov 2021 13:14:32 +0100 (CET) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-2-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4Hkm0l4h6gzlhP4W; Wed, 3 Nov 2021 13:14:31 +0100 (CET) Subject: Re: [PATCH] landlock: Initialize kernel stack variables properly To: Austin Kim , serge@hallyn.com Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org References: <20211103071427.GA13854@raspberrypi> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= Message-ID: <7a71215c-58f4-081b-6a2e-030073f2737e@digikod.net> Date: Wed, 3 Nov 2021 13:17:19 +0100 User-Agent: MIME-Version: 1.0 In-Reply-To: <20211103071427.GA13854@raspberrypi> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Austin, On 03/11/2021 08:14, Austin Kim wrote: > 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)); > + This memset is already done with the copy_from_user() call just below. > /* Copies raw user space buffer, only one type for now. */ > res = copy_from_user(&path_beneath_attr, rule_attr, > sizeof(path_beneath_attr)); >