Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sys-kernel/usermode-helper: kernel hardening ebuild [WIP]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3839

PostPosted: Tue Sep 05, 2023 1:03 pm    Post subject: sys-kernel/usermode-helper: kernel hardening ebuild [WIP] Reply with quote

Code:
cat /var/db/repos/local/sys-kernel/usermode-helper/usermode-helper-9999.ebuild
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Auto-Generated by cargo-ebuild 0.5.4

EAPI=8

CRATES="
   capabilities-0.3.0
   libc-0.2.79
   proc-macro2-1.0.24
   quote-1.0.7
   serde-1.0.116
   serde_derive-1.0.116
   syn-1.0.43
   toml-0.4.10
   unicode-xid-0.2.1
"

inherit cargo git-r3

DESCRIPTION="usermode-helper: an implementation of the userspace side of the Linux kernel's CONFIG_STATIC_USERMODEHLEPER option"
HOMEPAGE="https://github.com/tych0/huldufolk"

EGIT_REPO_URI="https://github.com/tych0/huldufolk.git"

# License set may be more restrictive as OR is not respected
# use cargo-license for a more accurate license picture
LICENSE="Apache-2.0 MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"

src_unpack() {
      git-r3_src_unpack
      cargo_live_src_unpack
}

src_compile() {
      cargo_src_compile
}

src_install() {
      dodoc README.md
      cd target/release || die
      dobin usermode-helper
      elog "CONFIG_STATIC_USERMODEHLEPER should be set accordingly in kernel .config file(s)."
      elog "For more information visit ${HOMEPAGE}"
}
Current status:
Builds fine.
Yet untested.
-Ctarget-cpu=native remains unchanged here, maybe a toolstack issue here...

Prior to submit ebuild for integration, I welcome remarks about making this ebuild better.

There is no release/ in git, so -9999 seems required.
My current concerns are:

1) Unsure if CRATES variable is mandatory there...
Nevertheless it may proovide advantages, e.g. preventing /var/cache/distfiles crate files from deletion...

2)
Code:
/usr/share/doc
/usr/share/doc/usermode-helper-9999
/usr/share/doc/usermode-helper-9999/README.md.lzma
whereas Cargo.toml has
Code:
[package]
name = "usermode-helper"
version = "0.1.0"
So having /usr/share/doc/usermode-helper-0.1.0 instead sounds better to me, maybe mistakenly.

3) Dependencies remain undefined.

Plz feel free to add your own.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3839

PostPosted: Fri Aug 30, 2024 11:27 pm    Post subject: Reply with quote

Code:
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Auto-Generated by cargo-ebuild 0.5.4

EAPI=8

CRATES="
   capabilities-0.3.0
   libc-0.2.79
   proc-macro2-1.0.24
   quote-1.0.7
   serde-1.0.116
   serde_derive-1.0.116
   syn-1.0.43
   toml-0.4.10
   unicode-xid-0.2.1
"

inherit cargo git-r3

DESCRIPTION="usermode-helper: an implementation of the userspace side of the Linux kernel's CONFIG_STATIC_USERMODEHLEPER option"
HOMEPAGE="https://github.com/tych0/huldufolk"

EGIT_REPO_URI="https://github.com/tych0/huldufolk.git"

# License set may be more restrictive as OR is not respected
# use cargo-license for a more accurate license picture
LICENSE="Apache-2.0 MIT MPL-2.0"
SLOT="0"
KEYWORDS="~amd64"

DEPEND=""
RDEPEND="${DEPEND}"
BDEPEND=""

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"

src_unpack() {
      git-r3_src_unpack
      cargo_live_src_unpack
}

src_compile() {
      cargo_src_compile
}

src_install() {
      dodoc README.md
      cd target/x86_64-unknown-linux-gnu/release || die
      into /
      dosbin usermode-helper
      elog "CONFIG_STATIC_USERMODEHLEPER should be set accordingly in kernel .config file(s)."
      elog "For more information visit ${HOMEPAGE}"
}
Second line of src_install had to be changed to fix rebuild.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum