anchao commented on code in PR #15461: URL: https://github.com/apache/nuttx/pull/15461#discussion_r1907990997
########## mm/kasan/mte_tags.c: ########## @@ -0,0 +1,95 @@ +/**************************************************************************** + * mm/kasan/mte_tags.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/mm/mm.h> +#include <nuttx/mm/kasan.h> + +#include <arch/mte.h> + +#include <assert.h> +#include <stdint.h> +#include <stdlib.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +static void *kasan_set_poison(FAR const void *addr, size_t size, uint8_t tag) +{ + FAR const void *tag_addr; + + /* Get random labels and the addresses after labeling */ + + tag_addr = arm64_mte_get_tagged_addr(addr, tag); + + /* Add MTE hardware label to memory block */ + + arm64_mte_set_tag(tag_addr, size); + + return (void *)tag_addr; Review Comment: FAR ########## mm/mm_heap/mm_initialize.c: ########## @@ -109,6 +109,8 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, #if CONFIG_MM_REGIONS > 1 int idx; + kasan_hw_close(); Review Comment: could be removed from initialize? ########## mm/mm_heap/mm_initialize.c: ########## @@ -209,6 +211,7 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, sched_note_heap(NOTE_HEAP_ADD, heap, heapstart, heapsize, heap->mm_curused); mm_unlock(heap); + kasan_hw_open(); Review Comment: why not move hw open/close into mm_lock/unlock? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org