Kesava Srinivas | 2 Apr 2012 10:42
Picon

Looking for small Confirmation about skb_pull & NF_ACCEPT !!!

HI Friends,
Looking for a Confirmation on my analysis.

Once after Capturing the Socket Buffer in PRE_ROUTING Hook; Manipulated the Socket Buffer by using the "skb_pull" Kernel Function. Using skb_pull; stripped 28 bytes (IP+UDP) which are the Part of outer UDP/IP Header. Now; My intention was to route the skb based on the Inner IP Header which is sitting after stripping 28 bytes. At the END; returned NF_ACCEPT.

Even though; skb_pull worked Fine., Kernel's Stack is still looking in to Outer Header only for Routing the Packet.I expected ;Kernel will look the Inner Header (As data Pointer was incremented by 28 bytes via skb_pull) and Take decision based on the Inner one. But; that didn't  happened. It looks to me like; we need to always use NF_STOLEN & should write our own code to route based on the INNER HEADER. Was my conclusion correct ??

-Thanks in Advance,
VKS


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Pritam Bankar | 2 Apr 2012 10:57
Picon

Re: What is use of apply_alternative function from alternative.c

Thanks Andrew , Jim

On Tue, Mar 20, 2012 at 8:40 PM, Andrew Case <atcuno <at> gmail.com> wrote:
The feature is called SMP alternatives. See if this articles helps
you: http://lwn.net/Articles/164121/

On Tue, Mar 20, 2012 at 8:54 AM, Pritam Bankar
<pritambankar1988 <at> gmail.com> wrote:
> Hi,
> Cal anyone help me in understanding alternative.c file from Linux source
> code.
> I want to learn function apply_alternative. AFAIK this code applies better
> replacement to instruction set used by processor.
> But I am not sure what exactly it is doing ?
>
> --
>
> Pritam Bankar
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies <at> kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



--

Pritam Bankar
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Pritam Bankar | 2 Apr 2012 11:01
Picon

Re: What is use of apply_alternative function from alternative.c

Jim ,

Is it a boot time process ? Can I switch to smp mode in running kernel?

On Mon, Apr 2, 2012 at 2:27 PM, Pritam Bankar <pritambankar1988 <at> gmail.com> wrote:
Thanks Andrew , Jim


On Tue, Mar 20, 2012 at 8:40 PM, Andrew Case <atcuno <at> gmail.com> wrote:
The feature is called SMP alternatives. See if this articles helps
you: http://lwn.net/Articles/164121/

On Tue, Mar 20, 2012 at 8:54 AM, Pritam Bankar
<pritambankar1988 <at> gmail.com> wrote:
> Hi,
> Cal anyone help me in understanding alternative.c file from Linux source
> code.
> I want to learn function apply_alternative. AFAIK this code applies better
> replacement to instruction set used by processor.
> But I am not sure what exactly it is doing ?
>
> --
>
> Pritam Bankar
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies <at> kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



--

Pritam Bankar



--

Pritam Bankar
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Pritam Bankar | 2 Apr 2012 14:29
Picon

Re: i_block field

May I know what is  e4_inode ?


Thanks,
Pritam

On Mon, Mar 12, 2012 at 6:51 PM, Ganesh Patil <patil.ganesh170 <at> gmail.com> wrote:
Hello,

      I have printed the i_blocks[EXT4_N_BLOCKS] filed from ext4_inode structure. of my file (a.txt);

code:
 ret= ext4_get_inode_loc(d_inode1, &iloc);
 e4_inode= ext4_raw_inode(&iloc);
 for(i=0;i<5;i++)
       {
            printk(KERN_INFO "%d",e4_inode->i_block[i]);
      }

  I got the following result.:

 127754
 4
 0
 0
 1
 8705

 what is the 127754 (Address of extent or data block)?
 what is 8705 &1 ?


--
Regards,
Ganesh Patil.


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




--

