Re: Why do processes with higher priority to be allocated more timeslice?

2011-09-26 Thread Mulyadi Santosa
Hi :)

On Tue, Sep 27, 2011 at 09:07, Parmenides  wrote:
> Actually, a common characteristics of Linux's schedulers is that
> timeslices will be longer with priorities raising .

generally I agree with that :)

> I am just curious
> about why the the schedulers takes this policy.

simply to say that, the more important a job is, it should be given
longer time to run... but, the process has privilege to yield before
time slice is up...and when it comes back,it will use the remaining
time slice.and its dynamic priority will stay the same (that's the
property that I recall)

>IMHO, this policy
> somewhat conflicts with intuition. I think there must be some
> motivations to take this policy, but I have no idea about it.

well, you can think, what happen if you take the other direction for
the policy? higher priority, but less time slice? that, IMHO, is less
intuitive.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Why do processes with higher priority to be allocated more timeslice?

2011-09-26 Thread Parmenides
Hi Jeff,

2011/9/27 Jeff Donner :

> Well, if it doesn't need more time then it doesn't matter what its priority 
> is,
> when it goes to sleep waiting for some IO it yields back the
> remainder of its time. You could give it as long a timeslice
> as you like; it won't use more than it needs, because it mostly waits on IO.
>

> A lot of the time the IO process won't be runnable, as it's waiting on IO.
> When the kernel is looking to dole out CPU time at those times, well the
> CPU-bound process is the only one that can take it. So the kernel
> gives it to it, lower priority or not.
>

> CFS doesn't distort anything.

For this example, it is really ok. But, dynamic priority doesn't has
nothing to do with timeslice. I have no intention to give any remarks
conerning whichever scheduler (Forgive me if I seem do that.) :-).
Actually, a common characteristics of Linux's schedulers is that
timeslices will be longer with priorities raising . I am just curious
about why the the schedulers takes this policy. IMHO, this policy
somewhat conflicts with intuition. I think there must be some
motivations to take this policy, but I have no idea about it.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Issue about setting interface flag on network device.

2011-09-26 Thread Mulyadi Santosa
On Mon, Sep 26, 2011 at 15:17, 陳國成  wrote:
> Hi,
>
> I encounter a strange problem when using 2.6.30 kernel.
>
> There are two processes, one runs main1() and the other runs main2().
> Two processes are running simultaneously on uni-processor system.
> Besides, eth0 is a proprietory ethernet driver.
>
> IFF_ALLMULTI can be set on eth0 successfully most of the time.
> The result looks like:
>
> main2: save_flags = 0x1043, flags = 0x1243
>
> seldom, setting IFF_ALLMULTI on eth0 will not take effect and the
> result looks like:
>
> main2: save_flags = 0x1002, flags = 0x1043
> main2: ret = 0
>
> Please give me some suggestion about how to debug this issue.

CMIIW, but looks like you design your code so that main1() runs first
then followed by main2(), right?

if that is right, then maybe what you experienced there is race condition


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Why do processes with higher priority to be allocated more timeslice?

2011-09-26 Thread Jeff Donner
On Mon, Sep 26, 2011 at 10:10 AM, Parmenides
 wrote:
> 2011/9/26 Mulyadi Santosa :
>>>Actually, the CFS scheduler which
>>> is a new scheduler in Linux kernel also does the same thing. But, I
>>> think this way does not fit with scheduler's principle.
>>
>> remember the keyword you ask? "fairness"? that is being  fair to all
>> processes but since, there are always more processes than
>> processors, unfairness always happen.
>>
>
> In fact, I am interested in the length of timeslice rather than
> fairness at this point. :-)
>
>>>This way ensures
>>> lower latency. It is also necessary that CPU-bound processes are to be
>>> allocated longer timeslice to improve throughput owing to less process
>>> switch costs. That means lower priority processes (CPU-bound) should
>>> be allocated longer timeslice, whichs obviously conflicts with the
>>> actual practice taken by the Linux's scheduler. Any explanation?
>>
>> What you refer initially is the time when time slice assignment is
>> strictly derived from the static/nice level. So e.g process with nice
>> level 0 has lesser time slice that nice level -5.
>>
>> But as you can see, situation change dynamically during run time, thus
>> static prio must be taken into dynamic priority. And dynamic priority
>> itself, must take another factor for time slice calculation. Here,
>> sleep time comes into play.
>>
>
> Ok, suppose that there is a CPU-bound process and a I/O-bound process,
> both of them are allocated the same nice level 0. After some time, the
> I/O-bound process will receive higher dynamic priority owing to its
> frequent sleeping. Now that the I/O-bound process more like to sleep,
> why does the scheduler give it longer timeslice? After all, it really
> does not need more time.

Well, if it doesn't need more time then it doesn't matter what its priority is,
when it goes to sleep waiting for some IO it yields back the
remainder of its time. You could give it as long a timeslice
as you like; it won't use more than it needs, because it mostly waits on IO.

> On ther other hand, the CPU-bound process will receive lower dynamic
> priority as its punishment because it costs more CPU time. Lower
> dynamic priority indicates this process is more 'CPU-bound', that is
> this process need more CPU time. If the scheduler allocates longer
> timeslice for this process, the frequency of process switch will be
> reduced. I think that will help to improve throughput of the entire
> system.

A lot of the time the IO process won't be runnable, as it's waiting on IO.
When the kernel is looking to dole out CPU time at those times, well the
CPU-bound process is the only one that can take it. So the kernel
gives it to it, lower priority or not.

CFS doesn't distort anything.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Fw: Automatic module insert in boot time

2011-09-26 Thread Yacob Hassidim
Hello Matt,

Thank you for your answer.

The driver is a simple one (hello) and does not require any hardware.

Sincerely,

