Idiot's approach
to patching
Marian HackMan Marinov
CEO of 1H Ltd.
mm@1h.com
CTO of GetClouder.com
mm@getclouder.com
Idiot's approach
to patching
In this talk...
The IDIOT...
Unfortunately is ME :)
CEO of 1H Ltd.
mm@1h.com
CTO of GetCloude...
Idiot's approach
to patching
➢ Download the source and create a git repo
in it
➢ Use git grep as much as possible
➢ Commit...
Idiot's approach
to patching
➢ There are two options
➢ you either need to change existing
functionality
➢ or add a new one
Idiot's approach
to patching
➢ With existing functionality
➢ try to find the code that implement it
➢ you can do that by s...
Idiot's approach
to patching
➢ With new functionality
➢ Try to find the smallest other
functionality that is present in th...
Idiot's approach
to patching
➢ You SHOULD NOT try to learn
and understand the whole code base, before
you start to hack on...
Idiot's approach
to patching
Marian HackMan Marinov
CEO of 1H Ltd.
mm@1h.com
CTO of GetClouder.com
mm@getclouder.com
Idiot's approach
to patching
➢ Now ... lets see how this works with real
projects
➢ rsync
➢ the linux kernel
Idiot's approach
to patching
➢ Rsync patching
➢ slow-down
➢ mount-ns
Idiot's approach
to patching
➢ Linux Kernel patching
➢ How many of you know the difference
between spinlock and mutex?
Idiot's approach
to patching
EXAMPLES :)
Idiot's approach
to patching
??? QUESTIONS ???
Marian HackMan Marinov
CEO of 1H Ltd.
mm@1h.com
CTO of GetClouder.com
mm@ge...
Idiot's approach
to patching
??? QUESTIONS ???
Marian HackMan Marinov
HVALA
CEO of 1H Ltd.
mm@1h.com
CTO of GetClouder.com...
Upcoming SlideShare
Loading in …5
×

Idiot's approach to patching

606 views

Published on

2 Comments
1 Like
Statistics
Notes
  • Kernel
    1. locate fs/proc
    2. look trough the cpuinfo.c
    3. find cpuinfo_op
    4. get into the X86 architecture file: arch/x86/kernel/cpu/proc.c
    5. now find the cpuinfo_op
    6. from there go to the show_cpuinfo
    7. look trough the c_start function
    8. now explain cpusets ( Documentation/cgroups/cpusets.txt )
    9. implement the cpusets into cpuinfo
    - git grep cpuset
    kernel/cpuset.c:struct cpuset {
    kernel/cpuset.c: cpumask_var_t cpus_allowed; /* CPUs allowed to tasks in cpuset */

    kernel/sched/core.c: cpuset_cpus_allowed(p, cpus_allowed);

    see what is cpus_allowed -> cpumask_var_t
    you see that you have it from the cpuset struct
    then see what p is -> task_struct
    you can replace p with current since current is the task/process that is currently working in this CPU thread

    now... put everything together :)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Rsync
    1. rsync --help
    2. locate bwlimit
    3. git grep bwlimit
    4. open options.c
    5. Look at the code for bwlimit_arg
    6. Look at the files, see the flist.c
    7. Find send_directory(int f, struct file_list *flist, char *fbuf, int len,
    8. Look at the for cycle
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
606
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
3
Comments
2
Likes
1
Embeds 0
No embeds

No notes for slide

Idiot's approach to patching

  1. 1. Idiot's approach to patching Marian HackMan Marinov CEO of 1H Ltd. mm@1h.com CTO of GetClouder.com mm@getclouder.com
  2. 2. Idiot's approach to patching In this talk... The IDIOT... Unfortunately is ME :) CEO of 1H Ltd. mm@1h.com CTO of GetClouder.com mm@getclouder.com
  3. 3. Idiot's approach to patching ➢ Download the source and create a git repo in it ➢ Use git grep as much as possible ➢ Commit all changes that you do... ➢ even if they break the software ➢ Develop different approach or functionality in different branch ➢ Build often
  4. 4. Idiot's approach to patching ➢ There are two options ➢ you either need to change existing functionality ➢ or add a new one
  5. 5. Idiot's approach to patching ➢ With existing functionality ➢ try to find the code that implement it ➢ you can do that by searching for the cmdline/config file options and the flags/ints that are used to mark them ➢ you will see that in the examples
  6. 6. Idiot's approach to patching ➢ With new functionality ➢ Try to find the smallest other functionality that is present in the current software and copy/paste it with different name. ➢ Now that you have that... simply start modeling your functionality within the new code that you copied.
  7. 7. Idiot's approach to patching ➢ You SHOULD NOT try to learn and understand the whole code base, before you start to hack on it. ➢ You must try to find only the files that are relevant to what you want to change or add. ➢ While hacking, you shouldn't be concerned if you broke the software in different parts with your changes. ➢ If it works for you, that is enough!
  8. 8. Idiot's approach to patching Marian HackMan Marinov CEO of 1H Ltd. mm@1h.com CTO of GetClouder.com mm@getclouder.com
  9. 9. Idiot's approach to patching ➢ Now ... lets see how this works with real projects ➢ rsync ➢ the linux kernel
  10. 10. Idiot's approach to patching ➢ Rsync patching ➢ slow-down ➢ mount-ns
  11. 11. Idiot's approach to patching ➢ Linux Kernel patching ➢ How many of you know the difference between spinlock and mutex?
  12. 12. Idiot's approach to patching EXAMPLES :)
  13. 13. Idiot's approach to patching ??? QUESTIONS ??? Marian HackMan Marinov CEO of 1H Ltd. mm@1h.com CTO of GetClouder.com mm@getclouder.com
  14. 14. Idiot's approach to patching ??? QUESTIONS ??? Marian HackMan Marinov HVALA CEO of 1H Ltd. mm@1h.com CTO of GetClouder.com mm@getclouder.com

×