Pritam Bankar
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Pritam Bankar | 2 Apr 2012 14:53
Picon

Re: Unable to locate package kernel-headers-XXX



On Fri, Mar 9, 2012 at 9:29 PM, Autif Khan <autif.mlist <at> gmail.com> wrote:
On Fri, Mar 9, 2012 at 10:51 AM, Sraddha <dhakatevaishali <at> gmail.com> wrote:
> I have faced this problem before. I want to compile a Device driver module ,
> simple thing as hello world for my kernel. I want to use the headers instead
> of downloading t entire source.
>
> I do this sudo apt-get install kernel-headers-$(uname -r)
>
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> E: Unable to locate package kernel-headers-2.6.38-13-generic
> E: Couldn't find any package by regex 'kernel-headers-2.6.38-13-generic'
>
> How in the world shall I ever get these headers. Regards

Assuming that you are on ubuntu

#apt-get install linux-headers-$(uname -r)

You can also use

#apt-cache search linux | grep headers to see what all is available.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Easiest way, go and download them


  
--

Pritam Bankar
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Ganesh Patil | 2 Apr 2012 18:20
Picon

Re: i_block field



On Mon, Apr 2, 2012 at 5:59 PM, Pritam Bankar <pritambankar1988 <at> gmail.com> wrote:
May I know what is  e4_inode ?

Thanks,
Pritam

On Mon, Mar 12, 2012 at 6:51 PM, Ganesh Patil <patil.ganesh170 <at> gmail.com> wrote:
Hello,

      I have printed the i_blocks[EXT4_N_BLOCKS] filed from ext4_inode structure. of my file (a.txt);

code:
 ret= ext4_get_inode_loc(d_inode1, &iloc);
 e4_inode= ext4_raw_inode(&iloc);
 for(i=0;i<5;i++)
       {
            printk(KERN_INFO "%d",e4_inode->i_block[i]);
      }

  I got the following result.:

 127754
 4
 0
 0
 1
 8705

 what is the 127754 (Address of extent or data block)?
 what is 8705 &1 ?


--
Regards,
Ganesh Patil.


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




--

Pritam Bankar


Above e4_inode field is the pointer of type struct ext4_inode i.e on disk structure of ext4 inode. i.e

 Struct ext4_inode *e4_inode=ext4_raw_inode(&iloc);

      Sir, but for above question I got answer. because i copied first 12 byte of i_block[..] to ext4_header structure and next 12 bytes in to ext4_extent.so from that I got actual physical block numbers.

 struct ext4_extent_header *eeh = (struct ext4_extent_header*)EXT4_I(d_inode1)->i_data;
struct ext4_extent *eex=eex = EXT_FIRST_EXTENT(eeh);
--
Regards,
Ganesh Patil.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Mulyadi Santosa | 3 Apr 2012 18:00
Picon

Re: How to debug a kernel thread?

Hi :)

On Tue, Apr 3, 2012 at 17:37, Parmenides <mobile.parmenides <at> gmail.com> wrote:
> source tree. I compiled the kernel with kgdb and run it in qemu with
> virtual serial port:
>
>     qemu -kernel bzImage -initrd image.cpio.gz -append
> "kgdboc=ttyS0,115200 kgdbwait" -serial tcp::1234,server
>
> In another console, the gdb was given command:
>
>     (gdb) target remote local:1234
>     (gdb) continue
>
> Then I pressed Ctrl+C to suspend the target, but got no reply. The gdb
> got stuck and lost control to the target. As such, there is no

IIRC, years ago I did the same thing like yours, using kgdb and qemu.
What I forgot is how I hook into the remote kgdb stub.

Here's my suggestion: try other option outside tcp, perhaps UNIX
socket...or anything that's supported by gdb. And see if it makes any
difference.

--

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
Miles Fidelman | 4 Apr 2012 05:22

reboot.c and X86-64 architectures


Hello Folks,