Yacob Hassidim.


- Original Message - 
From: "Matt Schulte" 
To: "Yacob Hassidim" 
Sent: Monday, September 26, 2011 6:59 PM
Subject: Re: Fw: Automatic module insert in boot time


>I believe the reason it is not installing as you would like with the
> automatic /etc/modules method is that it requires hardware to be
> detected before it loads the driver.  It will not automatically load
> drivers unless it detects hardware that needs them.
>
> Matt Schulte
>
> On Mon, Sep 26, 2011 at 6:59 AM, Yacob Hassidim  
> wrote:
>>> Hello Mulyadi,
>>>
>>> Thank you for your response.
>>>
>>> I read the best way to automatically insert a module is via the
>>> /etc/modules (see
>>> http://www.cyberciti.biz/faq/linux-how-to-load-a-kernel-module-automatically-at-boot-time/).
>>>
>>> Don't forget I use Ubuntu 11.04.
>>>
>>> I tried the rc.local: It works perfectly.
>>>
>>> I searched for initramfs file but didn't find at all under Ubuntu.
>>>
>>> Sincerely,
>>>
>>> Yacob Hassidim.
>>>
>>>
>>>
>>> - Original Message -
>>> From: "Mulyadi Santosa" 
>>> To: "Yacob Hassidim" 
>>> Cc: 
>>> Sent: Monday, September 26, 2011 11:04 AM
>>> Subject: Re: Automatic module insert in boot time
>>>
>>>
 Hi Yacob...

 2011/9/26 Yacob Hassidim :
> 
> Hello everyone,
>
> I ask for help to insert/install module automatically in boot time.
>
> I use Ubuntu 11.04.
>
> I try to insert a module automatically in boot time.
>
> I added the name of my module (hello) to the file /etc/modules.

 I don't think that is the place.

 Boot time? perhaps better to put your modprobe/insmod calling your
 module in something like rc.local, or manually modify your
 initrd/initramfs so that it load your module earlier.


 --
 regards,

 Mulyadi Santosa
 Freelance Linux trainer and consultant 


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Why do processes with higher priority to be allocated more timeslice?

2011-09-26 Thread Parmenides
2011/9/26 Mulyadi Santosa :
> Hi :)
>
>>Actually, the CFS scheduler which
>> is a new scheduler in Linux kernel also does the same thing. But, I
>> think this way does not fit with scheduler's principle.
>
> remember the keyword you ask? "fairness"? that is being  fair to all
> processes but since, there are always more processes than
> processors, unfairness always happen.
>

In fact, I am interested in the length of timeslice rather than
fairness at this point. :-)

>>This way ensures
>> lower latency. It is also necessary that CPU-bound processes are to be
>> allocated longer timeslice to improve throughput owing to less process
>> switch costs. That means lower priority processes (CPU-bound) should
>> be allocated longer timeslice, whichs obviously conflicts with the
>> actual practice taken by the Linux's scheduler. Any explanation?
>
> What you refer initially is the time when time slice assignment is
> strictly derived from the static/nice level. So e.g process with nice
> level 0 has lesser time slice that nice level -5.
>
> But as you can see, situation change dynamically during run time, thus
> static prio must be taken into dynamic priority. And dynamic priority
> itself, must take another factor for time slice calculation. Here,
> sleep time comes into play.
>

Ok, suppose that there is a CPU-bound process and a I/O-bound process,
both of them are allocated the same nice level 0. After some time, the
I/O-bound process will receive higher dynamic priority owing to its
frequent sleeping. Now that the I/O-bound process more like to sleep,
why does the scheduler give it longer timeslice? After all, it really
does not need more time.

On ther other hand, the CPU-bound process will receive lower dynamic
priority as its punishment because it costs more CPU time. Lower
dynamic priority indicates this process is more 'CPU-bound', that is
this process need more CPU time. If the scheduler allocates longer
timeslice for this process, the frequency of process switch will be
reduced. I think that will help to improve throughput of the entire
system.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: CPU pinning

2011-09-26 Thread Peter Teoh
well, use the term "cpu affinity" when u google and u will find more
info (correct) from others - my answer is not complete - there are
situation where u can do tuning - read further here:

http://honglus.blogspot.com/2011/03/tune-interrupt-and-process-cpu-affinity.html
http://www.ibm.com/developerworks/linux/library/l-affinity/index.html

at the lowest level, the IRQ is handled at the the CPU inside
arch/x86/kernel/irq_32.c.

Inside this file, u can always identify your own SMP core by a
specific smp ID, and if it matches, then continue processing the IRQ,
otherwise, just ignore the processing, and let the other processor
does the work - not sure if I am right?

On Mon, Sep 26, 2011 at 7:28 PM, Kernel Piddu  wrote:
> Thanks so much for the detailed info. It's very comprehensive. Thanks for 
> taking the time.
>
> On Sep 26, 2011, at 6:51 AM, Peter Teoh  wrote:
>
>> On Fri, Sep 16, 2011 at 5:08 AM, Kernel Piddu  wrote:
>>>
 I have a multi processor system/machine and I would like dedicate a CPU 
 entirely to listen on to a port.
 I would greatly appreciate if you could tell me how this can be done.

 Thanks!
