Skip to contentSkip to conversation

export of sys_call_table

PATCH Petr Vandrovec 3 participants 3 messages Oct 9, 2002 – Oct 10, 2002

lore
Share & tools
lore
#0 lore raw

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 2 lines · Brian F. G. Bidulock
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +0 -0

...

I believe that you should check that nobody else has registered its own streams module. You can also allow for multiple streams modules in parallel (and fall through when module returns on -ENOIOCTLCMD or -ENOTTY), but I believe that usually only one module will be registered.

And I believe that export symbols should NOT be _GPL_ONLY: before (non-GPL) export of syscall_table was available, non-GPL modules were able to hook syscalls, and when _GPL_ONLY was introduced into kernel it was promised that we'll never make currently provided functionality GPL-only (as far as I remember).
Best regards,
Petr Vandrovec

int register_streams_calls(...)

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 3 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +3 -0
+void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+               int (*getpmsg) (int, void *, void *, int, int))
+{

int err;
if (!putpmsg || !getpmsg) return -EINVAL;

Quoted 1 line

+ down_write(&streams_call_sem);

err = -EBUSY;
if (!do_putpmsg) {
err = 0;

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 2 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +2 -0
+   do_putpmsg = putpmsg;
+   do_getpmsg = getpmsg;

}

Quoted 1 line

+ up_write(&streams_call_sem);

return err;

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 4 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +4 -0
+}
+
+void unregister_streams_calls(void)
+{

down_write(&streams_call_sem);
do_putpmsg = NULL;
do_getpmsg = NULL;
up_write(&streams_call_sem);
}

#1 lore raw

Petr,

Thanks you for the constructive suggestions. I'll see if we can add those in an test it up.

--brian

Quoted 52 lines · Petr Vandrovec

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 2 lines · Brian F. G. Bidulock
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +0 -0

...

I believe that you should check that nobody else has registered its own streams module. You can also allow for multiple streams modules in parallel (and fall through when module returns on -ENOIOCTLCMD or -ENOTTY), but I believe that usually only one module will be registered.

And I believe that export symbols should NOT be _GPL_ONLY: before (non-GPL) export of syscall_table was available, non-GPL modules were able to hook syscalls, and when _GPL_ONLY was introduced into kernel it was promised that we'll never make currently provided functionality GPL-only (as far as I remember).
Best regards,
Petr Vandrovec

int register_streams_calls(...)

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 3 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +3 -0
+void register_streams_calls(int (*putpmsg) (int, void *, void *, int, int),
+               int (*getpmsg) (int, void *, void *, int, int))
+{

int err;
if (!putpmsg || !getpmsg) return -EINVAL;

Quoted 1 line

+ down_write(&streams_call_sem);

err = -EBUSY;
if (!do_putpmsg) {
err = 0;

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 2 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +2 -0
+   do_putpmsg = putpmsg;
+   do_getpmsg = getpmsg;

}

Quoted 1 line

+ up_write(&streams_call_sem);

return err;

sys.c 2002-10-08 16:46:55.000000000 -0500

Quoted 4 lines
sys.c 2002-10-08 16:46:55.000000000 -0500 renamed from sys.c.orig 2002-08-02 19:39:46.000000000 -0500 +4 -0
+}
+
+void unregister_streams_calls(void)
+{
   down_write(&streams_call_sem);
   do_putpmsg = NULL;
   do_getpmsg = NULL;
   up_write(&streams_call_sem);
}
Signature · 5 lines
Brian F. G. Bidulock    ¦ The reasonable man adapts himself to the ¦
[email protected]    ¦ world; the unreasonable one persists in  ¦
http://www.openss7.org/ ¦ trying  to adapt the  world  to himself. ¦
                        ¦ Therefore  all  progress  depends on the ¦
                        ¦ unreasonable man. -- George Bernard Shaw ¦
#2 lore raw

Brian, Petr, et al:

Does this patch address your suggestions? This has been tested on 2.4.19.

Thanks,
Dave

Quoted 6 lines · Brian F. G. Bidulock

Petr,

Thanks you for the constructive suggestions. I'll see if we can add those in an test it up.

--brian

i386/kernel/entry.S renamed from i386/kernel/entry.S.orig +2 -2
@@ -584,8 +584,8 @@
 	.long SYMBOL_NAME(sys_capset)           /* 185 */
 	.long SYMBOL_NAME(sys_sigaltstack)
 	.long SYMBOL_NAME(sys_sendfile)
-	.long SYMBOL_NAME(sys_ni_syscall)		/* streams1 */
-	.long SYMBOL_NAME(sys_ni_syscall)		/* streams2 */
+	.long SYMBOL_NAME(sys_getpmsg)		/* streams1 */
+	.long SYMBOL_NAME(sys_putpmsg)		/* streams2 */
 	.long SYMBOL_NAME(sys_vfork)            /* 190 */
 	.long SYMBOL_NAME(sys_getrlimit)
 	.long SYMBOL_NAME(sys_mmap2)
ksyms.c renamed from ksyms.c.orig +5 -0
@@ -497,6 +497,11 @@
 EXPORT_SYMBOL(seq_release);
 EXPORT_SYMBOL(seq_read);
 EXPORT_SYMBOL(seq_lseek);
+extern int register_streams_calls(int (*putpmsg) (int,void *,void *,int,int),
+				   int (*getpmsg) (int,void *,void *,int,int));
+extern void unregister_streams_calls(void);
+EXPORT_SYMBOL(register_streams_calls);
+EXPORT_SYMBOL(unregister_streams_calls);
 
 /* Program loader interfaces */
 EXPORT_SYMBOL(setup_arg_pages);
sys.c renamed from sys.c.orig +44 -0

50 lines not on this page · raw message