Perhaps someone here can help me understand the behavior of the kernel reboot code.

I've recently migrated from running a 32bit kernel to a 64bit one
(specifically Debian Lenny 32bit environment to 2.6.32-5-xen-amd64 on
top of xen-4.0-amd64 hypervisor build).

This is a somewhat older, and apparently quirky, hardware box.  I've
found that the only way to reboot it, short of power cycling, is jumping
through the bios - using the "reboot=bios" kernel option at boot time
works just fine for an X86_32 kernel.  But... this doesn't work with the
64bit kernel.

Pouring through both the documentation and the code for
arch/x86/kernel/reboot.c yields the very specific admonition (in comments
describing command-line kernel options), that reboot=bios (Reboot by jumping
through the BIOS) only applies to X86_32 - and the case statements in the
code seem to align with the comment.

None of the other available command line options seem to work with my
hardware, which leads to two questions:

1. What's the logic behind this?  Why not enable a bios reboot for 64bit
kernels?  Anybody know the history?

2. Anybody know a workaround, short of patching and compiling a custom
kernel? Are there other paths through the reboot code that can invoke a bios
reboot?  (Note: None of the available command line options seem to work on
this particular box/bios combination, and kexec-reboot is not available
for this combination of kernel and hypervisor).

Thank you very much,

Miles Fidelman

--

-- 
In theory, there is no difference between theory and practice.
In practice, there is.   .... Yogi Berra
V.Ravikumar | 4 Apr 2012 06:32
Picon

wrapfs sources

Hi all,

Could some body let me know wrapfs sources which is compatible to Linux 2.6.18 kernel sources.

I tried to get sources using google search , but all are compatible with latest kernel sources.

Thanks & Regards,
Ravi
 

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Rajasekhar Pulluru | 4 Apr 2012 07:10
Picon

Re: PER-CPU data

Hi Srivatsa,

Thanks for the response. I have used per-CPU vars and I know about how
to creating/using per-CPU vars: DECLARE_PER_CPU(type, name) for
creating per-cpu at compile time and use alloc_percpu(type) for
creating them dynamically.

I intended to ask how they are stored internally (.percpu section) and
its protection mechanism if it has any.

Thanks & Regards,
Rajasekhar

On Fri, Mar 30, 2012 at 12:24 PM, Srivatsa S. Bhat
<srivatsa.bhat <at> linux.vnet.ibm.com> wrote:
> On 03/30/2012 12:05 PM, Dave Hylands wrote:
>
>> Hi Rajasekhar,
>>
>> On Thu, Mar 29, 2012 at 11:00 PM, Rajasekhar Pulluru
>> <pullururajasekhar <at> gmail.com> wrote:
>>> Hi,
>>>
>>> I would like to know how per-cpu data are stored internally?
>>> And how are they protected from other cores?
>>
>
>
> To put it in very simplistic terms, per-cpu data is nothing but having
> NR_CPUS copies of the data, like an array, something like:
>
> int data[NR_CPUS];
>
> And accessing this per-cpu data will essentially boil down to finding
> out the id of the processor you are running on, and indexing this array
> using that, something like:
>
> int val, cpu;
>
> cpu = smp_processor_id();
> val = data[cpu];
>
> So you automatically read/write the copy that belongs to your processor.
> That's it. However, this is an over-simplified view of per-cpu data,
> but you get the general idea...
>
>> I believe that they're just kmalloc'd like other kernel data. At the
>> kernel level there is no protection, just like all the rest of the
>> memory accessible to the kernel.
>> http://lxr.linux.no/#linux+v3.3/include/asm-generic/percpu.h#L8
>> http://lxr.linux.no/#linux+v3.3/mm/percpu.c
>>
>> When you declare a per-cpu variable, it goes into a special section,
>> and what you're really doing is figuring out the offset within a
>> per_cpu region of memory.
>>
>
>
> Regards,
> Srivatsa S. Bhat
>

Gmane