[ale] [OT] Helping others learn C, D, X, Y, Z, EIEIO...

Scott M. Jones eff at dragoncon.org
Tue Dec 15 12:25:35 EST 2015


I could offer the following topics but you'll need a good C background.

- Data structures, associated algorithms, Big-O Notation

- Beginner compiler design, at least stack vs. heap but if you want,
BNF, lex, yacc, etc.

- Beginner thread coding and thread safety


Sample data structure exercise, we need to do this kind of thing to make
it real:

Write 'llproc' (linked list processor) in C with the following command
line options:

llproc [-d] file1 file2

llproc will construct a linked list of structs using newline-terminated
strings from file1 with the following definition:

struct {
   int line_no;  /* Line number in file1 */
   char *line;
}

Linked list will be parsed for each line in file2 and any exact matches
will be deleted from the linked list, otherwise a warning is written to
STDOUT if no matches.  Remaining linked list will be traversed and
written to STDOUT after file2 is processed.  '-d' option prints every
insert/delete, otherwise only warnings and the final list are printed.

All linked list access must be through functional API (with add, search,
delete, iterate_all, etc.).  NOT COOL to put everything in main()!  No
goto, setjmp, or longjmp either.  Use malloc/free for all list elements
and string storage.

Students will present solutions via code walkthrough to everyone.  No
grading after the fact.  Instructor to make solution available after
walkthroughs.

BONUS: Solution survives fuzzing attempts with very long strings; only
acceptable failure modes are invalid command line options, file not
found, or out of memory, all handled gracefully.  Add an arbitrary
number of files with file3 being tacked on to the end of the list, file4
then being deleted from the list, etc., to prove that memory is being
free'd correctly.


On 12/15/15 7:06 AM, Leam Hall wrote:
> I'd like to encourage those of you who are decent to very good
> programmers to consider what we're doing as a calling.
> 
> Recently I took a C based pre-test for a software security course
> (https://class.coursera.org/softwaresec-008). Realizing that I guessed
> more than I was comfortable with is one of the big things that drove me
> to re-learn C. That, and a stack of books from previous failed attempts.
> I've resolved to either learn C or give away the books. Being a
> bookworm, that's motivation!
> 
> Your conversations have pointed out something many of us unskilled
> programmers have heard of; there are other skills and tools to be
> learned when moving from example code in a book to putting "coder" on a
> resume. Things like lint, TDD, gmake, coding standards, etc.
> 
> Would you consider a "Next Steps" course starting in April or May? While
> the LCTHW-90DW is a 3 month challenge, it is based off the learning idea
> that the early stages of any new and difficult project are discouraging.
> With just 2-4 hours of C it can be hard to glimpse the possibility of
> becoming a kernel hacker. However, there comes a point (~20 hours per
> Josh Kaufman) where you're still a rank beginner but things aren't so
> painful.
> 
> By the time someone is through the 90 day challenge they will have
> enough discipline and pleasure to take on new tools. Maybe you run a one
> month "TDD with C" program, or "Dive into Pointers"? Or maybe you like
> some of the Coursera classes and offer to help mentor alongside the
> classwork? The security class is one option, there are Algorithm
> classes, Java classes, and a bunch of Python things going.
> 
> There seem to be several of you who are good at this. Could you talk
> amongst yourselves, come up with a list of "new programmers should have
> these skills", and pick one to mentor? If each of you did one to two
> "skill months" a year, and there were 4-6 of you, we could just about
> fill the year!
> 
> Here are some of the things that have come to mind while reading your
> notes.
> 
>     Pointers
>     Kernel module basics
>     TDD
>     Secure coding
>     Large project management (splint, gmake, SDLC)
>     Assembler basics
>     Code profiling (gdb, valgrind)
>     Systems programming on Linux
>     Algorithms
> 
> Thoughts? Could we go so far as to resurrect a project like splint or
> something and bring it forward? Or help people transition into kernel
> janitors?
> 
> Leam



More information about the Ale mailing list