Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update odroidxu4-4.2 to rc6 #126

Open
paralin opened this issue Aug 14, 2015 · 17 comments
Open

update odroidxu4-4.2 to rc6 #126

paralin opened this issue Aug 14, 2015 · 17 comments

Comments

@paralin
Copy link

paralin commented Aug 14, 2015

I've merged Linux 4.2-rc6 to here: https://github.com/paralin/linux/tree/odroidxu4-v4.2-rc6

Suggesting to make a new branch in this repo and pull from mine.

Rc6 fixes a lot of bugs in rc1, including #125

~ Christian

@paralin
Copy link
Author

paralin commented Aug 14, 2015

Just tested on an odroid XU4, works as far as I can see.

@paralin
Copy link
Author

paralin commented Aug 14, 2015

Tested with docker. The defconfig I have to layer on top of it is as follows:

# docker requirements

# ip nat requirements
CONFIG_NET=y
CONFIG_INET=y
CONFIG_NETFILTER=y
CONFIG_NF_CONNTRACK=m
CONFIG_NF_CONNTRACK_IPV4=m
CONFIG_IP_NF_IPTABLES=y
CONFIG_NF_NAT=m
CONFIG_NF_NAT_IPV4=m
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_TARGET_MASQUERADE=m

# support multiple instances of devpts
CONFIG_TTY=y
CONFIG_UNIX98_PTYS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y

# cgroup scheduler
CONFIG_CGROUPS=y
CONFIG_CGROUP_SCHED=y

# required for below modules
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
CONFIG_CGROUPS=y
CONFIG_PERF_EVENTS=y

# virtual lan support
CONFIG_MACVLAN=m

# virtual eth
CONFIG_VETH=m

# xt match addrtype
CONFIG_NETFILTER_XTABLES=y
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
# xt match conntrack
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m

# optional docker requirements

# don't enable CONFIG_MEMCG_SWAP because it takes a lot of memory
CONFIG_BLK_CGROUP=y
CONFIG_CGROUP_PERF=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_RT_GROUP_SCHED=y

This might be good to include in the default odroidxu4 defconfig.

@scotte
Copy link

scotte commented Aug 20, 2015

4.2-rc7 came out a few days ago. Rebasing this branch on rc7 is trivial, the only conflict is on the RTL8152/RTL8153 driver (r8152.c) which is easily resolved by taking v2.04.0 from the XU4 branch versus v1.08.1 in the official kernel tree.

Here's my rebase of odroidxu4-v4.2-rc1 onto 4.2-rc7: https://github.com/scotte/odroid-linux/commits/odroidxu4-v4.2-rc7

@tobetter
Copy link
Collaborator

Scotte,
I love your branch since it's not merged branch.
Could you let me know the command what you made the branch?

@paralin
Copy link
Author

paralin commented Aug 20, 2015

He probably used rebase ? That's not so good since it doesn't keep the same
history very well.

But if you want to not have much comparability between the previous version
branch and this one, that's fine. It just rewrites commit history in there
and invalidates all the signatures. This means he could sneak in some virus
code and it would be very hard to notice.

Christian

On Wed, Aug 19, 2015, 10:40 PM Dongjin Kim [email protected] wrote:

Scotte,
I love your branch since it's not merged branch.
Could you let me know the command what you made the branch?


Reply to this email directly or view it on GitHub
#126 (comment).

@tobetter
Copy link
Collaborator

Thanks for notice.
I believe he might use cherry-pick instead of rebase. :)

My point is to put the commits probably SoC specific patches on top of mainline. Because the patches what HK team added on top of v4.2-rc1 are queued for code review in Patchwork or mailing list. These could be merged into mainline sometime or another modified patch could be. My perspective, these patches could make a conflict when the branch is merged with next version. So I prefer to keep these on top of any version of mainline release till major SoC features are merged into mainline. This might be ridiculous or my git skill is too poor. :)

Obviously, many patches are welcoming for XU4.

Dongjin.

@scotte
Copy link

scotte commented Aug 20, 2015

Yes, it was a rebase - there are arguments all around on the right way to do these things, but since this is an experimental branch and a rebase into a new topic branch, rewriting history isn't much of an issue for me - although it does change the way those github merges look. There no risk in my fork, because @tobetter would redo it and not use mine anyway.

Note the odroidxu4-v4.2-rc6 branch @paralin has includes some additional commits not in this repository. The HEAD of hardkernel's odroidxu4-v4.2-rc1 branch should be merged with the upstream 4.2-rc7 kernel, then these additional commits from @paralin reapplied.

The decision also depends on how all the commits to odroidxu4-v4.2-rc1 got there. If they were all direct commits to this branch or cherrypicks from elsewhere (so the SHAs don't match source anyway), then rewriting history is less of an issue. I'm not sure how the Samsung commits (for example) got there.

If there's a master-like origin to the branch, then rewriting history is a problem, especially if it will be merged back in. If this is just a topic branch that will eventually become a master-like branch then rewriting history is often acceptable (and again, this is done in a new branch anyway).

As @tobetter points out, this puts all local branch commits on top of the official kernel tree which makes dealing with those patches that will eventually make their way into mainline Linux kernel a bit easier. That even makes the argument easier, in my mind, because this branch really is just experimental until those SOC/etc changes are in mainline. To clean that up will result in rewriting history eventually regardless of the approach used.

We have to remember this is a fork of the kernel, not the origin - so it's a bit different than commiting back into the official master. I don't know hardkernel's ultimate plans for this repository, and it's branches, or how much of this stuff will end up in mainline versus being just in the hardkernel or XU4 forks. Those decisions tie in to the best way to manage this repository.

If you still want to go down the rebase route, here's the basics on how to do it. In this case rebasing on the main kernel branch means that git unwinds all commits on the local branch until it gets to a common ancestor, then fast-forwards to HEAD of the official kernel. Then, it replays each of the commits to your local branch.

This assumes that a remote tracking repository to https://github.com/torvalds/linux exists and that it's called "upstream". This is from memory, so syntax may not be syntactically correct.

# Sync branches from upstream
$ git fetch upstream

# Checkout the branch that we wish to rebase
$ git checkout odroidxu4-v4.2-rc1

# Make sure git status is clean at this point or bad things will happen
$ git status

# Create our new target branch
$ git checkout -b odroidxu4-v4.2-rc7

# Now we start the rebase from upstream kernel
$ git rebase upstream/master

# Git will now unwind to a common ancestor, fast-forward to HEAD of upstream, then
# start applying each local commit. For conflicts (where git is unable to resolve a merge
# because a file was changed in both branches), that has to be iterated on. In this case,
# there's only one (r8152.c).

# For conflicts, chose a winner. This is somewhat confusing at this stage because "ours"
# mean mainline and "theirs" means the local branch during a rebase. I generally always
# use mergetool with meld, since it gives me a nice graphical way to see which one I want.

$ git mergetool

# For r8152.c, I took the new version from hardkernel's branch, not the one in the upstream kernel.

# Once merged, make sure git status is clean, may require git adding additional artifacts.

$ git status

# Now continue to the next iteration

$ git rebase --continue

# That's it! Except for pushing the new branch up.

# If things go bad, it's no harm since this is on a new branch and it's easy to reset:

$ git rebase --abort

That's the git rebase primer, and again I'll defer to hardkernel on how they wish to manage the repository. There's no one right way with git! :-)

@scotte
Copy link

scotte commented Sep 3, 2015

FYI, Linux 4.2 kernel has been released and all patches on this branch rebase/merge cleanly (aside from r8152.c already discussed above).

@tobetter
Copy link
Collaborator

tobetter commented Sep 4, 2015

Hey, I've uploaded v4.2 kernel for ODROID-XU4 but not on Hardkernel's repository since the kernel is experimental and not stable enough to publish for generic end users. Still there are many missing features on mainline for Exynos5422.

Please visit here, https://github.com/tobetter/linux/tree/odroidxu4-v4.2
I'm expecting to maintain the branch adding upstream patches till v4.3 comes out as well as kernel debian package will be published in Launchpad, https://code.launchpad.net/~tobetter/+junk/odroidxu4-v4.2. I hope I can manage this enough to publish officially.

@eraclitux
Copy link

Is it possible to know exactly which features are unavailable (HMP, etc)?

Thanks.

@tobetter
Copy link
Collaborator

tobetter commented Sep 4, 2015

The build itself is just ok to run headless server, but would not say it has maximum or customized performance. HMP is not there and X11 won't work on it. Performance wise, USB and Micro SD...won't support full functions. What features exactly do you want to know?

@eraclitux
Copy link

HMP is what I was looking for. I use it as a server but I was needing some functionality missing in 3.10 to run LXC containers (overlay fs etc).
Thanks.

@paralin
Copy link
Author

paralin commented Sep 8, 2015

@tobetter What about the defconfig changes? Might be worth bringing in.

@tobetter
Copy link
Collaborator

tobetter commented Sep 9, 2015

@paralin Ah, yes....worth to bring in. Sorry for delay due to some heavy work. Please kick my ass if it doesn't happen in 24 hours.

@paralin
Copy link
Author

paralin commented Sep 9, 2015

It's not critical to me since we merge defconfigs before building with our
own custom overrides, but thanks! :)

On Tue, Sep 8, 2015 at 9:08 PM Dongjin Kim [email protected] wrote:

@paralin https://github.com/paralin Ah, yes....worth to bring in. Sorry
for delay due to some heavy work. Please kick my ass if it doesn't happen
in 24 hours.


Reply to this email directly or view it on GitHub
#126 (comment).

tobetter added a commit to tobetter/linux that referenced this issue Sep 14, 2015
Requested by paralin,
hardkernel#126 (comment)

Change-Id: I44c30ab5fa7f2f4ec0f2afc2dffded01b4420f44
Signed-off-by: Dongjin Kim <[email protected]>
@paralin
Copy link
Author

paralin commented Nov 4, 2015

@tobetter Any plans to merge up to 4.2 official?

@tobetter
Copy link
Collaborator

tobetter commented Nov 4, 2015

Obihoernchen pushed a commit to Obihoernchen/linux that referenced this issue Mar 5, 2016
commit 63e41eb upstream.

We miss to take the crypto_alg_sem semaphore when traversing the
crypto_alg_list for CRYPTO_MSG_GETALG dumps. This allows a race with
crypto_unregister_alg() removing algorithms from the list while we're
still traversing it, thereby leading to a use-after-free as show below:

[ 3482.071639] general protection fault: 0000 [hardkernel#1] SMP
[ 3482.075639] Modules linked in: aes_x86_64 glue_helper lrw ablk_helper cryptd gf128mul ipv6 pcspkr serio_raw virtio_net microcode virtio_pci virtio_ring virtio sr_mod cdrom [last unloaded: aesni_intel]
[ 3482.075639] CPU: 1 PID: 11065 Comm: crconf Not tainted 4.3.4-grsec+ hardkernel#126
[ 3482.075639] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
[ 3482.075639] task: ffff88001cd41a40 ti: ffff88001cd422c8 task.ti: ffff88001cd422c8
[ 3482.075639] RIP: 0010:[<ffffffff93722bd3>]  [<ffffffff93722bd3>] strncpy+0x13/0x30
[ 3482.075639] RSP: 0018:ffff88001f713b60  EFLAGS: 00010202
[ 3482.075639] RAX: ffff88001f6c4430 RBX: ffff88001f6c43a0 RCX: ffff88001f6c4430
[ 3482.075639] RDX: 0000000000000040 RSI: fefefefefefeff16 RDI: ffff88001f6c4430
[ 3482.075639] RBP: ffff88001f713b60 R08: ffff88001f6c4470 R09: ffff88001f6c4480
[ 3482.075639] R10: 0000000000000002 R11: 0000000000000246 R12: ffff88001ce2aa28
[ 3482.075639] R13: ffff880000093700 R14: ffff88001f5e4bf8 R15: 0000000000003b20
[ 3482.075639] FS:  0000033826fa2700(0000) GS:ffff88001e900000(0000) knlGS:0000000000000000
[ 3482.075639] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 3482.075639] CR2: ffffffffff600400 CR3: 00000000139ec000 CR4: 00000000001606f0
[ 3482.075639] Stack:
[ 3482.075639]  ffff88001f713bd8 ffffffff936ccd00 ffff88001e5c4200 ffff880000093700
[ 3482.075639]  ffff88001f713bd0 ffffffff938ef4bf 0000000000000000 0000000000003b20
[ 3482.075639]  ffff88001f5e4bf8 ffff88001f5e4848 0000000000000000 0000000000003b20
[ 3482.075639] Call Trace:
[ 3482.075639]  [<ffffffff936ccd00>] crypto_report_alg+0xc0/0x3e0
[ 3482.075639]  [<ffffffff938ef4bf>] ? __alloc_skb+0x16f/0x300
[ 3482.075639]  [<ffffffff936cd08a>] crypto_dump_report+0x6a/0x90
[ 3482.075639]  [<ffffffff93935707>] netlink_dump+0x147/0x2e0
[ 3482.075639]  [<ffffffff93935f99>] __netlink_dump_start+0x159/0x190
[ 3482.075639]  [<ffffffff936ccb13>] crypto_user_rcv_msg+0xc3/0x130
[ 3482.075639]  [<ffffffff936cd020>] ? crypto_report_alg+0x3e0/0x3e0
[ 3482.075639]  [<ffffffff936cc4b0>] ? alg_test_crc32c+0x120/0x120
[ 3482.075639]  [<ffffffff93933145>] ? __netlink_lookup+0xd5/0x120
[ 3482.075639]  [<ffffffff936cca50>] ? crypto_add_alg+0x1d0/0x1d0
[ 3482.075639]  [<ffffffff93938141>] netlink_rcv_skb+0xe1/0x130
[ 3482.075639]  [<ffffffff936cc4f8>] crypto_netlink_rcv+0x28/0x40
[ 3482.075639]  [<ffffffff939375a8>] netlink_unicast+0x108/0x180
[ 3482.075639]  [<ffffffff93937c21>] netlink_sendmsg+0x541/0x770
[ 3482.075639]  [<ffffffff938e31e1>] sock_sendmsg+0x21/0x40
[ 3482.075639]  [<ffffffff938e4763>] SyS_sendto+0xf3/0x130
[ 3482.075639]  [<ffffffff93444203>] ? bad_area_nosemaphore+0x13/0x20
[ 3482.075639]  [<ffffffff93444470>] ? __do_page_fault+0x80/0x3a0
[ 3482.075639]  [<ffffffff939d80cb>] entry_SYSCALL_64_fastpath+0x12/0x6e
[ 3482.075639] Code: 88 4a ff 75 ed 5d 48 0f ba 2c 24 3f c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 85 d2 48 89 f8 48 89 f9 4c 8d 04 17 48 89 e5 74 15 <0f> b6 16 80 fa 01 88 11 48 83 de ff 48 83 c1 01 4c 39 c1 75 eb
[ 3482.075639] RIP  [<ffffffff93722bd3>] strncpy+0x13/0x30

To trigger the race run the following loops simultaneously for a while:
  $ while : ; do modprobe aesni-intel; rmmod aesni-intel; done
  $ while : ; do crconf show all > /dev/null; done

Fix the race by taking the crypto_alg_sem read lock, thereby preventing
crypto_unregister_alg() from modifying the algorithm list during the
dump.

This bug has been detected by the PaX memory sanitize feature.

Signed-off-by: Mathias Krause <[email protected]>
Cc: Steffen Klassert <[email protected]>
Cc: PaX Team <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants