Commit Graph

231 Commits

Author SHA1 Message Date
Mark Yacoub
9dd049e2e0 Third-Party Import of: https://github.com/illiliti/libudev-zero.git
Request Document: go/android3p
For CL Reviewers: go/android3p#reviewing-a-cl
For Build Team: go/ab-third-party-imports
Bug: http://b/413100836
Test: libudev-zero
Original import of the code can be found at: https://googleplex-android.googlesource.com/platform/external/libudev-zero/+/refs/heads/third-party-review.
Security Questionnaire: http://b/413100836#comment1

Change-Id: I17b30efbd9e0785dd8ccf8a7cb77017e166af9fb
2025-05-14 10:32:24 -04:00
Matt
bbeb7ad51c Fixes incorrect detection of touchpads (#66)
Some touchpad drivers (such as applespi) claim to have both EV_ABS and EV_REL
capabilities. These touchpads are then reported as mice by libudev-zero.
2024-02-13 14:20:52 +03:00
Sertonix
c027f870c8 README: update link to PipeWire patch (#64) 2024-02-13 14:19:20 +03:00
liamHowatt
5eca08d71d Avoidable OOM on small systems (#62)
* bandaid fix OOM

* refactor fix OOM

* Makefile: remove no longer needed -pthread option

* libudev.pc.in: remove threads requirement

---------

Co-authored-by: illiliti <illiliti@protonmail.com>
2023-12-05 12:15:26 +03:00
Mingjie Shen
a2cc51bb14 udev_device.c: fix TOCTOU race condition (#57)
Separately checking the state of a file before operating on it may allow
an attacker to modify the file between the two operations.

Reference: CWE-367.
2023-12-05 11:41:24 +03:00
Brian
90480bf525 Add CodeQL Workflow for Code Security Analysis (#61)
* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every push and pull request to the main branch.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for third-party code, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation.

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

* Add CodeQL Workflow for Code Security Analysis

Add CodeQL Workflow for Code Security Analysis

This pull request introduces a CodeQL workflow to enhance the security analysis of our repository. CodeQL is a powerful static analysis tool that helps identify and mitigate security vulnerabilities in our codebase. By integrating this workflow into our GitHub Actions, we can proactively identify and address potential issues before they become security threats.

We added a new CodeQL workflow file (.github/workflows/codeql.yml) that
- Runs on every pull request (functionality to run on every push to main branches is included as a comment for convenience).
- Runs daily.
- Excludes queries with a high false positive rate or low-severity findings.
- Does not display results for git submodules, focusing only on our own codebase.

Testing:
To validate the functionality of this workflow, we have run several test scans on the codebase and reviewed the results. The workflow successfully compiles the project, identifies issues, and provides actionable insights while reducing noise by excluding certain queries and third-party code.

Deployment:
Once this pull request is merged, the CodeQL workflow will be active and automatically run on every push and pull request to the main branch. To view the results of these code scans, please follow these steps:
1. Under the repository name, click on the Security tab.
2. In the left sidebar, click Code scanning alerts.

Additional Information:
- You can further customize the workflow to adapt to your specific needs by modifying the workflow file.
- For more information on CodeQL and how to interpret its results, refer to the GitHub documentation and the CodeQL documentation (https://codeql.github.com/ and https://codeql.github.com/docs/).

Signed-off-by: Brian <bayuan@purdue.edu>

---------

Signed-off-by: Brian <bayuan@purdue.edu>
2023-12-05 11:40:23 +03:00
illiliti
ee32ac5f64 Makefile: bump libudev version 2023-07-10 14:15:04 +03:00
illiliti
99f1bc955a udev_device.c: stub udev_device_get_current_tags_list_entry impl 2023-07-10 14:13:58 +03:00
illiliti
04a727df50 udev_device.c: consider device valid even if no subsystem symlink exists
Some devices may not have subsystem symlinks, therefore we cannot rely
on that to check if device is valid. Instead, check uevent file which
should be always present in valid device.

Reference: https://github.com/openwrt/openwrt/issues/12350
2023-04-18 09:28:02 +03:00
illiliti
e5587c6edb Makefile: fix compatibility with smake 2022-07-12 01:12:37 +03:00
Nihal Jere
713e7dbe75 README: grammar fixes 2022-07-11 16:13:25 -05:00
Marc-André Moreau
4a28cc57e4 fix undefined LINE_MAX on Android 2022-04-15 10:14:22 -04:00
illiliti
4154cf252c udev_enumerate.c: support NULL value in match/nomatch
Fixes: #45
2021-12-16 08:30:49 +03:00
Alyssa Ross
505c61819b Makefile: support static-only builds
One of the problems with udev is that systemd cannot be built
statically[1].  With libudev-zero, on the other hand, no code changes
are required to be able to do a static-only build, only Makefile
changes.

With this change, it's possible to "make install-static" to do a
static-only build of libudev-zero.

[1]: https://github.com/systemd/systemd/pull/20621#issuecomment-912014839
2021-11-29 22:38:45 +00:00
illiliti
938b959402 readme: mention PipeWire patch 2021-11-17 00:20:57 +03:00
illiliti
ec47f63d6b Revert "udev_enumerate.c: fix pipeware"
This reverts commit 4510b27a9b.
2021-11-16 16:17:47 +03:00
illiliti
b8a0b953e6 Revert "Makefile: add stub symbol versioning"
This reverts commit 000ff7bf2f.
2021-11-16 16:17:40 +03:00
Firas Khalil Khana
6651ccc9d6 Fix typo 2021-11-16 16:19:50 +03:00
illiliti
7265d305c2 various: fix memory leaks
Closes: #41
2021-10-08 08:53:04 +03:00
illiliti
caaa021290 udev_device.c: ignore devices without subsystem
Do not allocate udev_device if device doesn't have subsystem.

Fixes: #43
2021-10-08 08:36:20 +03:00
illiliti
6250984089 readme: add cups and workaround for pulseaudio 2021-09-09 23:53:51 +03:00
illiliti
858f0b107f readme: pros/cons 2021-09-09 03:01:12 +03:00
illiliti
000ff7bf2f Makefile: add stub symbol versioning
Fixes: #38
2021-09-08 21:44:45 +03:00
illiliti
af4dc2ff14 readme: rewrite why, add pros/cons 2021-09-08 21:26:18 +03:00
illiliti
99676e0e04 readme: What works -> What doesn't work 2021-09-07 01:49:28 +03:00
illiliti
c7669d8eec udev_enumerate.c: fix endless loop in filter_property 2021-09-05 17:22:32 +03:00
illiliti
3c2593376a readme: future directions 2021-09-02 21:39:59 +03:00
illiliti
8044ed8fd6 contrib/helper.c: remove redundant bind call 2021-08-29 04:59:31 +03:00
illiliti
8a4b5b582c udev_monitor.c: bitmask is unsigned 2021-08-29 04:55:14 +03:00
illiliti
c2a08cdd79 contib/mdev.conf: mdevd can rebroadcast uevents natively 2021-08-28 02:28:05 +03:00
illiliti
fc22990609 implement file-less hotplugging 2021-08-27 01:13:34 +00:00
illiliti
4510b27a9b udev_enumerate.c: fix pipeware
This is partial fix because pipeware relies on udev-specific
properties that aren't provided by libudev-zero.

Fixes: #26
2021-08-25 06:03:39 +03:00
illiliti
d8c4dc4ce3 udev_device.c: define INPUT_PROP_CNT 2021-08-25 03:22:30 +03:00
illiliti
3d98bea289 *: code cleanup 2021-08-25 01:38:33 +03:00
illiliti
5f9186af41 contrib/*: be more explicit 2021-08-21 01:57:41 +03:00
illiliti
bf23c9e5ba udev_device.c: fix integer overflow
Bitwise AND operation can produce value that may be larger than
test_bit() return value. Convert result to bool using `!!` to
avoid integer overflow.

Fixes: #33
2021-06-26 01:21:43 +03:00
illiliti
bd7d1803e6 udev_enumerate.c: fix possible memory leak
Early return due to pthread_create() failure causes memory leak.
2021-06-11 14:06:20 +03:00
Naoto Yamaguchi
eb30a8bc85 Fix install error at make install
At db72f8610d is missing change in Makefile.
This err was reporting at bkuhls.
This patch fix it.
2021-06-09 08:37:50 +00:00
illiliti
692cb07e55 readme: prettify
reading it in plain text was painful, now it's fixed.
2021-06-06 14:23:59 +03:00
illiliti
752403eb9c readme: drop TODO 2021-06-06 10:53:03 +03:00
illiliti
e75aced4de udev_device.c: drop TODO 2021-06-06 10:52:20 +03:00
illiliti
7c94940e12 Revert "udev_device.c: use strrchr to trim newline"
This reverts commit 34f8727f28.
2021-06-06 10:50:38 +03:00
illiliti
e23633ec56 udev_device.c: more accurate keys/keyboard detection 2021-06-06 10:29:55 +03:00
illiliti
34f8727f28 udev_device.c: use strrchr to trim newline 2021-06-06 10:29:55 +03:00
Naoto Yamaguchi
75a40e1040 Add license information to source files
Current libudev-zero source code doesn't have license information in source files.
This patch add license information to source files based on SPDX standard.
2021-06-05 07:38:25 +00:00
Naoto Yamaguchi
db72f8610d Fix building library name from libudev.so to libudev.so.1
Currently, "-soname" set at "libudev.so.1", but building library file name was "libudev.so".
Typical shared library structure as a follow;
  libudev.so -> libudev.so.1
  libudev.so.1
Current installation is reversed.

This patch fix this.
2021-06-05 07:38:25 +00:00
Naoto Yamaguchi
def1a43f53 Add PKGCONFIGDIR for installation
Ubuntu/Debian style file placement are ;
 No.1 libudev.so and libudev.so.1 in /lib or /lib/arch/
 No.2 libudev.h in /usr/include
 No.3 libudev.pc in /usr/lib/pkgconfig or /usr/lib/arch/pkgconfig

Current Makefile can install No.1 and No.2 pattern by
"make PREFIX=/usr LIBDIR=/lib INCLUDEDIR=/usr/include install",
but it can't install No.3 pattern.

This patch added PKGCONFIGDIR environment variable to achieve all install pattern by
"make PREFIX=/usr LIBDIR=/lib INCLUDEDIR=/usr/include PKGCONFIGDIR=/usr/lib install"
2021-06-05 07:38:25 +00:00
illiliti
ed6c3e5c2d udev_monitor.c: check UDEV_MONITOR_DIR only for existence
Fixes #30
2021-06-04 20:15:45 +03:00
illiliti
23e9b6f8f4 udev_monitor.c: drip sticky bit for now 2021-06-04 00:35:15 +03:00
illiliti
a81cb4444d udev_device.c: decrement size by 1
SUBSYSTEM == 9, not 10. same for others
2021-06-03 12:06:18 +03:00