Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1404842ybl; Thu, 22 Aug 2019 14:05:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/g/q5FzQUDDXXcz5o+RCc5ENKaV2/L2E1xvM6uMeRhWd7Ue0/ILFdrsQSAoluGJt8+gJd X-Received: by 2002:a62:be0c:: with SMTP id l12mr1293562pff.224.1566507903598; Thu, 22 Aug 2019 14:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566507903; cv=none; d=google.com; s=arc-20160816; b=h7znB1VcM+4fT6n30xopYGdJV8wFejqChjWqbBOOuV1yuh3DuxmiTi2rYrTLPvqEUy PIQqE9dDrWSpLHxCYQ6U4kMsu8XzEdC7aSKEHWR98+fj9X/wjE2MEMHlvogrmTJHnKcm dbRykPuWaXp/hT8vdqOTBsaJu/YwAI6O4Co/41+d7eeV1vpwdZ/FFs9N6BbkA/sIp+4I CsFC3VuwgPohZYaxhdq0HvxlSSHwhEP3/YMqDKH4aZNrxseTTTfuGU6LTPTB5EUA7XhP jIiIoWcGhUS374oU+Mafsl+IjeGVDcedEpt0CykWQjozN0eKTi3sLFPqmNNDkFYKoldk dNKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=D8xKfN1FTLZi6OOKi6UQk9VeFbtaJRLMVagWkD74TzQ=; b=DvfZn1BL4I0sOoYEeKot0ypwagCLRRIHLE1MWTBxXxCo4GXaRHd+UyGqE4dtFyA0yJ 0O8w3T9SZ6TfMrYqWT/0yI3nzGU3Uf9Stw/djXzLoXo3RDUKc0Y84HgkZ3gZsi6jMTKn Sh88dq4yiA7HjrWJCORAzrAQYoDMUjZ53lnYJBHmKeShseo00wGH5CciCG8609ALVART +bLTELxEO5r+v53KS0XpM5pJJ2WqxpUzUHGFf6/TDAm6ze1sr4Rdys8MezO5+8MGKLxG igz/h8PdTXEo51z5Qk6mvNPedGj8u2shH2lAxHRl6YHkiTu9CFzt2oySnlTb3aqG5S1Q Jztw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si514457pls.280.2019.08.22.14.04.48; Thu, 22 Aug 2019 14:05:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388829AbfHVRIK (ORCPT + 99 others); Thu, 22 Aug 2019 13:08:10 -0400 Received: from relay.sw.ru ([185.231.240.75]:60454 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388772AbfHVRIK (ORCPT ); Thu, 22 Aug 2019 13:08:10 -0400 Received: from [172.16.25.5] by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1i0qYx-0000iY-OZ; Thu, 22 Aug 2019 20:07:51 +0300 Subject: Re: [PATCH 2/2] riscv: Add KASAN support To: Nick Hu , Christoph Hellwig Cc: =?UTF-8?B?QWxhbiBRdWV5LUxpYW5nIEthbyjpq5jprYHoia8p?= , "paul.walmsley@sifive.com" , "palmer@sifive.com" , "aou@eecs.berkeley.edu" , "green.hu@gmail.com" , "deanbo422@gmail.com" , "tglx@linutronix.de" , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "glider@google.com" , "dvyukov@google.com" , "Anup.Patel@wdc.com" , "gregkh@linuxfoundation.org" , "alexios.zavras@intel.com" , "atish.patra@wdc.com" , =?UTF-8?B?6Zui6IG3Wm9uZyBab25nLVhpYW4gTGko5p2O5a6X5oayKQ==?= , "kasan-dev@googlegroups.com" References: <88358ef8f7cfcb7fd01b6b989eccaddbe00a1e57.1565161957.git.nickhu@andestech.com> <20190812151050.GJ26897@infradead.org> <20190814074417.GA21929@andestech.com> From: Andrey Ryabinin Message-ID: Date: Thu, 22 Aug 2019 20:08:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190814074417.GA21929@andestech.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/14/19 10:44 AM, Nick Hu wrote: >> >>> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S >>> index 23cd1a9..9700980 100644 >>> --- a/arch/riscv/kernel/vmlinux.lds.S >>> +++ b/arch/riscv/kernel/vmlinux.lds.S >>> @@ -46,6 +46,7 @@ SECTIONS >>> KPROBES_TEXT >>> ENTRY_TEXT >>> IRQENTRY_TEXT >>> + SOFTIRQENTRY_TEXT >> >> Hmm. What is the relation to kasan here? Maybe we should add this >> separately with a good changelog? >> > There is a commit for it: > > Author: Alexander Potapenko > Date: Fri Mar 25 14:22:05 2016 -0700 > > arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections > > KASAN needs to know whether the allocation happens in an IRQ handler. > This lets us strip everything below the IRQ entry point to reduce the > number of unique stack traces needed to be stored. > > Move the definition of __irq_entry to so that the > users don't need to pull in . Also introduce the > __softirq_entry macro which is similar to __irq_entry, but puts the > corresponding functions to the .softirqentry.text section. > > After reading the patch I understand that soft/hard IRQ entries should be > separated for KASAN to work, but why? > KASAN doesn't need soft/hard IRQ entries separated. KASAN wants to know the entry point of IRQ (hard or soft) to filter out random non-irq part of the stacktrace before feeding it to stack_depot_save. See filter_irq_stacks().