>>>
>>
>> doing this in the kernel, is perhaps not really recommended, and linux
>> kernel is become UNIX-non-compliant if such features were ever
>> provided.
>> but userspace, is definitely possible, but is always a suggestive
>> tuningthe kernel can always override your request:
>> http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
>> but this is per-process, if u want per-port IRQ handling attach to the
>> core, then this is going to affect the algorithm kernel used for
>> SoftIRQ handling:
>>
>> doing a "cat /proc/softirqs" on my system:
>>
>>                 CPU0       CPU1       CPU2       CPU3
>>       HI:          0          0          0          0
>>    TIMER:     563854     591025          0          0
>>   NET_TX:          7          6          0          0
>>   NET_RX:      17486      19250          0          0
>>    BLOCK:      2       3784          0          0
>> BLOCK_IOPOLL:          0          0          0          0
>>  TASKLET:     399230     391008          0          0
>>    SCHED:     116858     119604          0          0
>>  HRTIMER:        978        610          0          0
>>      RCU:     158513     192567          0          0
>>
>> i can see that the IRQ processing is skewed, but then unless i have an
>> overall picture of what every core is doing.not advisable to touch
>> that.
>>
>> anyway looking at the "processes":
>>
>> root         3     2  0 16:59 ?        00:00:00 [ksoftirqd/0]
>> root         7     2  0 16:59 ?        00:00:00 [ksoftirqd/1]
>>
>> only two tasklet thread are spawned to handle the these softirq at
>> each core.   i suspect some error in the interpreting the number of
>> cores here, as there is only two core. (/proc/cpuinfo).
>>
>> good reading on these internals:
>>
>> http://lwn.net/Articles/308117/
>> http://www.wil.cx/matthew/lca2003/paper.pdf
>>
>> --
>> Regards,
>> Peter Teoh
>



-- 
Regards,
Peter Teoh

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Including library in the Linux open source

2011-09-26 Thread Greg KH
On Mon, Sep 26, 2011 at 05:59:19PM +0530, Sahana B Adiga - ERS, HCL Tech wrote:
> 
> Hi All,
> 
> For a new storage hardware we have a Linux device driver that uses a
> custom library for hardware interface. This h/w interface library is
> an intellectual property. We want to share the Linux device driver
> source code, but not the library source code.

Why are you asking legal questions on a technical list?  Would your
company really follow any legal advice gotten here?  What does your
lawyers say about this?

> 1) Is it possible to add to the Linux open source, such a driver along
> with the hardware interface library as a blob? Will the Linux kernel
> community accepts/approves it?

What does your lawyer say about this?

> 3) Are there any additional documentation or any extra steps required
> than the normal way of submitting device drivers to Linux kernel
> community?

You have read the Documentation/SubmittingPatches and
Documentation/SubmittingDrivers files already right?  If not, I suggest
you take a look at them.

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Including library in the Linux open source

2011-09-26 Thread Sahana B Adiga - ERS, HCL Tech

Hi All,

For a new storage hardware we have a Linux device driver that uses a custom 
library for hardware interface. This h/w interface library is an intellectual 
property. We want to share the Linux device driver source code, but not the 
library source code.


1) Is it possible to add to the Linux open source, such a driver along with the 
hardware interface library as a blob? Will the Linux kernel community 
accepts/approves it?

2) If so, what is the procedure involved?

3) Are there any additional documentation or any extra steps required than the 
normal way of submitting device drivers to Linux kernel community?



Regards,
Sahana

::DISCLAIMER::
---

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and
attachments please check them for viruses and defect.

---

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Fw: Automatic module insert in boot time

2011-09-26 Thread Yacob Hassidim

- Original Message - 
From: "Yacob Hassidim" 
To: "Mulyadi Santosa" 
Sent: Monday, September 26, 2011 2:51 PM
Subject: Re: Automatic module insert in boot time


> Hello Mulyadi,
>
> Thank you for your response.
>
> I read the best way to automatically insert a module is via the 
> /etc/modules (see 
> http://www.cyberciti.biz/faq/linux-how-to-load-a-kernel-module-automatically-at-boot-time/).
>
> Don't forget I use Ubuntu 11.04.
>
> I tried the rc.local: It works perfectly.
>
> I searched for initramfs file but didn't find at all under Ubuntu.
>
> Sincerely,
>
> Yacob Hassidim.
>
>
>
> - Original Message - 
> From: "Mulyadi Santosa" 
> To: "Yacob Hassidim" 
> Cc: 
> Sent: Monday, September 26, 2011 11:04 AM
> Subject: Re: Automatic module insert in boot time
>
>
>> Hi Yacob...
>>
>> 2011/9/26 Yacob Hassidim :
>>> 
>>> Hello everyone,
>>>
>>> I ask for help to insert/install module automatically in boot time.
>>>
>>> I use Ubuntu 11.04.
>>>
>>> I try to insert a module automatically in boot time.
>>>
>>> I added the name of my module (hello) to the file /etc/modules.
>>
>> I don't think that is the place.
>>
>> Boot time? perhaps better to put your modprobe/insmod calling your
>> module in something like rc.local, or manually modify your
>> initrd/initramfs so that it load your module earlier.
>>
>>
>> -- 
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
> 


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: CPU pinning

2011-09-26 Thread Kernel Piddu
Thanks so much for the detailed info. It's very comprehensive. Thanks for 
taking the time.

On Sep 26, 2011, at 6:51 AM, Peter Teoh  wrote:

> On Fri, Sep 16, 2011 at 5:08 AM, Kernel Piddu  wrote:
>> 
>>> I have a multi processor system/machine and I would like dedicate a CPU 
>>> entirely to listen on to a port.
>>> I would greatly appreciate if you could tell me how this can be done.
>>> 
>>> Thanks!
>> 
> 
> doing this in the kernel, is perhaps not really recommended, and linux
> kernel is become UNIX-non-compliant if such features were ever
> provided.
> but userspace, is definitely possible, but is always a suggestive
> tuningthe kernel can always override your request:
> http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
> but this is per-process, if u want per-port IRQ handling attach to the
> core, then this is going to affect the algorithm kernel used for
> SoftIRQ handling:
> 
> doing a "cat /proc/softirqs" on my system:
> 
> CPU0   CPU1   CPU2   CPU3
>   HI:  0  0  0  0
>TIMER: 563854 591025  0  0
>   NET_TX:  7  6  0  0
>   NET_RX:  17486  19250  0  0
>BLOCK:  2   3784  0  0
> BLOCK_IOPOLL:  0  0  0  0
>  TASKLET: 399230 391008  0  0
>SCHED: 116858 119604  0  0
>  HRTIMER:978610  0  0
>  RCU: 158513 192567  0  0
> 
> i can see that the IRQ processing is skewed, but then unless i have an
> overall picture of what every core is doing.not advisable to touch
> that.
> 
> anyway looking at the "processes":
> 
> root 3 2  0 16:59 ?00:00:00 [ksoftirqd/0]
> root 7 2  0 16:59 ?00:00:00 [ksoftirqd/1]
> 
> only two tasklet thread are spawned to handle the these softirq at
> each core.   i suspect some error in the interpreting the number of
> cores here, as there is only two core. (/proc/cpuinfo).
> 
> good reading on these internals:
> 
> http://lwn.net/Articles/308117/
> http://www.wil.cx/matthew/lca2003/paper.pdf
> 
> --
> Regards,
> Peter Teoh

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: CPU pinning

2011-09-26 Thread Peter Teoh
On Fri, Sep 16, 2011 at 5:08 AM, Kernel Piddu  wrote:
>
> > I have a multi processor system/machine and I would like dedicate a CPU 
> > entirely to listen on to a port.
> > I would greatly appreciate if you could tell me how this can be done.
> >
> > Thanks!
>

doing this in the kernel, is perhaps not really recommended, and linux
kernel is become UNIX-non-compliant if such features were ever
provided.
but userspace, is definitely possible, but is always a suggestive
tuningthe kernel can always override your request:
http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html
but this is per-process, if u want per-port IRQ handling attach to the
core, then this is going to affect the algorithm kernel used for
SoftIRQ handling:

doing a "cat /proc/softirqs" on my system:

                CPU0       CPU1       CPU2       CPU3
      HI:          0          0          0          0
   TIMER:     563854     591025          0          0
  NET_TX:          7          6          0          0
  NET_RX:      17486      19250          0          0
   BLOCK:      2       3784          0          0
BLOCK_IOPOLL:          0          0          0          0
 TASKLET:     399230     391008          0          0
   SCHED:     116858     119604          0          0
 HRTIMER:        978        610          0          0
     RCU:     158513     192567          0          0

i can see that the IRQ processing is skewed, but then unless i have an
overall picture of what every core is doing.not advisable to touch
that.

anyway looking at the "processes":

root 3 2  0 16:59 ?00:00:00 [ksoftirqd/0]
root 7 2  0 16:59 ?00:00:00 [ksoftirqd/1]

only two tasklet thread are spawned to handle the these softirq at
each core.   i suspect some error in the interpreting the number of
cores here, as there is only two core. (/proc/cpuinfo).

good reading on these internals:

http://lwn.net/Articles/308117/
http://www.wil.cx/matthew/lca2003/paper.pdf

--
Regards,
Peter Teoh

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


generic-usb: probe of 0003:074D:3576.0002 failed with error -22

2011-09-26 Thread Stanislav Stratu
Hello,
I have some problems with a USB headset with PTT functionality on it,
the audio works well, but not the PTT.
I attached error messages from different kernels, also the device's description.
The insertion receive error: generic-usb: probe of 0003:074D:3576.0002
failed with error -22
and the PTT, which is made with HID InterfaceClass not create any
entry in /dev/input/ or /dev/hidraw *
Does anyone know how to fix this?
thanks in advance.

on the Ubuntu-10.10 kernel 2.6.35-22-generic
dmesg
   [   67.104034] usb 2-1: new full speed USB device using uhci_hcd
and address 3
   [   67.334528] generic-usb: probe of 0003:074D:3576.0003 failed
with error -22
   [   67.497473] usbcore: registered new interface driver snd-usb-audio

on the Ubuntu-10.10 custom realtime-kernel 3.0.3-rt12
dmesg
   usb 1-1: new full speed USB device number 4 using uhci_hcd
   usb 1-1: New USB device found, idVendor=074d, idProduct=3576
   usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
   usb 1-1: Product: PTT Imtradex Headset
   usb 1-1: Manufacturer: Imtradex
   usb_audio: Warning! Unlikely big volume range (=656), cval->res is
probably wrong.
   usb_audio: [6] FU [PCM Capture Volume] ch = 1, val = -10496/0/16
   generic-usb: probe of 0003:074D:3576.0004 failed with error -22

lsusb -vd 074d:3576
Bus 001 Device 004: ID 074d:3576 Micronas GmbH
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   1.10
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x074d Micronas GmbH
  idProduct  0x3576
  bcdDevice0.09
  iManufacturer   1 Imtradex
  iProduct2 PTT Imtradex Headset
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength  415
bNumInterfaces  4
bConfigurationValue 1
iConfiguration  3 A0 2009/05/18 15:23
bmAttributes 0xc0
  Self Powered
MaxPower  256mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   0
  bInterfaceClass 1 Audio
  bInterfaceSubClass  1 Control Device
  bInterfaceProtocol  0
  iInterface  0
  AudioControl Interface Descriptor:
bLength10
bDescriptorType36
bDescriptorSubtype  1 (HEADER)
bcdADC   1.00
wTotalLength  124
bInCollection   2
baInterfaceNr( 0)   1
baInterfaceNr( 1)   2
  AudioControl Interface Descriptor:
bLength12
bDescriptorType36
bDescriptorSubtype  2 (INPUT_TERMINAL)
bTerminalID10
wTerminalType  0x0201 Microphone
bAssocTerminal  0
bNrChannels 2
wChannelConfig 0x0003
  Left Front (L)
  Right Front (R)
iChannelNames   0
iTerminal   0
  AudioControl Interface Descriptor:
bLength12
bDescriptorType36
bDescriptorSubtype  2 (INPUT_TERMINAL)
bTerminalID11
wTerminalType  0x0603 Line Connector
bAssocTerminal  0
bNrChannels 2
wChannelConfig 0x0003
  Left Front (L)
  Right Front (R)
iChannelNames   0
iTerminal   0
  AudioControl Interface Descriptor:
bLength12
bDescriptorType36
bDescriptorSubtype  2 (INPUT_TERMINAL)
bTerminalID12
wTerminalType  0x0101 USB Streaming
bAssocTerminal  0
bNrChannels 2
wChannelConfig 0x0003
  Left Front (L)
  Right Front (R)
iChannelNames   0
iTerminal   0
  AudioControl Interface Descriptor:
bLength13
bDescriptorType36
bDescriptorSubtype  6 (FEATURE_UNIT)
bUnitID 2
bSourceID  10
bControlSize2
bmaControls( 0)  0x02
bmaControls( 0)  0x00
  Volume
bmaControls( 1)  0x00
bmaControls( 1)  0x00
bmaControls( 2)  0x00
bmaControls( 2)  0x00
iFeature0
  AudioControl Interface Descriptor:
bLength13
bDescriptorType36
bDescriptorSubtype  6 (FEATURE_UNIT)
bUnitID 3
bSourceID  11
bControlSize2
bmaControls( 0)  

Issue about setting interface flag on network device.

2011-09-26 Thread 陳國成
Hi,

I encounter a strange problem when using 2.6.30 kernel.

There are two processes, one runs main1() and the other runs main2().
Two processes are running simultaneously on uni-processor system.
Besides, eth0 is a proprietory ethernet driver.

IFF_ALLMULTI can be set on eth0 successfully most of the time.
The result looks like:

main2: save_flags = 0x1043, flags = 0x1243

seldom, setting IFF_ALLMULTI on eth0 will not take effect and the
result looks like:

main2: save_flags = 0x1002, flags = 0x1043
main2: ret = 0

Please give me some suggestion about how to debug this issue.

int ifUp(const char *ifName)
{
int sockfd = 0;
struct ifreq ifr;
int ret = 0;

if (ifName == NULL)
{
ret = -1;
}
else
{
if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
ret = -1;
}
else
{
strncpy(ifr.ifr_name, ifName, IFNAMSIZ);
ifr.ifr_flags = (IFF_UP | IFF_RUNNING | IFF_MULTICAST);
if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0)
{
ret = -1;
}
close(sockfd);
}
}

return ret;
}

short get_interface_flags(char *ifname)
{
struct ifreq ifr;
int sockfd, err;

sockfd = socket(PF_INET, SOCK_DGRAM, 0);

if (sockfd <= 0)
return -1;

strncpy(ifr.ifr_name, ifname, IFNAMSIZ);

err = ioctl(sockfd, SIOCGIFFLAGS, (void*)&ifr);

close(sockfd);

if (err != 0)
return -1;

return ifr.ifr_flags;
}


short set_interface_flags(char *ifname, short flags)
{
struct ifreq ifr;
int sockfd, err;

sockfd = socket(PF_INET, SOCK_DGRAM, 0);

if (sockfd <= 0)
return -1;

strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
ifr.ifr_flags = flags;

err = ioctl(sockfd, SIOCSIFFLAGS, (void*)&ifr);

close(sockfd);

if (err != 0)
return -1;

return 0;
}

int main1()
{
ifUp("eth0");
}

int main2()
{
short flags, save_flags;
short ret;

/* Set the interface flags to receive all multicast packets */
save_flags = get_interface_flags("eth0");
if (save_flags != -1)
{
ret = set_interface_flags("eth0", save_flags | IFF_ALLMULTI);

flags = get_interface_flags("eth0");
printf("%s: save_flags = 0x%x, flags = 0x%x\n", __FUNCTION__,
save_flags, flags);
if (((flags & IFF_ALLMULTI) != IFF_ALLMULTI))
{
printf("%s: ret = %d\n", __FUNCTION__, ret);
}
}
}


Thanks & Regards,
GC

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Automatic module insert in boot time

2011-09-26 Thread Mulyadi Santosa
Hi Yacob...

2011/9/26 Yacob Hassidim :
> 
> Hello everyone,
>
> I ask for help to insert/install module automatically in boot time.
>
> I use Ubuntu 11.04.
>
> I try to insert a module automatically in boot time.
>
> I added the name of my module (hello) to the file /etc/modules.

I don't think that is the place.

Boot time? perhaps better to put your modprobe/insmod calling your
module in something like rc.local, or manually modify your
initrd/initramfs so that it load your module earlier.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Automatic module insert in boot time

2011-09-26 Thread Yacob Hassidim



Hello everyone,

I ask for help to insert/install module automatically in boot time.

I use Ubuntu 11.04.

I try to insert a module automatically in boot time.

I added the name of my module (hello) to the file /etc/modules.

I copied the the file hello.ko to the following directories:

- /lib/modules/2.6.38-8-generic/kernel
- /lib/modules/2.6.38-8-generic/kernel/drivers
- /lib/modules/2.6.38-8-generic/kernel/drivers/hello

The hello module prints (printk) message to kern.log and responds to 
open/read/write/ioctl and close functions.

I don't see the init log messages in the kern.log file.

While I use "insmod hello.ko" command, the command succeeds and I see the log 
messages.

Can anyone help me why the automatically insertion of the module does not 
succeed?

Thank you.

Yacob.___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Why do processes with higher priority to be allocated more timeslice?

2011-09-26 Thread Mulyadi Santosa
Hi :)

On Mon, Sep 26, 2011 at 09:16, Parmenides  wrote:
> Hi,
>
>    It seems that Linux's scheduler tends to allocate longer timeslice
> for processes with higher priority.

"tends".yes, at least theoritically. but not really in every
cases in reality

>Actually, the CFS scheduler which
> is a new scheduler in Linux kernel also does the same thing. But, I
> think this way does not fit with scheduler's principle.

remember the keyword you ask? "fairness"? that is being  fair to all
processes but since, there are always more processes than
processors, unfairness always happen.

>    The goal chased by a scheduler is low latency and high thoughput.
> Normally, a I/O-bound process has higher priority, while a CPU-bound
> process has lower priority.

you are referring above as dynamic priority, I believe. As for static
priority, quite likely, all I/O and CPU bound processes start at
static prio level 0

> So, a I/O-bound process (which has enough
> timeslice) can preempt a CPU-bound process easily.

yes, because I/O bound one sleep quite a long time and its dynamic
priority gets a bonus. But if it sleeps not quite long, the bonus
won't be too significant to "defeat" current running one, so it has to
wait longer to be run by processor.

>This way ensures
> lower latency. It is also necessary that CPU-bound processes are to be
> allocated longer timeslice to improve throughput owing to less process
> switch costs. That means lower priority processes (CPU-bound) should
> be allocated longer timeslice, whichs obviously conflicts with the
> actual practice taken by the Linux's scheduler. Any explanation?

What you refer initially is the time when time slice assignment is
strictly derived from the static/nice level. So e.g process with nice
level 0 has lesser time slice that nice level -5.

But as you can see, situation change dynamically during run time, thus
static prio must be taken into dynamic priority. And dynamic priority
itself, must take another factor for time slice calculation. Here,
sleep time comes into play.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Hooking exec system call

2011-09-26 Thread rohan puri
On Mon, Sep 26, 2011 at 1:00 PM, Abhijit Pawar wrote:

>  On 09/26/2011 12:57 PM, rohan puri wrote:
>
>
>
> On Mon, Sep 26, 2011 at 12:29 PM, Abhijit Pawar wrote:
>
>>   On 09/26/2011 12:26 PM, rohan puri wrote:
>>
>>
>>
>> On Mon, Sep 26, 2011 at 12:02 PM, Abhijit Pawar 
>> wrote:
>>
>>>   On 09/23/2011 03:11 PM, rohan puri wrote:
>>>
>>>
>>>
>>> On Fri, Sep 23, 2011 at 2:43 PM, Abhijit Pawar 
>>> wrote:
>>>
   On 09/23/2011 02:04 PM, rohan puri wrote:



 On Fri, Sep 23, 2011 at 2:00 PM, Abhijit Pawar 
 wrote:

>  On 09/23/2011 01:01 PM, Rajat Sharma wrote:
>
>>  Untidy way : -
>>> Yes, you can do that by registering a new binary format handler.
>>> Whenever
>>> exec is called, a list of registered binary format handlers is
>>> scanned, in
>>> the same way you can hook the load_binary&  load_library function
>>> pointers
>>> of the already registered binary format handlers.
>>>
>> Challenge with this untidy way is to identify the correct format, for
>> example if you are interested in only hooking ELF format, there is no
>> special signature withing the registered format handler to identify
>> that, however if one format handler recognizes the file header, its
>> load_binary will return 0. This can give you the hint that you are
>> sitting on top of correct file format. Long time back I had written
>> the similar module in Linux to do the same, but can't share the code
>> :)
>>
>> -Rajat
>>
>> On Thu, Sep 22, 2011 at 3:14 PM, rohan puri
>>  wrote:
>>
>>>
>>> On Thu, Sep 22, 2011 at 1:53 PM, Abhijit Pawar<
>>> apawar.li...@gmail.com>
>>> wrote:
>>>
 hi list,
 Is there any way to hook the exec system call on Linux box apart
 from
 replacing the call in System Call table?

 Regards,
 Abhijit Pawar

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

>>> Tidy way : -
>>>
>>> You can do that from LSM (Linux security module).
>>>
>>> Untidy way : -
>>> Yes, you can do that by registering a new binary format handler.
>>> Whenever
>>> exec is called, a list of registered binary format handlers is
>>> scanned, in
>>> the same way you can hook the load_binary&  load_library function
>>> pointers
>>> of the already registered binary format handlers.
>>>
>>> Regards,
>>> Rohan Puri
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>>>   So If I use the binary format handler, then I can hook the exec
> call. however I need to register this. Does that mean that I need to 
> return
> the negative value so as to have actual ELF handler to be loaded?
>
> Regards,
>  Abhijit Pawar
>
>  Read this, http://www.linux.it/~rubini/docs/binfmt/binfmt.html this
 might help

 Regards,
 Rohan Puri

  Thanks Rohan. I tried creating a hooking module on the similar line. I
 am able to load the module but whenever I am launching any application , 
 its
 load_binary is not being called.
 here is the source for the module attached.

 Regards,
  Abhijit Pawar



>>> Hi Abhijit,
>>>
>>> I have made the change, try to compile and execute this code, it works.
>>>
>>> Also, I am just curious enough to know that where do you need to do this
>>> hooking.
>>>
>>> Regards,
>>> Rohan Puri
>>>
>>>  Hi Rohan,
>>> I have been looking at Windows worlds ability to support DLL Injection
>>> and API hooking. I was just wondering if this could be something to be done
>>> in Linux as well.  I am not sure if there is any special use of this module
>>> apart from learning the binary handler. May be it could be used as a
>>> security module for your own binary handler.
>>>
>>> Regards,
>>>  Abhijit Pawar
>>>
>>
>> Hi Abhijit,
>>
>> I am not familiar with windows. Special use-case of this hacking is for
>> security companies whitelisting software solutions, where they want to
>> control execution of only authorized binaries on the system and deny the
>> execution of others.
>>
>>
>> Although this approach is untidy, since there is available LSM hooks in
>> linux kernel which needs to be made use of for doing this.
>>
>> Regards,
>> Rohan Puri
>>
>>  Hi Rohan,
>> Yes, this is a backdoor approach and I agree with you. I am learning more
>> on LSM and their APIs so as to get insight into what goes on internally. May
>> be you can refer me to some details as well.
>>
>> Thanks for all of your help on this.
>>
>> Regards,
>>  Abhijit Pawar
>>
>
> Hi Abhijit,
>
> There is

Re: Hooking exec system call

2011-09-26 Thread Abhijit Pawar

On 09/26/2011 12:57 PM, rohan puri wrote:



On Mon, Sep 26, 2011 at 12:29 PM, Abhijit Pawar 
mailto:apawar.li...@gmail.com>> wrote:


On 09/26/2011 12:26 PM, rohan puri wrote:



On Mon, Sep 26, 2011 at 12:02 PM, Abhijit Pawar
mailto:apawar.li...@gmail.com>> wrote:

On 09/23/2011 03:11 PM, rohan puri wrote:



On Fri, Sep 23, 2011 at 2:43 PM, Abhijit Pawar
mailto:apawar.li...@gmail.com>> wrote:

On 09/23/2011 02:04 PM, rohan puri wrote:



On Fri, Sep 23, 2011 at 2:00 PM, Abhijit Pawar
mailto:apawar.li...@gmail.com>> wrote:

On 09/23/2011 01:01 PM, Rajat Sharma wrote:

Untidy way : -
Yes, you can do that by registering a new
binary format handler. Whenever
exec is called, a list of registered binary
format handlers is scanned, in
the same way you can hook the load_binary&
 load_library function pointers
of the already registered binary format
handlers.

Challenge with this untidy way is to identify
the correct format, for
example if you are interested in only hooking
ELF format, there is no
special signature withing the registered format
handler to identify
that, however if one format handler recognizes
the file header, its
load_binary will return 0. This can give you
the hint that you are
sitting on top of correct file format. Long
time back I had written
the similar module in Linux to do the same, but
can't share the code
:)

-Rajat

On Thu, Sep 22, 2011 at 3:14 PM, rohan
purimailto:rohan.pur...@gmail.com>>  wrote:


On Thu, Sep 22, 2011 at 1:53 PM, Abhijit
Pawarmailto:apawar.li...@gmail.com>>
wrote:

hi list,
Is there any way to hook the exec
system call on Linux box apart from
replacing the call in System Call table?

Regards,
Abhijit Pawar

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org


http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Tidy way : -

You can do that from LSM (Linux security
module).

Untidy way : -
Yes, you can do that by registering a new
binary format handler. Whenever
exec is called, a list of registered binary
format handlers is scanned, in
the same way you can hook the load_binary&
 load_library function pointers
of the already registered binary format
handlers.

Regards,
Rohan Puri

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org


http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


So If I use the binary format handler, then I can
hook the exec call. however I need to register
this. Does that mean that I need to return the
negative value so as to have actual ELF handler to
be loaded?

Regards,
Abhijit Pawar

Read this,
http://www.linux.it/~rubini/docs/binfmt/binfmt.html

this might help

Regards,
Rohan Puri

Thanks Rohan. I tried creating a hooking module on the
similar line. I am able to load the module but whenever
I am launching any application , its load_binary is not
being called.
here is the source for the module attached.

Regards,
Abhijit Pawar



Hi Abhijit,

I have made the change, try to compile and execute this
code, it works.


Re: Hooking exec system call

2011-09-26 Thread rohan puri
On Mon, Sep 26, 2011 at 12:29 PM, Abhijit Pawar wrote:

>  On 09/26/2011 12:26 PM, rohan puri wrote:
>
>
>
> On Mon, Sep 26, 2011 at 12:02 PM, Abhijit Pawar wrote:
>
>>   On 09/23/2011 03:11 PM, rohan puri wrote:
>>
>>
>>
>> On Fri, Sep 23, 2011 at 2:43 PM, Abhijit Pawar wrote:
>>
>>>   On 09/23/2011 02:04 PM, rohan puri wrote:
>>>
>>>
>>>
>>> On Fri, Sep 23, 2011 at 2:00 PM, Abhijit Pawar 
>>> wrote:
>>>
  On 09/23/2011 01:01 PM, Rajat Sharma wrote:

>  Untidy way : -
>> Yes, you can do that by registering a new binary format handler.
>> Whenever
>> exec is called, a list of registered binary format handlers is
>> scanned, in
>> the same way you can hook the load_binary&  load_library function
>> pointers
>> of the already registered binary format handlers.
>>
> Challenge with this untidy way is to identify the correct format, for
> example if you are interested in only hooking ELF format, there is no
> special signature withing the registered format handler to identify
> that, however if one format handler recognizes the file header, its
> load_binary will return 0. This can give you the hint that you are
> sitting on top of correct file format. Long time back I had written
> the similar module in Linux to do the same, but can't share the code
> :)
>
> -Rajat
>
> On Thu, Sep 22, 2011 at 3:14 PM, rohan puri
>  wrote:
>
>>
>> On Thu, Sep 22, 2011 at 1:53 PM, Abhijit Pawar> >
>> wrote:
>>
>>> hi list,
>>> Is there any way to hook the exec system call on Linux box apart from
>>> replacing the call in System Call table?
>>>
>>> Regards,
>>> Abhijit Pawar
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>> Tidy way : -
>>
>> You can do that from LSM (Linux security module).
>>
>> Untidy way : -
>> Yes, you can do that by registering a new binary format handler.
>> Whenever
>> exec is called, a list of registered binary format handlers is
>> scanned, in
>> the same way you can hook the load_binary&  load_library function
>> pointers
>> of the already registered binary format handlers.
>>
>> Regards,
>> Rohan Puri
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>>   So If I use the binary format handler, then I can hook the exec
 call. however I need to register this. Does that mean that I need to return
 the negative value so as to have actual ELF handler to be loaded?

 Regards,
  Abhijit Pawar

  Read this, http://www.linux.it/~rubini/docs/binfmt/binfmt.html this
>>> might help
>>>
>>> Regards,
>>> Rohan Puri
>>>
>>>  Thanks Rohan. I tried creating a hooking module on the similar line. I
>>> am able to load the module but whenever I am launching any application , its
>>> load_binary is not being called.
>>> here is the source for the module attached.
>>>
>>> Regards,
>>>  Abhijit Pawar
>>>
>>>
>>>
>> Hi Abhijit,
>>
>> I have made the change, try to compile and execute this code, it works.
>>
>> Also, I am just curious enough to know that where do you need to do this
>> hooking.
>>
>> Regards,
>> Rohan Puri
>>
>>  Hi Rohan,
>> I have been looking at Windows worlds ability to support DLL Injection and
>> API hooking. I was just wondering if this could be something to be done in
>> Linux as well.  I am not sure if there is any special use of this module
>> apart from learning the binary handler. May be it could be used as a
>> security module for your own binary handler.
>>
>> Regards,
>>  Abhijit Pawar
>>
>
> Hi Abhijit,
>
> I am not familiar with windows. Special use-case of this hacking is for
> security companies whitelisting software solutions, where they want to
> control execution of only authorized binaries on the system and deny the
> execution of others.
>
>
> Although this approach is untidy, since there is available LSM hooks in
> linux kernel which needs to be made use of for doing this.
>
> Regards,
> Rohan Puri
>
> Hi Rohan,
> Yes, this is a backdoor approach and I agree with you. I am learning more
> on LSM and their APIs so as to get insight into what goes on internally. May
> be you can refer me to some details as well.
>
> Thanks for all of your help on this.
>
> Regards,
> Abhijit Pawar
>

Hi Abhijit,

There is one whitepaper of lsm available on internet by Greg Kroah-Hartman
and others, its good to start with.


Also, I am keen to now, do all these things you are studying are part of any
project or just for knowledge.

Regards,
Rohan Puri
___
Kernelnewbies mailing list
Kernelnewbies@ke

Re: Hooking exec system call

2011-09-26 Thread Abhijit Pawar

On 09/26/2011 12:26 PM, rohan puri wrote:



On Mon, Sep 26, 2011 at 12:02 PM, Abhijit Pawar 
mailto:apawar.li...@gmail.com>> wrote:


On 09/23/2011 03:11 PM, rohan puri wrote:



On Fri, Sep 23, 2011 at 2:43 PM, Abhijit Pawar
mailto:apawar.li...@gmail.com>> wrote:

On 09/23/2011 02:04 PM, rohan puri wrote:



On Fri, Sep 23, 2011 at 2:00 PM, Abhijit Pawar
mailto:apawar.li...@gmail.com>> wrote:

On 09/23/2011 01:01 PM, Rajat Sharma wrote:

Untidy way : -
Yes, you can do that by registering a new binary
format handler. Whenever
exec is called, a list of registered binary
format handlers is scanned, in
the same way you can hook the load_binary&
 load_library function pointers
of the already registered binary format handlers.

Challenge with this untidy way is to identify the
correct format, for
example if you are interested in only hooking ELF
format, there is no
special signature withing the registered format
handler to identify
that, however if one format handler recognizes the
file header, its
load_binary will return 0. This can give you the
hint that you are
sitting on top of correct file format. Long time
back I had written
the similar module in Linux to do the same, but
can't share the code
:)

-Rajat

On Thu, Sep 22, 2011 at 3:14 PM, rohan
purimailto:rohan.pur...@gmail.com>>  wrote:


On Thu, Sep 22, 2011 at 1:53 PM, Abhijit
Pawarmailto:apawar.li...@gmail.com>>
wrote:

hi list,
Is there any way to hook the exec system
call on Linux box apart from
replacing the call in System Call table?

Regards,
Abhijit Pawar

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org


http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Tidy way : -

You can do that from LSM (Linux security module).

Untidy way : -
Yes, you can do that by registering a new binary
format handler. Whenever
exec is called, a list of registered binary
format handlers is scanned, in
the same way you can hook the load_binary&
 load_library function pointers
of the already registered binary format handlers.

Regards,
Rohan Puri

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org


http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


So If I use the binary format handler, then I can hook
the exec call. however I need to register this. Does
that mean that I need to return the negative value so as
to have actual ELF handler to be loaded?

Regards,
Abhijit Pawar

Read this,
http://www.linux.it/~rubini/docs/binfmt/binfmt.html
 this
might help

Regards,
Rohan Puri

Thanks Rohan. I tried creating a hooking module on the
similar line. I am able to load the module but whenever I am
launching any application , its load_binary is not being called.
here is the source for the module attached.

Regards,
Abhijit Pawar



Hi Abhijit,

I have made the change, try to compile and execute this code, it
works.

Also, I am just curious enough to know that where do you need to
do this hooking.

Regards,
Rohan Puri

Hi Rohan,
I have been looking at Windows worlds ability to support DLL
Injection and API hooking. I was just wondering if this could be
something to be done in Linux as well.  I am not sure if there is
any special use of this module apart from learning the binary
handler. May be it could be used as a security module for your own
binary handler.

Regards,
Abhijit Pawar


Hi Abhijit,

I am not familiar with windows. Special use-cas