Print this page
OS-3735 modstubs MAXNARG is too low.
        
@@ -48,11 +48,11 @@
  *      but worth it?!).
  *
  *      NOTE: Use NO_UNLOAD_STUBs if the module is NOT unloadable once it is
  *            loaded.
  */
-#define MAXNARG 10
+#define MAXNARG 12
 
 /*
  * WARNING: there is no check for forgetting to write END_MODULE,
  * and if you do, the kernel will most likely crash.  Be careful
  *
@@ -182,11 +182,11 @@
         pushq   %rsi
         pushq   %rdx
         pushq   %rcx
         pushq   %r8
         pushq   %r9
-        /* (next 4 args, if any, are already on the stack above %rbp) */
+        /* (next 6 args, if any, are already on the stack above %rbp) */
         movq    %r15, %rdi
         call    mod_hold_stub           /* mod_hold_stub(mod_stub_info *) */
         cmpl    $-1, %eax               /* error? */
         jne     .L1
         movq    0x18(%r15), %rax
@@ -193,11 +193,11 @@
         call    *%rax
         addq    $0x30, %rsp
         jmp     .L2
 .L1:
         /*
-         * copy MAXNARG == 10 incoming arguments
+         * copy MAXNARG == 12 incoming arguments
          */
         popq    %r9
         popq    %r8
         popq    %rcx
         popq    %rdx
@@ -217,12 +217,14 @@
         movl    $MAXNARG - 6 + 3, %r11d
         pushq   (%rsp, %r11, 8)
         pushq   (%rsp, %r11, 8)
         pushq   (%rsp, %r11, 8)
         pushq   (%rsp, %r11, 8)
+        pushq   (%rsp, %r11, 8)
+        pushq   (%rsp, %r11, 8)
         call    *(%r15)                 /* call the stub fn(arg, ..) */
-        addq    $0x20, %rsp             /* pop off last 4 args */
+        addq    $0x30, %rsp             /* pop off last 6 args */
         pushq   %rax                    /* save any return values */
         pushq   %rdx
         movq    %r15, %rdi
         call    mod_release_stub        /* release hold on module */
         popq    %rdx                    /* restore return values */
@@ -336,10 +338,12 @@
         movl    $MAXNARG+1, %ecx
         / copy incoming arguments
         pushl   (%esp, %ecx, 4)         / push MAXNARG times
         pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)
+        pushl   (%esp, %ecx, 4)
+        pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)
         pushl   (%esp, %ecx, 4)