Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp684635pxb; Wed, 16 Feb 2022 01:59:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXlx9WI8v9fvTZHfjLxS4UYZ73VWtdDFAIpgTu9WKvaI/q8o8Nb/NFy5vf7W+uQigcVTd6 X-Received: by 2002:a17:902:a583:b0:14d:524e:4490 with SMTP id az3-20020a170902a58300b0014d524e4490mr1982034plb.151.1645005567564; Wed, 16 Feb 2022 01:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645005567; cv=none; d=google.com; s=arc-20160816; b=Ln33A7uIOEQDXQmglqKCTloxfTC/8Hb/Qm2wJvChaDNkKrwg0B+lxdPdMVJyd2ds6Q 12GlpUAF6p13FPd+67eApqaa3xqh1yQ39eXmdwGEZzyFnMkfV2hE72zUHVZSvwkwl/Gg EqmJJFlkafHP5gLs+sK1NdiSJ3El0CFhcm1SdF7GFWxLNbO0EmXLNPGtAYn50lrbNSPh eO+nZ0OR8vlK0U2qCGcuU2hY/w3TSUWv9Q7GV1+eRZziuz39UvVYoxFFy/Y/uPst7LoX PUJDQg/+pWv9XiZhnaS8Z5gKGQqzS7y0EoKskC1H7w5JeaoAaiGkGMiCwdDjeX7fELnH P4Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g6yc0CzjhZvL8asvAOjVxpZRVzWjAV26MMR3ayD0Jss=; b=bf0/KhwEt2JBotwux311W0w0CwB2L1h2qKj7nWpgCZe0oknXxDwbnU+SKZ1bKF2rVG RoB4JnIDRVsp3ZAtvp/iFa9ver9GI4+xcSN17W7X6qu3FWn6mvUfWTWc/N0eS/ufzSpO 0Ln1kekCgLkP5I7iiGe7XhYt+/kY2dI3QHGmJ0GZLRbBWUyVuWlKW3Di1ToLaLFpk05u +tF7sRkPXxOP3MPsVf2941EdQSSZICUuPyWchCqNfJii4GRwY4pg/R+MjlmCJnl80exZ uCtoQx/RbAxuq2mb/zrbPA1UI0Ii45HSa0MZe4eg++GqklbYOMbYVfO5f0zpjXdHpcq0 gSog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XGdkv5sh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e91si17089676pjk.96.2022.02.16.01.59.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 01:59:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XGdkv5sh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9744A2B68D2; Wed, 16 Feb 2022 01:59:23 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbiBPJ7d (ORCPT + 99 others); Wed, 16 Feb 2022 04:59:33 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbiBPJ7b (ORCPT ); Wed, 16 Feb 2022 04:59:31 -0500 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44FA6265136 for ; Wed, 16 Feb 2022 01:59:19 -0800 (PST) Received: by mail-yb1-xb30.google.com with SMTP id p5so4302615ybd.13 for ; Wed, 16 Feb 2022 01:59:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g6yc0CzjhZvL8asvAOjVxpZRVzWjAV26MMR3ayD0Jss=; b=XGdkv5sh7wesUFoBMJy2j3M0ZGke0f+k0scopU8aYxlvCwi4vR/FyE53oliA3nse3E GsEQ2lf4rd2ykfkXR34DrqI2ga7koqk5dbsQuGeuH7cfUy4adGZqDjSF3dPD0ex7Uwzi DM9zTFb60MwwHYDFxNhz7o/AH6f226Pms31VGM5NbXsno/58svkXLg73g0cnzKXY7KCi KUQwn8q07xqK1RpieHRGRmyz7zDGH/5/T9Rf1sT/D7sJXvytIMv6oUjLJCCu0dUYNu4A GOgq+VSjs6Eat5SoNAhgOqF664kfJ/lRXA+T7/mtIrz+MWugKBILKg2OzeWPdTaHa1nn HGhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g6yc0CzjhZvL8asvAOjVxpZRVzWjAV26MMR3ayD0Jss=; b=kBJ7em2DkuN0EnaaCTuY3ydaSeCBCOag+6FOekMShfnQTwGQ6DKXgDZhcZ64pGronv 5J+lsknqcBKucMq+0d4yEmdblDYNwz9tXS6sP1IYRt9/5NsU3In1j3JMqS1ZuuWPsg2k D08tcZ6pEXru7ss1TnrWtj/jyXwLoftINPxHKqEO9NebfTU355rW5pIaRMKM9VnrOUFE /2/SSP6Lg76yeUHM18quLvxmrgCzd0vzjwixm+WNZFtnUBgXFQw/I75lSQ1JbjZC1ECa VvzXi+hgGNiH/i69fvgDRpJvTywws/O7RwJi9CHe6ETd2j/+KRQL6SkfcvHwXfDo9IZI MG7w== X-Gm-Message-State: AOAM5326GBM14pcgLY5jKcqHh20pi4MhHvw6E8FH6QIR7U+Onya9oGOY ITLlI2ABrk8VnoF6Lz0Ay0ivSc1DFWMc3IvKdJoJiA== X-Received: by 2002:a0d:ee41:0:b0:2d2:f0aa:d3ba with SMTP id x62-20020a0dee41000000b002d2f0aad3bamr1771660ywe.512.1645005558266; Wed, 16 Feb 2022 01:59:18 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Marco Elver Date: Wed, 16 Feb 2022 10:59:06 +0100 Message-ID: Subject: Re: [PATCH mm] fix for "kasan, fork: reset pointer tags of vmapped stacks" To: andrey.konovalov@linux.dev Cc: Andrew Morton , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Feb 2022 at 17:52, wrote: > > From: Andrey Konovalov > > That patch didn't update the case when a stack is retrived from > cached_stacks in alloc_thread_stack_node(). As cached_stacks stores > vm_structs and not stack pointers themselves, the pointer tag needs > to be reset there as well. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Did the test catch this? If not, can this be tested? > --- > kernel/fork.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/kernel/fork.c b/kernel/fork.c > index 57d624f05182..5e3ad2e7a756 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -226,15 +226,17 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node) > if (!s) > continue; > > - /* Mark stack accessible for KASAN. */ > + /* Reset stack metadata. */ > kasan_unpoison_range(s->addr, THREAD_SIZE); > > + stack = kasan_reset_tag(s->addr); > + > /* Clear stale pointers from reused stack. */ > - memset(s->addr, 0, THREAD_SIZE); > + memset(stack, 0, THREAD_SIZE); > > tsk->stack_vm_area = s; > - tsk->stack = s->addr; > - return s->addr; > + tsk->stack = stack; > + return stack; > } > > /* > -- > 2.25.1 >