Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You mean it contains copies of existing Linux functions which the Grsecurity authors have edited? That makes sense. A lot of the comments here seem to be about how tightly it interfaces with Linux, which is surely a different thing.


This is a little snippet of grsecurity:

   static void account_kernel_stack(struct task_struct *tsk, int account)
   {
  -       void *stack = task_stack_page(tsk);
          struct vm_struct *vm = task_stack_vm_area(tsk);
   
          BUILD_BUG_ON(IS_ENABLED(CONFIG_VMAP_STACK) && PAGE_SIZE % 1024 != 0);
  @@ -303,8 +357,12 @@ static void account_kernel_stack(struct task_struct *tsk, int account)
                   * All stack pages are in the same zone and belong to the
                   * same memcg.
                   */
  +#ifdef CONFIG_GRKERNSEC_KSTACKOVERFLOW
  +               struct page *first_page = virt_to_page(tsk->lowmem_stack);
  +#else
  +               void *stack = task_stack_page(tsk);
                  struct page *first_page = virt_to_page(stack);
  -
  +#endif
                  mod_zone_page_state(page_zone(first_page), NR_KERNEL_STACK_KB,
                                      THREAD_SIZE / 1024 * account);
Grsecurity isn't Linux plus some additional code. It's a modified version of Linux. Saying that a Linux 4.11 kernel patched with grsecurity isn't a derived work of Linux 4.11 is like saying that a Linux 4.11 kernel patched with patch-4.12.patch [1], otherwise known as Linux 4.12, is not a derived work of 4.11

[1] https://cdn.kernel.org/pub/linux/kernel/v4.x/patch-4.12.xz




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: